org.apache.hadoop.hbase.security
Class EncryptionUtil

java.lang.Object
  extended by org.apache.hadoop.hbase.security.EncryptionUtil

@InterfaceAudience.Private
@InterfaceStability.Evolving
public class EncryptionUtil
extends Object

Some static utility methods for encryption uses in hbase-client.


Constructor Summary
EncryptionUtil()
           
 
Method Summary
static Key unwrapKey(org.apache.hadoop.conf.Configuration conf, String subject, byte[] value)
          Unwrap a key by decrypting it with the secret key of the given subject.
static Key unwrapWALKey(org.apache.hadoop.conf.Configuration conf, String subject, byte[] value)
          Unwrap a wal key by decrypting it with the secret key of the given subject.
static byte[] wrapKey(org.apache.hadoop.conf.Configuration conf, byte[] key, String algorithm)
          Protect a key by encrypting it with the secret key of the given subject.
static byte[] wrapKey(org.apache.hadoop.conf.Configuration conf, String subject, Key key)
          Protect a key by encrypting it with the secret key of the given subject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncryptionUtil

public EncryptionUtil()
Method Detail

wrapKey

public static byte[] wrapKey(org.apache.hadoop.conf.Configuration conf,
                             byte[] key,
                             String algorithm)
                      throws IOException
Protect a key by encrypting it with the secret key of the given subject. The configuration must be set up correctly for key alias resolution.

Parameters:
conf - configuration
key - the raw key bytes
algorithm - the algorithm to use with this key material
Returns:
the encrypted key bytes
Throws:
IOException

wrapKey

public static byte[] wrapKey(org.apache.hadoop.conf.Configuration conf,
                             String subject,
                             Key key)
                      throws IOException
Protect a key by encrypting it with the secret key of the given subject. The configuration must be set up correctly for key alias resolution.

Parameters:
conf - configuration
subject - subject key alias
key - the key
Returns:
the encrypted key bytes
Throws:
IOException

unwrapKey

public static Key unwrapKey(org.apache.hadoop.conf.Configuration conf,
                            String subject,
                            byte[] value)
                     throws IOException,
                            KeyException
Unwrap a key by decrypting it with the secret key of the given subject. The configuration must be set up correctly for key alias resolution.

Parameters:
conf - configuration
subject - subject key alias
value - the encrypted key bytes
Returns:
the raw key bytes
Throws:
IOException
KeyException

unwrapWALKey

public static Key unwrapWALKey(org.apache.hadoop.conf.Configuration conf,
                               String subject,
                               byte[] value)
                        throws IOException,
                               KeyException
Unwrap a wal key by decrypting it with the secret key of the given subject. The configuration must be set up correctly for key alias resolution.

Parameters:
conf - configuration
subject - subject key alias
value - the encrypted key bytes
Returns:
the raw key bytes
Throws:
IOException - if key is not found for the subject, or if some I/O error occurs
KeyException - if fail to unwrap the key


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