class HexaPDF::Encryption::FastAES

Parent

Implementation of the general encryption algorithm AES using OpenSSL as backend.

Since OpenSSL is a native Ruby extension (that comes bundled with Ruby) it is much faster than the pure Ruby version and it can use the AES-NI instruction set on CPUs when available.

This implementation is using AES in Cipher Block Chaining (CBC) mode.

See: PDF2.0 s7.6.3

Public Class Methods

new(key, iv, mode)

Creates a new FastAES object using the given encryption key and initialization vector.

The mode must either be :encrypt or :decrypt.

random_bytes(n)

Uses OpenSSL to generate the requested random bytes.

See AES::ClassMethods#random_bytes for more information.

Public Instance Methods

process(data)

Encrypts or decrypts the given data whose length must be a multiple of 16.