protected static class OpensslCtrCryptoCodec.OpensslCtrCipher extends java.lang.Object implements Encryptor, Decryptor
| Constructor | Description |
|---|---|
OpensslCtrCipher(int mode,
CipherSuite suite) |
|
OpensslCtrCipher(int mode,
CipherSuite suite,
java.lang.String engineId) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
decrypt(java.nio.ByteBuffer inBuffer,
java.nio.ByteBuffer outBuffer) |
AES-CTR will consume all of the input data.
|
void |
encrypt(java.nio.ByteBuffer inBuffer,
java.nio.ByteBuffer outBuffer) |
AES-CTR will consume all of the input data.
|
void |
init(byte[] key,
byte[] iv) |
Initialize the encryptor and the internal encryption context.
|
boolean |
isContextReset() |
Indicate whether the encryption context is reset.
|
public OpensslCtrCipher(int mode,
CipherSuite suite,
java.lang.String engineId)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic OpensslCtrCipher(int mode,
CipherSuite suite)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic void init(byte[] key,
byte[] iv)
throws java.io.IOException
Encryptorpublic void encrypt(java.nio.ByteBuffer inBuffer,
java.nio.ByteBuffer outBuffer)
throws java.io.IOException
encrypt in interface EncryptorinBuffer - a direct ByteBuffer to read from. inBuffer may
not be null and inBuffer.remaining() must be > 0outBuffer - a direct ByteBuffer to write to. outBuffer may
not be null and outBuffer.remaining() must be > 0java.io.IOException - if encryption failspublic void decrypt(java.nio.ByteBuffer inBuffer,
java.nio.ByteBuffer outBuffer)
throws java.io.IOException
decrypt in interface DecryptorinBuffer - a direct ByteBuffer to read from. inBuffer may
not be null and inBuffer.remaining() must be > 0outBuffer - a direct ByteBuffer to write to. outBuffer may
not be null and outBuffer.remaining() must be > 0java.io.IOException - if decryption failspublic boolean isContextReset()
EncryptorCertain modes, like CTR, require a different IV depending on the position in the stream. Generally, the encryptor maintains any necessary context for calculating the IV and counter so that no reinit is necessary during the encryption. Reinit before each operation is inefficient.
isContextReset in interface DecryptorisContextReset in interface EncryptorCopyright © 2008–2025 Apache Software Foundation. All rights reserved.