@InterfaceAudience.Private @InterfaceStability.Evolving public class AES extends Cipher
Algorithm instances are pooled for reuse, so the cipher provider and mode are configurable but fixed at instantiation.
| Modifier and Type | Field and Description |
|---|---|
static int |
BLOCK_SIZE |
static java.lang.String |
CIPHER_MODE_KEY |
static java.lang.String |
CIPHER_PROVIDER_KEY |
static int |
IV_LENGTH |
static int |
KEY_LENGTH |
static int |
KEY_LENGTH_BITS |
static java.lang.String |
RNG_ALGORITHM_KEY |
static java.lang.String |
RNG_PROVIDER_KEY |
| Constructor and Description |
|---|
AES(CipherProvider provider) |
| Modifier and Type | Method and Description |
|---|---|
java.io.InputStream |
createDecryptionStream(java.io.InputStream in,
Context context,
byte[] iv)
Create a decrypting input stream given a context and IV
|
java.io.InputStream |
createDecryptionStream(java.io.InputStream in,
Decryptor d)
Create a decrypting output stream given an initialized decryptor
|
java.io.OutputStream |
createEncryptionStream(java.io.OutputStream out,
Context context,
byte[] iv)
Create an encrypting output stream given a context and IV
|
java.io.OutputStream |
createEncryptionStream(java.io.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
|
int |
getKeyLength()
Return the key length required by this cipher, in bytes
|
java.lang.String |
getName()
Return this Cipher's name
|
java.security.Key |
getRandomKey()
Create a random symmetric key
|
getProviderpublic static final int KEY_LENGTH
public static final int KEY_LENGTH_BITS
public static final int BLOCK_SIZE
public static final int IV_LENGTH
public static final java.lang.String CIPHER_MODE_KEY
public static final java.lang.String CIPHER_PROVIDER_KEY
public static final java.lang.String RNG_ALGORITHM_KEY
public static final java.lang.String RNG_PROVIDER_KEY
public AES(CipherProvider provider)
public java.lang.String getName()
Cipherpublic int getKeyLength()
CiphergetKeyLength in class Cipherpublic int getIvLength()
CiphergetIvLength in class Cipherpublic java.security.Key getRandomKey()
CiphergetRandomKey in class Cipherpublic Encryptor getEncryptor()
CiphergetEncryptor in class Cipherpublic Decryptor getDecryptor()
CiphergetDecryptor in class Cipherpublic java.io.OutputStream createEncryptionStream(java.io.OutputStream out,
Context context,
byte[] iv)
throws java.io.IOException
CiphercreateEncryptionStream in class Cipherout - the output stream to wrapcontext - the encryption contextiv - initialization vectorjava.io.IOExceptionpublic java.io.OutputStream createEncryptionStream(java.io.OutputStream out,
Encryptor e)
throws java.io.IOException
CiphercreateEncryptionStream in class Cipherout - the output stream to wrape - the encryptorjava.io.IOExceptionpublic java.io.InputStream createDecryptionStream(java.io.InputStream in,
Context context,
byte[] iv)
throws java.io.IOException
CiphercreateDecryptionStream in class Cipherin - the input stream to wrapcontext - the encryption contextiv - initialization vectorjava.io.IOExceptionpublic java.io.InputStream createDecryptionStream(java.io.InputStream in,
Decryptor d)
throws java.io.IOException
CiphercreateDecryptionStream in class Cipherin - the input stream to wrapd - the decryptorjava.io.IOException