Table of contents
Namespace: Com\Tecnick\Pdf\Encrypt\Type
File: AESnopad.php line 36
AES no-padding
Tags
- since: 2011-05-23
- category: Library
- author: Nicola Asuni info@tecnick.com
- copyright: 2011-2026 Nicola Asuni - Tecnick.com LTD
- license: https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
- link: https://github.com/tecnickcom/tc-lib-pdf-encrypt
Constants
BLOCKSIZE
File: AESnopad.php line 44
public int BLOCKSIZE = 16
IVECT
File: AESnopad.php line 51
public string IVECT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
VALID_CIPHERS
File: AESnopad.php line 58
public array<string|int, string> VALID_CIPHERS = ['aes-128-cbc', 'aes-256-cbc']
Methods
checkCipher()
File: AESnopad.php line 158
public checkCipher(string $cipher) : void
Parameters
- $cipher : string: openSSL cipher name.
Tags
- throws: Exception in case of error.
checkKeyLength()
File: AESnopad.php line 179
public checkKeyLength(string $key, string $cipher) : void
OpenSSL zero-extends a short key and truncates a long one.
Parameters
- $key : string: Encryption key.
- $cipher : string: openSSL cipher name.
Tags
- throws: Exception in case of error.
decrypt()
File: AESnopad.php line 115
public decrypt(string $data, string $key[, string $ivect = self::IVECT ][, string $mode = 'aes-256-cbc' ]) : string
encrypt() zero-pads the plaintext to 16-byte alignment and applies no block padding, so this method decrypts with OPENSSL_ZERO_PADDING and returns the zero-padded plaintext. The caller strips any trailing zero bytes.
Parameters
- $data : string: Encrypted data (produced by encrypt()).
- $key : string: Encryption key.
- $ivect : string = self::IVECT: Initialization vector (default: 16 zero bytes).
- $mode : string = ‘aes-256-cbc’: Cipher (default: aes-256-cbc).
Tags
- throws: Exception When decryption fails.
Return values
string —
Decrypted data string.
encrypt()
File: AESnopad.php line 75
public encrypt(string $data, string $key[, string $ivect = self::IVECT ][, string $mode = 'aes-256-cbc' ]) : string
Parameters
- $data : string: Data string to encrypt
- $key : string: Encryption key
- $ivect : string = self::IVECT: Initialization vector
- $mode : string = ‘aes-256-cbc’: Cipher
Tags
- throws: Exception
Return values
string —
Encrypted data string.