org.apache.hadoop.hbase.io.crypto.aes
Class AES

java.lang.Object
  extended by org.apache.hadoop.hbase.io.crypto.Cipher
      extended by org.apache.hadoop.hbase.io.crypto.aes.AES

@InterfaceAudience.Private
@InterfaceStability.Evolving
public class AES
extends Cipher

AES-128, provided by the JCE

Algorithm instances are pooled for reuse, so the cipher provider and mode are configurable but fixed at instantiation.


Field Summary
static int BLOCK_SIZE
           
static String CIPHER_MODE_KEY
           
static String CIPHER_PROVIDER_KEY
           
static int IV_LENGTH
           
static int KEY_LENGTH
           
static int KEY_LENGTH_BITS
           
static String RNG_ALGORITHM_KEY
           
static String RNG_PROVIDER_KEY
           
 
Constructor Summary
AES(CipherProvider provider)
           
 
Method Summary
 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
 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
 
Methods inherited from class org.apache.hadoop.hbase.io.crypto.Cipher
getProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_LENGTH

public static final int KEY_LENGTH
See Also:
Constant Field Values

KEY_LENGTH_BITS

public static final int KEY_LENGTH_BITS
See Also:
Constant Field Values

BLOCK_SIZE

public static final int BLOCK_SIZE
See Also:
Constant Field Values

IV_LENGTH

public static final int IV_LENGTH
See Also:
Constant Field Values

CIPHER_MODE_KEY

public static final String CIPHER_MODE_KEY
See Also:
Constant Field Values

CIPHER_PROVIDER_KEY

public static final String CIPHER_PROVIDER_KEY
See Also:
Constant Field Values

RNG_ALGORITHM_KEY

public static final String RNG_ALGORITHM_KEY
See Also:
Constant Field Values

RNG_PROVIDER_KEY

public static final String RNG_PROVIDER_KEY
See Also:
Constant Field Values
Constructor Detail

AES

public AES(CipherProvider provider)
Method Detail

getName

public String getName()
Description copied from class: Cipher
Return this Cipher's name

Specified by:
getName in class Cipher

getKeyLength

public int getKeyLength()
Description copied from class: Cipher
Return the key length required by this cipher, in bytes

Specified by:
getKeyLength in class Cipher

getIvLength

public int getIvLength()
Description copied from class: Cipher
Return the expected initialization vector length, in bytes, or 0 if not applicable

Specified by:
getIvLength in class Cipher

getRandomKey

public Key getRandomKey()
Description copied from class: Cipher
Create a random symmetric key

Specified by:
getRandomKey in class Cipher
Returns:
the random symmetric key

getEncryptor

public Encryptor getEncryptor()
Description copied from class: Cipher
Get an encryptor for encrypting data.

Specified by:
getEncryptor in class Cipher

getDecryptor

public Decryptor getDecryptor()
Description copied from class: Cipher
Return a decryptor for decrypting data.

Specified by:
getDecryptor in class Cipher

createEncryptionStream

public OutputStream createEncryptionStream(OutputStream out,
                                           Context context,
                                           byte[] iv)
                                    throws IOException
Description copied from class: Cipher
Create an encrypting output stream given a context and IV

Specified by:
createEncryptionStream in class Cipher
Parameters:
out - the output stream to wrap
context - the encryption context
iv - initialization vector
Returns:
the encrypting wrapper
Throws:
IOException

createEncryptionStream

public OutputStream createEncryptionStream(OutputStream out,
                                           Encryptor e)
                                    throws IOException
Description copied from class: Cipher
Create an encrypting output stream given an initialized encryptor

Specified by:
createEncryptionStream in class Cipher
Parameters:
out - the output stream to wrap
e - the encryptor
Returns:
the encrypting wrapper
Throws:
IOException

createDecryptionStream

public InputStream createDecryptionStream(InputStream in,
                                          Context context,
                                          byte[] iv)
                                   throws IOException
Description copied from class: Cipher
Create a decrypting input stream given a context and IV

Specified by:
createDecryptionStream in class Cipher
Parameters:
in - the input stream to wrap
context - the encryption context
iv - initialization vector
Returns:
the decrypting wrapper
Throws:
IOException

createDecryptionStream

public InputStream createDecryptionStream(InputStream in,
                                          Decryptor d)
                                   throws IOException
Description copied from class: Cipher
Create a decrypting output stream given an initialized decryptor

Specified by:
createDecryptionStream in class Cipher
Parameters:
in - the input stream to wrap
d - the decryptor
Returns:
the decrypting wrapper
Throws:
IOException


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.