Class Cipher
java.lang.Object
org.apache.hadoop.hbase.io.crypto.Cipher
- Direct Known Subclasses:
 AES,CommonsCryptoAES
A common interface for a cryptographic algorithm.
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intprivate final CipherProviderstatic final Stringstatic final String - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionabstract InputStreamcreateDecryptionStream(InputStream in, Context context, byte[] iv) Create a decrypting input stream given a context and IVabstract InputStreamcreateDecryptionStream(InputStream in, Decryptor decryptor) Create a decrypting output stream given an initialized decryptorabstract OutputStreamcreateEncryptionStream(OutputStream out, Context context, byte[] iv) Create an encrypting output stream given a context and IVabstract OutputStreamcreateEncryptionStream(OutputStream out, Encryptor encryptor) Create an encrypting output stream given an initialized encryptorabstract DecryptorReturn a decryptor for decrypting data.abstract EncryptorGet an encryptor for encrypting data.abstract intReturn the expected initialization vector length, in bytes, or 0 if not applicableabstract intReturn the key length required by this cipher, in bytesabstract StringgetName()Return this Cipher's nameReturn the provider for this Cipherabstract KeyCreate a random symmetric key 
- 
Field Details
- 
KEY_LENGTH
- See Also:
 
 - 
KEY_LENGTH_BITS
- See Also:
 
 - 
BLOCK_SIZE
- See Also:
 
 - 
IV_LENGTH
- See Also:
 
 - 
RNG_ALGORITHM_KEY
- See Also:
 
 - 
RNG_PROVIDER_KEY
- See Also:
 
 - 
provider
 
 - 
 - 
Constructor Details
- 
Cipher
 
 - 
 - 
Method Details
- 
getProvider
Return the provider for this Cipher - 
getName
Return this Cipher's name - 
getKeyLength
Return the key length required by this cipher, in bytes - 
getIvLength
Return the expected initialization vector length, in bytes, or 0 if not applicable - 
getRandomKey
Create a random symmetric key- Returns:
 - the random symmetric key
 
 - 
getEncryptor
Get an encryptor for encrypting data. - 
getDecryptor
Return a decryptor for decrypting data. - 
createEncryptionStream
public abstract OutputStream createEncryptionStream(OutputStream out, Context context, byte[] iv) throws IOException Create an encrypting output stream given a context and IV- Parameters:
 out- the output stream to wrapcontext- the encryption contextiv- initialization vector- Returns:
 - the encrypting wrapper
 - Throws:
 IOException
 - 
createEncryptionStream
public abstract OutputStream createEncryptionStream(OutputStream out, Encryptor encryptor) throws IOException Create an encrypting output stream given an initialized encryptor- Parameters:
 out- the output stream to wrapencryptor- the encryptor- Returns:
 - the encrypting wrapper
 - Throws:
 IOException
 - 
createDecryptionStream
public abstract InputStream createDecryptionStream(InputStream in, Context context, byte[] iv) throws IOException Create a decrypting input stream given a context and IV- Parameters:
 in- the input stream to wrapcontext- the encryption contextiv- initialization vector- Returns:
 - the decrypting wrapper
 - Throws:
 IOException
 - 
createDecryptionStream
public abstract InputStream createDecryptionStream(InputStream in, Decryptor decryptor) throws IOException Create a decrypting output stream given an initialized decryptor- Parameters:
 in- the input stream to wrapdecryptor- the decryptor- Returns:
 - the decrypting wrapper
 - Throws:
 IOException
 
 -