java.io.Closeable, java.lang.AutoCloseable, Configurable@Private public class OpensslSm4CtrCryptoCodec extends OpensslCtrCryptoCodec
OpensslCtrCryptoCodec.OpensslCtrCipher| Constructor | Description |
|---|---|
OpensslSm4CtrCryptoCodec() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
calculateIV(byte[] initIV,
long counter,
byte[] iv) |
This interface is only for Counter (CTR) mode.
|
Decryptor |
createDecryptor() |
Create a
Decryptor. |
Encryptor |
createEncryptor() |
Create a
Encryptor. |
CipherSuite |
getCipherSuite() |
|
org.slf4j.Logger |
getLogger() |
|
void |
setConf(Configuration conf) |
Set the configuration to be used by this object.
|
calculateIV, close, generateSecureRandom, getConf, getEngineId, getRandom, setEngineId, setRandomgetInstance, getInstancepublic org.slf4j.Logger getLogger()
getLogger in class OpensslCtrCryptoCodecpublic void setConf(Configuration conf)
ConfigurablesetConf in interface ConfigurablesetConf in class OpensslCtrCryptoCodecconf - configuration to be usedpublic CipherSuite getCipherSuite()
getCipherSuite in class CryptoCodecpublic void calculateIV(byte[] initIV,
long counter,
byte[] iv)
CryptoCodecCipher will maintain its encryption
context internally when we do encryption/decryption using the
Cipher#update interface.
Encryption/Decryption is not always on the entire file. For example, in Hadoop, a node may only decrypt a portion of a file (i.e. a split). In these situations, the counter is derived from the file position.
The IV can be calculated by combining the initial IV and the counter with a lossless operation (concatenation, addition, or XOR). See http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Counter_ .28CTR.29
calculateIV in class CryptoCodecinitIV - initial IVcounter - counter for input stream positioniv - the IV for input stream positionpublic Encryptor createEncryptor() throws java.security.GeneralSecurityException
CryptoCodecEncryptor.createEncryptor in class CryptoCodecjava.security.GeneralSecurityException - thrown if create encryptor error.public Decryptor createDecryptor() throws java.security.GeneralSecurityException
CryptoCodecDecryptor.createDecryptor in class CryptoCodecjava.security.GeneralSecurityException - thrown if create decryptor error.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.