@InterfaceAudience.Private @InterfaceStability.Evolving public class CommonsCryptoAES extends Cipher
| Modifier and Type | Field and Description |
|---|---|
static String |
CIPHER_CLASSES_KEY |
static String |
CIPHER_JCE_PROVIDER_KEY |
static String |
CIPHER_MODE_KEY |
private String |
cipherMode |
private static org.slf4j.Logger |
LOG |
private Properties |
props |
private SecureRandom |
rng |
private String |
rngAlgorithm |
BLOCK_SIZE, IV_LENGTH, KEY_LENGTH, KEY_LENGTH_BITS, RNG_ALGORITHM_KEY, RNG_PROVIDER_KEY| Constructor and Description |
|---|
CommonsCryptoAES(CipherProvider provider) |
| Modifier and Type | Method and Description |
|---|---|
InputStream |
createDecryptionStream(InputStream in,
Context context,
byte[] iv)
Create a decrypting input stream given a context and IV
|
InputStream |
createDecryptionStream(InputStream in,
Decryptor decryptor)
Create a decrypting output stream given an initialized decryptor
|
OutputStream |
createEncryptionStream(OutputStream out,
Context context,
byte[] iv)
Create an encrypting output stream given a context and IV
|
OutputStream |
createEncryptionStream(OutputStream out,
Encryptor encryptor)
Create an encrypting output stream given an initialized encryptor
|
Decryptor |
getDecryptor()
Return a decryptor for decrypting data.
|
Encryptor |
getEncryptor()
Get an encryptor for encrypting data.
|
int |
getIvLength()
Return the expected initialization vector length, in bytes, or 0 if not applicable
|
int |
getKeyLength()
Return the key length required by this cipher, in bytes
|
String |
getName()
Return this Cipher's name
|
Key |
getRandomKey()
Create a random symmetric key
|
(package private) SecureRandom |
getRNG() |
private static Properties |
readCryptoProps(org.apache.hadoop.conf.Configuration conf) |
getProviderprivate static final org.slf4j.Logger LOG
public static final String CIPHER_MODE_KEY
public static final String CIPHER_CLASSES_KEY
public static final String CIPHER_JCE_PROVIDER_KEY
private final String cipherMode
private Properties props
private final String rngAlgorithm
private SecureRandom rng
public CommonsCryptoAES(CipherProvider provider)
private static Properties readCryptoProps(org.apache.hadoop.conf.Configuration conf)
public int getKeyLength()
CiphergetKeyLength in class Cipherpublic int getIvLength()
CiphergetIvLength in class Cipherpublic Key getRandomKey()
CiphergetRandomKey in class Cipherpublic Encryptor getEncryptor()
CiphergetEncryptor in class Cipherpublic Decryptor getDecryptor()
CiphergetDecryptor in class Cipherpublic OutputStream createEncryptionStream(OutputStream out, Context context, byte[] iv) throws IOException
CiphercreateEncryptionStream in class Cipherout - the output stream to wrapcontext - the encryption contextiv - initialization vectorIOExceptionpublic OutputStream createEncryptionStream(OutputStream out, Encryptor encryptor) throws IOException
CiphercreateEncryptionStream in class Cipherout - the output stream to wrapencryptor - the encryptorIOExceptionpublic InputStream createDecryptionStream(InputStream in, Context context, byte[] iv) throws IOException
CiphercreateDecryptionStream in class Cipherin - the input stream to wrapcontext - the encryption contextiv - initialization vectorIOExceptionpublic InputStream createDecryptionStream(InputStream in, Decryptor decryptor) throws IOException
CiphercreateDecryptionStream in class Cipherin - the input stream to wrapdecryptor - the decryptorIOExceptionSecureRandom getRNG()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.