class PDF::Reader::AesV3SecurityHandler


Requires a decryption key, which is usually generated by PDF::Reader::KeyBuilderV5
Decrypts data using the AESV3 algorithim defined in the PDF 1.7, Extension Level 3 spec.

def decrypt( buf, ref )


ref - a PDF::Reader::Reference for the object to decrypt
buf - a string to decrypt

used to decrypt RC4/AES encrypted PDF streams (buf)

Algorithm 1: Encryption of data using the RC4 or AES algorithms

#7.6.2 General Encryption Algorithm
def decrypt( buf, ref )
  cipher = OpenSSL::Cipher.new(@cipher)
  cipher.decrypt
  cipher.key = @encrypt_key.dup
  cipher.iv = buf[0..15]
  cipher.update(buf[16..-1]) + cipher.final
end

def initialize(key)

def initialize(key)
  @encrypt_key = key
  @cipher = "AES-256-CBC"
end