public class KeyToolkit extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
CACHE_LIFETIME_DEFAULT_SECONDS |
static String |
CACHE_LIFETIME_PROPERTY_NAME
Lifetime of cached entities (key encryption keys, local wrapping keys, KMS client objects).
|
static int |
DATA_KEY_LENGTH_DEFAULT |
static String |
DATA_KEY_LENGTH_PROPERTY_NAME
Length of data encryption keys (DEKs), randomly generated by parquet key management tools.
|
static boolean |
DOUBLE_WRAPPING_DEFAULT |
static String |
DOUBLE_WRAPPING_PROPERTY_NAME
Use double wrapping - where data encryption keys (DEKs) are encrypted with key encryption keys (KEKs),
which in turn are encrypted with master keys.
|
static int |
KEK_LENGTH_DEFAULT |
static String |
KEK_LENGTH_PROPERTY_NAME
Length of key encryption keys (KEKs), randomly generated by parquet key management tools.
|
static String |
KEY_ACCESS_TOKEN_PROPERTY_NAME
Authorization token that will be passed to KMS.
|
static boolean |
KEY_MATERIAL_INTERNAL_DEFAULT |
static String |
KEY_MATERIAL_INTERNAL_PROPERTY_NAME
Store key material inside Parquet file footers; this mode doesn’t produce additional files.
|
static String |
KMS_CLIENT_CLASS_PROPERTY_NAME
Class implementing the KmsClient interface.
|
static String |
KMS_INSTANCE_ID_PROPERTY_NAME
ID of the KMS instance that will be used for encryption (if multiple KMS instances are available).
|
static String |
KMS_INSTANCE_URL_PROPERTY_NAME
URL of the KMS instance.
|
| Constructor and Description |
|---|
KeyToolkit() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decryptKeyLocally(String encodedEncryptedKey,
byte[] masterKeyBytes,
byte[] AAD)
Decrypts encrypted key with "masterKey", using AES-GCM and the "AAD"
|
static String |
encryptKeyLocally(byte[] keyBytes,
byte[] masterKeyBytes,
byte[] AAD)
Encrypts "key" with "masterKey", using AES-GCM and the "AAD"
|
static void |
removeCacheEntriesForAllTokens() |
static void |
removeCacheEntriesForToken(String accessToken)
Flush any caches that are tied to the (compromised) accessToken
|
static void |
rotateMasterKeys(String folderPath,
org.apache.hadoop.conf.Configuration hadoopConfig)
Key rotation.
|
public static final String KMS_CLIENT_CLASS_PROPERTY_NAME
public static final String KMS_INSTANCE_ID_PROPERTY_NAME
public static final String KMS_INSTANCE_URL_PROPERTY_NAME
public static final String KEY_ACCESS_TOKEN_PROPERTY_NAME
public static final String DOUBLE_WRAPPING_PROPERTY_NAME
public static final String CACHE_LIFETIME_PROPERTY_NAME
public static final String KEY_MATERIAL_INTERNAL_PROPERTY_NAME
public static final String DATA_KEY_LENGTH_PROPERTY_NAME
public static final String KEK_LENGTH_PROPERTY_NAME
public static final boolean DOUBLE_WRAPPING_DEFAULT
public static final long CACHE_LIFETIME_DEFAULT_SECONDS
public static final boolean KEY_MATERIAL_INTERNAL_DEFAULT
public static final int DATA_KEY_LENGTH_DEFAULT
public static final int KEK_LENGTH_DEFAULT
public static void rotateMasterKeys(String folderPath, org.apache.hadoop.conf.Configuration hadoopConfig) throws IOException, ParquetCryptoRuntimeException, KeyAccessDeniedException, UnsupportedOperationException
folderPath - parent path of Parquet files, whose keys will be rotatedhadoopConfig - Hadoop configurationIOException - I/O problemsParquetCryptoRuntimeException - General parquet encryption problemsKeyAccessDeniedException - No access to master keysUnsupportedOperationException - Master key rotation not supported in the specific configurationpublic static void removeCacheEntriesForToken(String accessToken)
accessToken - access tokenpublic static void removeCacheEntriesForAllTokens()
public static String encryptKeyLocally(byte[] keyBytes, byte[] masterKeyBytes, byte[] AAD)
keyBytes - the key to encryptmasterKeyBytes - encryption keyAAD - additional authenticated datapublic static byte[] decryptKeyLocally(String encodedEncryptedKey, byte[] masterKeyBytes, byte[] AAD)
encodedEncryptedKey - base64 encoded encrypted keymasterKeyBytes - encryption keyAAD - additional authenticated dataCopyright © 2023 The Apache Software Foundation. All rights reserved.