org.apache.hadoop.hbase.io.crypto
Class Cipher

java.lang.Object
  extended by org.apache.hadoop.hbase.io.crypto.Cipher
Direct Known Subclasses:
AES

@InterfaceAudience.Public
@InterfaceStability.Unstable
public abstract class Cipher
extends Object

A common interface for a cryptographic algorithm.


Constructor Summary
Cipher(CipherProvider provider)
           
 
Method Summary
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cipher

public Cipher(CipherProvider provider)
Method Detail

getProvider

public CipherProvider getProvider()
Return the provider for this Cipher


getName

public abstract String getName()
Return this Cipher's name


getKeyLength

public abstract int getKeyLength()
Return the key length required by this cipher, in bytes


getIvLength

public abstract int getIvLength()
Return the expected initialization vector length, in bytes, or 0 if not applicable


getRandomKey

public abstract Key getRandomKey()
Create a random symmetric key

Returns:
the random symmetric key

getEncryptor

public abstract Encryptor getEncryptor()
Get an encryptor for encrypting data.


getDecryptor

public abstract Decryptor 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 wrap
context - the encryption context
iv - 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 wrap
encryptor - 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 wrap
context - the encryption context
iv - 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 wrap
decryptor - the decryptor
Returns:
the decrypting wrapper
Throws:
IOException


Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.