protected static class OpensslCtrCryptoCodec.OpensslCtrCipher extends Object implements org.apache.hadoop.crypto.Encryptor, org.apache.hadoop.crypto.Decryptor
| Constructor and Description |
|---|
OpensslCtrCipher(int mode,
org.apache.hadoop.crypto.CipherSuite suite) |
OpensslCtrCipher(int mode,
org.apache.hadoop.crypto.CipherSuite suite,
String engineId) |
| Modifier and Type | Method and Description |
|---|---|
void |
decrypt(ByteBuffer inBuffer,
ByteBuffer outBuffer)
AES-CTR will consume all of the input data.
|
void |
encrypt(ByteBuffer inBuffer,
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,
org.apache.hadoop.crypto.CipherSuite suite,
String engineId)
throws GeneralSecurityException
GeneralSecurityExceptionpublic OpensslCtrCipher(int mode,
org.apache.hadoop.crypto.CipherSuite suite)
throws GeneralSecurityException
GeneralSecurityExceptionpublic void init(byte[] key,
byte[] iv)
throws IOException
org.apache.hadoop.crypto.Encryptorinit in interface org.apache.hadoop.crypto.Decryptorinit in interface org.apache.hadoop.crypto.Encryptorkey - encryption key.iv - encryption initialization vectorIOException - if initialization failspublic void encrypt(ByteBuffer inBuffer, ByteBuffer outBuffer) throws IOException
encrypt in interface org.apache.hadoop.crypto.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 > 0IOException - if encryption failspublic void decrypt(ByteBuffer inBuffer, ByteBuffer outBuffer) throws IOException
decrypt in interface org.apache.hadoop.crypto.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 > 0IOException - if decryption failspublic boolean isContextReset()
org.apache.hadoop.crypto.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 org.apache.hadoop.crypto.DecryptorisContextReset in interface org.apache.hadoop.crypto.EncryptorCopyright © 2008–2025 Apache Software Foundation. All rights reserved.