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
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
private final CipherProvider
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract InputStream
createDecryptionStream
(InputStream in, Context context, byte[] iv) Create a decrypting input stream given a context and IVabstract InputStream
createDecryptionStream
(InputStream in, Decryptor decryptor) Create a decrypting output stream given an initialized decryptorabstract OutputStream
createEncryptionStream
(OutputStream out, Context context, byte[] iv) Create an encrypting output stream given a context and IVabstract OutputStream
createEncryptionStream
(OutputStream out, Encryptor encryptor) Create an encrypting output stream given an initialized encryptorabstract Decryptor
Return a decryptor for decrypting data.abstract Encryptor
Get an encryptor for encrypting data.abstract int
Return the expected initialization vector length, in bytes, or 0 if not applicableabstract int
Return the key length required by this cipher, in bytesabstract String
getName()
Return this Cipher's nameReturn the provider for this Cipherabstract Key
Create 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
-