public interface AuthenticatedEncryption extends Closeable
Modifier and Type | Method and Description |
---|---|
InputStream |
createDecryptionStream(InputStream stream,
byte[] nonce,
int keyRevision) |
OutputStream |
createDecryptionStream(OutputStream stream,
byte[] nonce,
int keyRevision) |
EncryptionInputStreamResult |
createEncryptionStream(InputStream stream) |
EncryptionOutputStreamResult |
createEncryptionStream(OutputStream stream) |
byte[] |
decrypt(byte[] data,
byte[] nonce,
int keyRevision) |
EncryptionResult |
encrypt(byte[] data) |
@Nonnull @CheckReturnValue EncryptionResult encrypt(byte[] data) throws IllegalBlockSizeException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeyException, MetaClientException
data
- Encoding is left to the callerNoSuchAlgorithmException
- if the algorithm being used is unavailable, as is the case if the JCA provider being used is insufficientNoSuchPaddingException
- if the padding being used is unavailable, as is the case if the JCA provider being used is insufficientInvalidAlgorithmParameterException
- if the initialization vector (IV) does not match the AES mode. IVs created by the Smartcrypt SDK can be relied upon to be in the correct format.InvalidKeyException
- if the security policy is not configured to allow the complexity of the AES keyMetaClientException
- if this key is not allowed to be used for encryption. See Smartkey.canEncrypt()
.IllegalBlockSizeException
@Nonnull byte[] decrypt(byte[] data, byte[] nonce, int keyRevision) throws IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeyException, MetaClientException
NoSuchAlgorithmException
- if the algorithm being used is unavailable, as is the case if the JCA provider being used is insufficientNoSuchPaddingException
- if the padding being used is unavailable, as is the case if the JCA provider being used is insufficientInvalidAlgorithmParameterException
- if the initialization vector (IV) does not match the AES mode. IVs created by the Smartcrypt SDK can be relied upon to be in the correct format.InvalidKeyException
- if the security policy is not configured to allow the complexity of the AES keyAEADBadTagException
- if the authentication tag does not match the calculated valueMetaClientException
- if this key is not allowed to be used for encryption. See Smartkey.canEncrypt()
.IllegalBlockSizeException
BadPaddingException
@Nonnull @CheckReturnValue EncryptionOutputStreamResult createEncryptionStream(OutputStream stream) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, MetaClientException
InvalidAlgorithmParameterException
- if the initialization vector (IV) does not match the AES mode. IVs created by the Smartcrypt SDK can be relied upon to be in the correct format.NoSuchAlgorithmException
- if the algorithm being used is unavailable, as is the case if the JCA provider being used is insufficientInvalidKeyException
- if the security policy is not configured to allow the complexity of the AES keyNoSuchPaddingException
- if the padding being used is unavailable, as is the case if the JCA provider being used is insufficientMetaClientException
- if this key is not allowed to be used for encryption. See Smartkey.canEncrypt()
.@Nonnull @CheckReturnValue EncryptionInputStreamResult createEncryptionStream(InputStream stream) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, MetaClientException
InvalidAlgorithmParameterException
- if the initialization vector (IV) does not match the AES mode. IVs created by the Smartcrypt SDK can be relied upon to be in the correct format.NoSuchAlgorithmException
- if the algorithm being used is unavailable, as is the case if the JCA provider being used is insufficientInvalidKeyException
- if the security policy is not configured to allow the complexity of the AES keyNoSuchPaddingException
- if the padding being used is unavailable, as is the case if the JCA provider being used is insufficientMetaClientException
- if this key is not allowed to be used for encryption. See Smartkey.canEncrypt()
.@Nonnull OutputStream createDecryptionStream(OutputStream stream, byte[] nonce, int keyRevision) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, MetaClientException
InvalidAlgorithmParameterException
- if the initialization vector (IV) does not match the AES mode. IVs created by the Smartcrypt SDK can be relied upon to be in the correct format.NoSuchAlgorithmException
- if the algorithm being used is unavailable, as is the case if the JCA provider being used is insufficientInvalidKeyException
- if the security policy is not configured to allow the complexity of the AES keyNoSuchPaddingException
- if the padding being used is unavailable, as is the case if the JCA provider being used is insufficientMetaClientException
- if this key is not allowed to be used for decryption. See Smartkey.canDecrypt()
.@Nonnull InputStream createDecryptionStream(InputStream stream, byte[] nonce, int keyRevision) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, MetaClientException
InvalidAlgorithmParameterException
- if the initialization vector (IV) does not match the AES mode. IVs created by the Smartcrypt SDK can be relied upon to be in the correct format.NoSuchAlgorithmException
- if the algorithm being used is unavailable, as is the case if the JCA provider being used is insufficientInvalidKeyException
- if the security policy is not configured to allow the complexity of the AES keyNoSuchPaddingException
- if the padding being used is unavailable, as is the case if the JCA provider being used is insufficientMetaClientException
- if this key is not allowed to be used for decryption. See Smartkey.canDecrypt()
.