Package io.grpc.alts.internal
Interface AeadCrypter
-
- All Known Implementing Classes:
AesGcmAeadCrypter,AesGcmHkdfAeadCrypter
interface AeadCrypterAeadCrypterperforms authenticated encryption and decryption for a fixed key given unique nonces. Authenticated additional data is supported.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddecrypt(java.nio.ByteBuffer plaintext, java.nio.ByteBuffer ciphertext, byte[] nonce)Decrypt ciphertext into plaintext buffer using the given nonce.voiddecrypt(java.nio.ByteBuffer plaintext, java.nio.ByteBuffer ciphertext, java.nio.ByteBuffer aad, byte[] nonce)Decrypt ciphertext into plaintext buffer using the given nonce.voidencrypt(java.nio.ByteBuffer ciphertext, java.nio.ByteBuffer plaintext, byte[] nonce)Encrypt plaintext into ciphertext buffer using the given nonce.voidencrypt(java.nio.ByteBuffer ciphertext, java.nio.ByteBuffer plaintext, java.nio.ByteBuffer aad, byte[] nonce)Encrypt plaintext into ciphertext buffer using the given nonce with authenticated data.
-
-
-
Method Detail
-
encrypt
void encrypt(java.nio.ByteBuffer ciphertext, java.nio.ByteBuffer plaintext, byte[] nonce) throws java.security.GeneralSecurityExceptionEncrypt plaintext into ciphertext buffer using the given nonce.- Parameters:
ciphertext- the encrypted plaintext and the tag will be written into this buffer.plaintext- the input that should be encrypted.nonce- the unique nonce used for the encryption.- Throws:
java.security.GeneralSecurityException- if ciphertext buffer is short or the nonce does not have the expected size.
-
encrypt
void encrypt(java.nio.ByteBuffer ciphertext, java.nio.ByteBuffer plaintext, java.nio.ByteBuffer aad, byte[] nonce) throws java.security.GeneralSecurityExceptionEncrypt plaintext into ciphertext buffer using the given nonce with authenticated data.- Parameters:
ciphertext- the encrypted plaintext and the tag will be written into this buffer.plaintext- the input that should be encrypted.aad- additional data that should be authenticated, but not encrypted.nonce- the unique nonce used for the encryption.- Throws:
java.security.GeneralSecurityException- if ciphertext buffer is short or the nonce does not have the expected size.
-
decrypt
void decrypt(java.nio.ByteBuffer plaintext, java.nio.ByteBuffer ciphertext, byte[] nonce) throws java.security.GeneralSecurityExceptionDecrypt ciphertext into plaintext buffer using the given nonce.- Parameters:
plaintext- the decrypted plaintext will be written into this buffer.ciphertext- the ciphertext and tag that should be decrypted.nonce- the nonce that was used for the encryption.- Throws:
java.security.GeneralSecurityException- if the tag is invalid or any of the inputs do not have the expected size.
-
decrypt
void decrypt(java.nio.ByteBuffer plaintext, java.nio.ByteBuffer ciphertext, java.nio.ByteBuffer aad, byte[] nonce) throws java.security.GeneralSecurityExceptionDecrypt ciphertext into plaintext buffer using the given nonce.- Parameters:
plaintext- the decrypted plaintext will be written into this buffer.ciphertext- the ciphertext and tag that should be decrypted.aad- additional data that is checked for authenticity.nonce- the nonce that was used for the encryption.- Throws:
java.security.GeneralSecurityException- if the tag is invalid or any of the inputs do not have the expected size.
-
-