@InterfaceAudience.Private @InterfaceStability.Evolving public final class EncryptionUtil extends Object
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private static SecureRandom |
RNG |
Modifier | Constructor and Description |
---|---|
private |
EncryptionUtil()
Private constructor to keep this class from being instantiated.
|
Modifier and Type | Method and Description |
---|---|
static CryptoAES |
createCryptoAES(org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.CryptoCipherMeta cryptoCipherMeta,
org.apache.hadoop.conf.Configuration conf)
Helper to create an instance of CryptoAES.
|
static Encryption.Context |
createEncryptionContext(org.apache.hadoop.conf.Configuration conf,
ColumnFamilyDescriptor family)
Helper to create an encyption context.
|
private static Key |
getUnwrapKey(org.apache.hadoop.conf.Configuration conf,
String subject,
org.apache.hadoop.hbase.shaded.protobuf.generated.EncryptionProtos.WrappedKey wrappedKey,
Cipher cipher) |
static Key |
unwrapKey(org.apache.hadoop.conf.Configuration conf,
byte[] keyBytes)
Helper for
unwrapKey(Configuration, String, byte[]) which automatically uses the
configured master and alternative keys, rather than having to specify a key type to unwrap
with. |
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.
|
private static final org.slf4j.Logger LOG
private static final SecureRandom RNG
private EncryptionUtil()
public static byte[] wrapKey(org.apache.hadoop.conf.Configuration conf, byte[] key, String algorithm) throws IOException
conf
- configurationkey
- the raw key bytesalgorithm
- the algorithm to use with this key materialIOException
public static byte[] wrapKey(org.apache.hadoop.conf.Configuration conf, String subject, Key key) throws IOException
conf
- configurationsubject
- subject key aliaskey
- the keyIOException
public static Key unwrapKey(org.apache.hadoop.conf.Configuration conf, String subject, byte[] value) throws IOException, KeyException
conf
- configurationsubject
- subject key aliasvalue
- the encrypted key bytesIOException
KeyException
private static Key getUnwrapKey(org.apache.hadoop.conf.Configuration conf, String subject, org.apache.hadoop.hbase.shaded.protobuf.generated.EncryptionProtos.WrappedKey wrappedKey, Cipher cipher) throws IOException, KeyException
IOException
KeyException
public static Key unwrapWALKey(org.apache.hadoop.conf.Configuration conf, String subject, byte[] value) throws IOException, KeyException
conf
- configurationsubject
- subject key aliasvalue
- the encrypted key bytesIOException
- if key is not found for the subject, or if some I/O error occursKeyException
- if fail to unwrap the keypublic static Encryption.Context createEncryptionContext(org.apache.hadoop.conf.Configuration conf, ColumnFamilyDescriptor family) throws IOException
conf
- The current configuration.family
- The current column descriptor.IOException
- if an encryption key for the column cannot be unwrappedpublic static Key unwrapKey(org.apache.hadoop.conf.Configuration conf, byte[] keyBytes) throws IOException
unwrapKey(Configuration, String, byte[])
which automatically uses the
configured master and alternative keys, rather than having to specify a key type to unwrap
with.
The configuration must be set up correctly for key alias resolution.conf
- the current configurationkeyBytes
- the key encrypted by master (or alternative) to unwrapIOException
- if the key cannot be unwrappedpublic static CryptoAES createCryptoAES(org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.CryptoCipherMeta cryptoCipherMeta, org.apache.hadoop.conf.Configuration conf) throws IOException
conf
- The current configuration.cryptoCipherMeta
- The metadata for create CryptoAES.IOException
- if create CryptoAES failedCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.