AesGcm::Cipher
Main cipher class for AES-256-GCM operations
Constructors
Instance methods
Decrypt ciphertext using AES-256-GCM
Parameters:
- key: 32-byte encryption key (String or Bytes)
- ciphertext: Encrypted data (Bytes)
- iv: Initialization vector used during encryption
- auth_tag: Authentication tag from encryption
Returns: Decrypted data as Bytes Raises: OpenSSL::Cipher::Error if authentication fails or data is corrupted
Decrypt from EncryptedData struct
Helper method to decrypt from base64-encoded string
Encrypt plaintext using AES-256-GCM
Parameters:
- key: 32-byte encryption key (String or Bytes)
- plaintext: Data to encrypt (String or Bytes)
- iv: Optional initialization vector (defaults to random)
Returns: EncryptedData containing ciphertext, iv, and auth_tag
Helper method to encrypt and return base64-encoded string
iv_size
Sourcekey_size
Sourcetag_size
Source