Modifier and Type | Field and Description |
---|---|
static String |
CIPHER_MODE_KEY |
static String |
CIPHER_PROVIDER_KEY |
private String |
cipherMode |
private String |
cipherProvider |
private static org.slf4j.Logger |
LOG |
private SecureRandom |
rng |
private String |
rngAlgorithm |
BLOCK_SIZE, IV_LENGTH, KEY_LENGTH, KEY_LENGTH_BITS, RNG_ALGORITHM_KEY, RNG_PROVIDER_KEY
Constructor and Description |
---|
AES(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 d)
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 e)
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
|
private Cipher |
getJCECipherInstance() |
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() |
getProvider
private static final org.slf4j.Logger LOG
public static final String CIPHER_MODE_KEY
public static final String CIPHER_PROVIDER_KEY
private final String rngAlgorithm
private final String cipherMode
private final String cipherProvider
private SecureRandom rng
public AES(CipherProvider provider)
public int getKeyLength()
Cipher
getKeyLength
in class Cipher
public int getIvLength()
Cipher
getIvLength
in class Cipher
public Key getRandomKey()
Cipher
getRandomKey
in class Cipher
public Encryptor getEncryptor()
Cipher
getEncryptor
in class Cipher
public Decryptor getDecryptor()
Cipher
getDecryptor
in class Cipher
public OutputStream createEncryptionStream(OutputStream out, Context context, byte[] iv) throws IOException
Cipher
createEncryptionStream
in class Cipher
out
- the output stream to wrapcontext
- the encryption contextiv
- initialization vectorIOException
public OutputStream createEncryptionStream(OutputStream out, Encryptor e) throws IOException
Cipher
createEncryptionStream
in class Cipher
out
- the output stream to wrape
- the encryptorIOException
public InputStream createDecryptionStream(InputStream in, Context context, byte[] iv) throws IOException
Cipher
createDecryptionStream
in class Cipher
in
- the input stream to wrapcontext
- the encryption contextiv
- initialization vectorIOException
public InputStream createDecryptionStream(InputStream in, Decryptor d) throws IOException
Cipher
createDecryptionStream
in class Cipher
in
- the input stream to wrapd
- the decryptorIOException
SecureRandom getRNG()
private Cipher getJCECipherInstance()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.