Method: AEAD::Cipher#encrypt
- Defined in:
- lib/aead/cipher.rb
#encrypt(nonce, aad, plaintext) ⇒ String
Encrypts a plaintext using the current Cipher.
IMPORTANT: Do not ever encrypt data using the same nonce more than once given a particular secret key. Doing so will violate the security guarantees of the AEAD cipher.
112 113 114 115 116 117 118 119 120 |
# File 'lib/aead/cipher.rb', line 112 def encrypt(nonce, aad, plaintext) _verify_nonce_bytesize(nonce, self.nonce_len) self._encrypt( _pad_nonce(nonce), aad, plaintext ) end |