Package org.cryptacular.bean
Class AEADBlockCipherBean
java.lang.Object
org.cryptacular.bean.AbstractCipherBean
org.cryptacular.bean.AbstractBlockCipherBean
org.cryptacular.bean.AEADBlockCipherBean
- All Implemented Interfaces:
CipherBean
Cipher bean that performs encryption with a block cipher in AEAD mode (e.g. GCM, CCM).
- Author:
- Middleware Services
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddecrypt(InputStream input, OutputStream output) Decrypts the data from the input stream onto the output stream using a symmetric cipher.voidencrypt(InputStream input, OutputStream output) Encrypts the data from the input stream onto the output stream using a symmetric cipher.Spec<org.bouncycastle.crypto.modes.AEADBlockCipher>protected AEADBlockCipherAdapternewCipher(CiphertextHeader header, boolean mode) Creates a new cipher adapter instance suitable for the block cipher used by this class.Methods inherited from class org.cryptacular.bean.AbstractBlockCipherBean
process, processMethods inherited from class org.cryptacular.bean.AbstractCipherBean
decrypt, encrypt, getKeyAlias, getKeyStore, getNonce, lookupKey
-
Field Details
-
MAC_SIZE_BITS
public static final int MAC_SIZE_BITSMac size in bits.- See Also:
-
-
Constructor Details
-
AEADBlockCipherBean
public AEADBlockCipherBean(Spec<org.bouncycastle.crypto.modes.AEADBlockCipher> blockCipherSpec, KeyStore keyStore, String keyAlias, String keyPassword, Nonce nonce) Creates a new AEAD block cipher bean.- Parameters:
blockCipherSpec- Block cipher specification.keyStore- Key store containing encryption key.keyAlias- Name of encryption key entry in key store.keyPassword- Password used to decrypt key entry in keystore.nonce- Nonce/IV generator.
-
-
Method Details
-
getBlockCipherSpec
- Returns:
- Block cipher specification.
-
encrypt
Description copied from interface:CipherBeanEncrypts the data from the input stream onto the output stream using a symmetric cipher.The caller is responsible for providing and managing the streams (e.g. closing them when finished).
- Specified by:
encryptin interfaceCipherBean- Overrides:
encryptin classAbstractCipherBean- Parameters:
input- Input stream containing plaintext data to encrypt.output- Output stream containing ciphertext produced by cipher in encryption mode.
-
decrypt
Description copied from interface:CipherBeanDecrypts the data from the input stream onto the output stream using a symmetric cipher.The caller is responsible for providing and managing the streams (e.g. closing them when finished).
- Specified by:
decryptin interfaceCipherBean- Overrides:
decryptin classAbstractCipherBean- Parameters:
input- Input stream containing ciphertext data to decrypt.output- Output stream containing plaintext produced by cipher in decryption mode.
-
newCipher
Description copied from class:AbstractBlockCipherBeanCreates a new cipher adapter instance suitable for the block cipher used by this class.- Specified by:
newCipherin classAbstractBlockCipherBean- Parameters:
header- Ciphertext header.mode- True for encryption; false for decryption.- Returns:
- Block cipher adapter that wraps an initialized block cipher that is ready for use in the given mode.
-