module HexaPDF:: Encryption:: AES
Common interface for AES algorithms
This module defines the common interface that is used by the security handlers to encrypt or decrypt data with AES. It has to be prepended by any specific AES algorithm class.
See the ClassMethods module for available class level methods of AES algorithms.
Implementing an AES Class¶ ↑
An AES class needs to define at least the following methods:
- initialize(key, iv, mode)
-
Initializes the
AESalgorithm with the given key and initialization vector. The mode determines how theAESalgorithm object works: If the mode is :encrypt, the object encrypts the data, if the mode is :decrypt, the object decrypts the data. - process(data)
-
Processes the data and returns the encrypted/decrypted data. The method can assume that the passed in data always has a length that is a multiple of
BLOCK_SIZE.