AesGcmCipher
in package
implements
Cipher
AES-256-GCM through OpenSSL. Payload layout: iv (12) . tag (16) . ciphertext.
Interfaces, Classes and Traits
- Cipher
- An authenticated cipher behind Encryption. Implementations must detect a wrong key or a modified payload, so only AEAD algorithms qualify.
Table of Contents
- ALGORITHM = "aes-256-gcm"
- IV_LENGTH = 12
- TAG_LENGTH = 16
- decrypt() : string
- encrypt() : string
Constants
ALGORITHM
private
mixed
ALGORITHM
= "aes-256-gcm"
IV_LENGTH
private
mixed
IV_LENGTH
= 12
TAG_LENGTH
private
mixed
TAG_LENGTH
= 16
Methods
decrypt()
public
decrypt(string $key, string $payload) : string
Parameters
- $key : string
-
32 raw bytes
- $payload : string
Return values
string —encrypt()
public
encrypt(string $key, string $plaintext) : string
Parameters
- $key : string
-
32 raw bytes
- $plaintext : string
Return values
string —Raw bytes, including everything decrypt() needs besides the key