public class BootstrappedKeyStoreProtectionManager extends Object implements KeyStoreProtectionManager, WrappableKeyProtectionManager
| Modifier and Type | Field and Description |
|---|---|
static String |
KeyStoreProtKey |
static String |
PrivKeyProtKey |
| Constructor and Description |
|---|
BootstrappedKeyStoreProtectionManager()
Empty constructore
|
BootstrappedKeyStoreProtectionManager(String keyStoreProtectionKey,
String privateKeyProtectionKey)
Constructs a manager by providing the protection keys as strings.
|
BootstrappedKeyStoreProtectionManager(String keyStoreProtectionKey,
String privateKeyProtectionKey,
Map<String,KeyStore.Entry> entries)
Constructs a manager by providing the protection keys as strings and a collection of key entries
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,KeyStore.Entry> |
getAllEntries()
Gets a Map of all entries managed by the token.
|
Map<String,Key> |
getAllKeys()
Gets a Map of all keys managed by the token.
|
KeyStore.Entry |
getEntry(String entryName)
Gets a specific entry by name
|
Key |
getKey(String keyName)
Gets a specific key by name.
|
Key |
getKeyStoreProtectionKey()
Gets the key protecting private keys in the key store.
|
Key |
getPrivateKeyProtectionKey()
Gets the key protecting the key store as a whole.
|
void |
setKeyEntries(Map<String,KeyStore.Entry> entries)
Sets the key entries.
|
void |
setKeyStoreProtectionKey(byte[] keyStoreProtectionKey)
Sets the pass phrase that protects the key store as a whole as a byte array.
|
void |
setKeyStoreProtectionKey(String keyStoreProtectionKey)
Sets the pass phrase that protects the key store as a whole as a String.
|
void |
setPrivateKeyProtectionKey(byte[] privateKeyProtectionKey)
Sets the pass phrase that protects the private keys in the key store as a byte array.
|
void |
setPrivateKeyProtectionKey(String privateKeyProtectionKey)
Sets the pass phrase that protects the private keys in the key store as a String.
|
Key |
unwrapWithSecretKey(SecretKey kek,
byte[] wrappedData,
String keyAlg,
int keyType)
Unwraps the key with a symmetric secret key encryption key.
|
byte[] |
wrapWithSecretKey(SecretKey kek,
Key keyToWrap)
Wraps a key with a symmetric secret key encryption key.
|
public static final String PrivKeyProtKey
public static final String KeyStoreProtKey
public BootstrappedKeyStoreProtectionManager()
public BootstrappedKeyStoreProtectionManager(String keyStoreProtectionKey, String privateKeyProtectionKey)
keyStoreProtectionKey - The pass phrase that protects the key store as a whole.privateKeyProtectionKey - The pass phrase that protects the private keys in the key store.public BootstrappedKeyStoreProtectionManager(String keyStoreProtectionKey, String privateKeyProtectionKey, Map<String,KeyStore.Entry> entries)
keyStoreProtectionKey - The pass phrase that protects the key store as a whole.privateKeyProtectionKey - The pass phrase that protects the private keys in the key store.entries - Key entriespublic void setKeyStoreProtectionKey(byte[] keyStoreProtectionKey)
keyStoreProtectionKey - The pass phrase that protects the key store as a whole as a byte array.public void setKeyStoreProtectionKey(String keyStoreProtectionKey)
keyStoreProtectionKey - The pass phrase that protects the key store as a whole as a String.public void setPrivateKeyProtectionKey(byte[] privateKeyProtectionKey)
privateKeyProtectionKey - The pass phrase that protects the private keys in the key store as a byte array.public void setPrivateKeyProtectionKey(String privateKeyProtectionKey)
privateKeyProtectionKey - The pass phrase that protects the private keys in the key store as a String.public void setKeyEntries(Map<String,KeyStore.Entry> entries)
entries - The key entriespublic Key getPrivateKeyProtectionKey() throws CryptoException
getPrivateKeyProtectionKey in interface KeyStoreProtectionManagerCryptoExceptionpublic Key getKeyStoreProtectionKey() throws CryptoException
getKeyStoreProtectionKey in interface KeyStoreProtectionManagerCryptoExceptionpublic Map<String,Key> getAllKeys() throws CryptoException
getAllKeys in interface KeyStoreProtectionManagerCryptoExceptionpublic Key getKey(String keyName) throws CryptoException
getKey in interface KeyStoreProtectionManagerkeyName - The name of the key to retrieve. Returns null if the key doesn't exist.CryptoExceptionpublic Map<String,KeyStore.Entry> getAllEntries() throws CryptoException
getAllEntries in interface KeyStoreProtectionManagerCryptoExceptionpublic KeyStore.Entry getEntry(String entryName) throws CryptoException
getEntry in interface KeyStoreProtectionManagerentryName - The name of the entry to retrieve. Returns null if the entry doesn't exist.CryptoExceptionpublic byte[] wrapWithSecretKey(SecretKey kek, Key keyToWrap) throws CryptoException
wrapWithSecretKey in interface WrappableKeyProtectionManagerkek - The key encryption key.keyToWrap - The key to be wrapped.CryptoExceptionpublic Key unwrapWithSecretKey(SecretKey kek, byte[] wrappedData, String keyAlg, int keyType) throws CryptoException
unwrapWithSecretKey in interface WrappableKeyProtectionManagerkek - The key encryption key.wrappedData - The wrapped key as a byte array.keyAlg - The algorithm of the key that is being decrypted. Typical parameters are "RSA", "DSA", and "AES" depending on the key type.keyType - The type of key that is wrapped. Valid values should use the Cipher.PRIVATE_KEY and Cipher.SECRET_KEY constants.CryptoExceptionCopyright © 2010–2021 The Direct Project. All rights reserved.