protected static class JceCtrCryptoCodec.JceCtrCipher extends Object implements org.apache.hadoop.crypto.Encryptor, org.apache.hadoop.crypto.Decryptor
| Constructor and Description |
|---|
JceCtrCipher(int mode,
String provider,
org.apache.hadoop.crypto.CipherSuite suite,
String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
decrypt(ByteBuffer inBuffer,
ByteBuffer outBuffer)
This presents a direct interface decrypting with direct ByteBuffers.
|
void |
encrypt(ByteBuffer inBuffer,
ByteBuffer outBuffer)
This presents a direct interface encrypting with direct ByteBuffers.
|
void |
init(byte[] key,
byte[] iv)
Initialize the encryptor and the internal encryption context.
|
boolean |
isContextReset()
Indicate whether the encryption context is reset.
|
void |
process(ByteBuffer inBuffer,
ByteBuffer outBuffer) |
public JceCtrCipher(int mode,
String provider,
org.apache.hadoop.crypto.CipherSuite suite,
String name)
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
org.apache.hadoop.crypto.EncryptorThis function does not always encrypt the entire buffer and may potentially need to be called multiple times to process an entire buffer. The object may hold the encryption context internally.
Some implementations may require sufficient space in the destination buffer to encrypt the entire input buffer.
Upon return, inBuffer.position() will be advanced by the number of bytes read and outBuffer.position() by bytes written. Implementations should not modify inBuffer.limit() and outBuffer.limit().
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
org.apache.hadoop.crypto.DecryptorThis function does not always decrypt the entire buffer and may potentially need to be called multiple times to process an entire buffer. The object may hold the decryption context internally.
Some implementations may require sufficient space in the destination buffer to decrypt the entire input buffer.
Upon return, inBuffer.position() will be advanced by the number of bytes read and outBuffer.position() by bytes written. Implementations should not modify inBuffer.limit() and outBuffer.limit().
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 void process(ByteBuffer inBuffer, ByteBuffer outBuffer) throws IOException
IOExceptionpublic 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.