IKey.encryptAsync(final byte[] plaintext, final byte[] iv, final byte[] authenticationData, final String algorithm) 方法
定义
Encrypts the specified plain text. Note that not all algorithms require, or support, all parameters.
public ListenableFuture<Triple<byte[], byte[], String>> encryptAsync(final byte[] plaintext, final byte[] iv, final byte[] authenticationData, final String algorithm)
参数
- plaintext
- final byte []
The plain text to encrypt
- iv
- final byte []
The initialization vector (optional with some algorithms)
- authenticationData
- final byte []
Additional authentication data (optional with some algorithms)
- algorithm
- final String
The encryption algorithm to use, defaults to the keys DefaultEncryptionAlgorithm
返回
ListenableFuture<Triple<byte[], byte[], String>>
A ListenableFuture containing the cipher text, the authentication tag and the algorithm that was used
例外
NoSuchAlgorithmException
the algorithm is not valid