@InterfaceAudience.Public public abstract class Cipher extends Object
Modifier and Type | Field and Description |
---|---|
static int |
BLOCK_SIZE |
static int |
IV_LENGTH |
static int |
KEY_LENGTH |
static int |
KEY_LENGTH_BITS |
static String |
RNG_ALGORITHM_KEY |
static String |
RNG_PROVIDER_KEY |
Constructor and Description |
---|
Cipher(CipherProvider provider) |
Modifier and Type | Method and Description |
---|---|
abstract InputStream |
createDecryptionStream(InputStream in,
Context context,
byte[] iv)
Create a decrypting input stream given a context and IV
|
abstract InputStream |
createDecryptionStream(InputStream in,
Decryptor decryptor)
Create a decrypting output stream given an initialized decryptor
|
abstract OutputStream |
createEncryptionStream(OutputStream out,
Context context,
byte[] iv)
Create an encrypting output stream given a context and IV
|
abstract OutputStream |
createEncryptionStream(OutputStream out,
Encryptor encryptor)
Create an encrypting output stream given an initialized encryptor
|
abstract Decryptor |
getDecryptor()
Return a decryptor for decrypting data.
|
abstract Encryptor |
getEncryptor()
Get an encryptor for encrypting data.
|
abstract int |
getIvLength()
Return the expected initialization vector length, in bytes, or 0 if not applicable
|
abstract int |
getKeyLength()
Return the key length required by this cipher, in bytes
|
abstract String |
getName()
Return this Cipher's name
|
CipherProvider |
getProvider()
Return the provider for this Cipher
|
abstract Key |
getRandomKey()
Create a random symmetric key
|
public 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 String RNG_ALGORITHM_KEY
public static final String RNG_PROVIDER_KEY
public Cipher(CipherProvider provider)
public CipherProvider getProvider()
public abstract String getName()
public abstract int getKeyLength()
public abstract int getIvLength()
public abstract Key getRandomKey()
public abstract Encryptor getEncryptor()
public abstract Decryptor getDecryptor()
public abstract OutputStream createEncryptionStream(OutputStream out, Context context, byte[] iv) throws IOException
out
- the output stream to wrapcontext
- the encryption contextiv
- initialization vectorIOException
public abstract OutputStream createEncryptionStream(OutputStream out, Encryptor encryptor) throws IOException
out
- the output stream to wrapencryptor
- the encryptorIOException
public abstract InputStream createDecryptionStream(InputStream in, Context context, byte[] iv) throws IOException
in
- the input stream to wrapcontext
- the encryption contextiv
- initialization vectorIOException
public abstract InputStream createDecryptionStream(InputStream in, Decryptor decryptor) throws IOException
in
- the input stream to wrapdecryptor
- the decryptorIOException
Copyright © 2007–2019 Cloudera. All rights reserved.