module HexaPDF::Encryption::AES
def self.prepended(klass) # :nodoc:
Automatically extends the klass with the necessary class level methods.
def self.prepended(klass) # :nodoc: klass.extend(ClassMethods) end
def initialize(key, iv, mode)
Classes prepending this module have to have their own initialization method as this method
The mode must either be :encrypt or :decrypt.
Creates a new AES object using the given encryption key and initialization vector.
def initialize(key, iv, mode) unless VALID_KEY_LENGTH.include?(key.length) raise HexaPDF::EncryptionError, "AES key length must be 128, 192 or 256 bit" end unless iv.length == BLOCK_SIZE raise HexaPDF::EncryptionError, "AES initialization vector length must be 128 bit" end mode = mode.intern super end