module Origami::Encryption::EncryptedObject
Module for encrypted PDF objects.
Attributes
algorithm[W]
decrypted[RW]
encryption_handler[W]
encryption_key[W]
Public Class Methods
extended(obj)
click to toggle source
# File lib/origami/encryption.rb, line 426 def self.extended(obj) obj.decrypted = false end
Public Instance Methods
post_build()
click to toggle source
Calls superclass method
# File lib/origami/encryption.rb, line 430 def post_build encrypt! super end
Private Instance Methods
compute_object_key()
click to toggle source
# File lib/origami/encryption.rb, line 438 def compute_object_key if @encryption_handler.V < 5 parent = self.indirect_parent no, gen = parent.no, parent.generation k = @encryption_key + [no].pack("I")[0..2] + [gen].pack("I")[0..1] key_len = (k.length > 16) ? 16 : k.length k << "sAlT" if @algorithm == Encryption::AES Digest::MD5.digest(k)[0, key_len] else @encryption_key end end