isAeadCipher.php
Table of Contents
Functions
- isAeadCipher() : bool
- Determines whether an OpenSSL cipher name designates an AEAD mode.
Functions
isAeadCipher()
Determines whether an OpenSSL cipher name designates an AEAD mode.
isAeadCipher(string $cipher) : bool
AEAD (Authenticated Encryption with Associated Data) ciphers compute an
authentication tag in addition to the ciphertext. PHP's openssl_encrypt()
/ openssl_decrypt() API requires the &$tag parameter for these ciphers;
without it, integrity is not protected.
Currently recognised modes:
- GCM (Galois/Counter Mode) — preferred for general use.
- CCM (Counter with CBC-MAC).
- OCB (Offset Codebook) — modern, less ubiquitous.
The check is purely textual on the cipher name (case-insensitive).
Parameters
- $cipher : string
-
Cipher name as returned by
openssl_get_cipher_methods(), e.g.'aes-256-gcm','aes-128-ccm','aes-256-cbc'.
Tags
Return values
bool —True if the cipher operates in an AEAD mode.