KeyVaultKeyStore Class
- java.
lang. Object - java.
security. KeyStoreSpi - com.
azure. security. keyvault. jca. KeyVaultKeyStore
- com.
- java.
public final class KeyVaultKeyStore
extends KeyStoreSpi
The Azure Key Vault implementation of the KeyStoreSpi.
Field Summary
| Modifier and Type | Field and Description |
|---|---|
| static final String |
ALGORITHM_NAME
Stores the algorithm name. |
| static final String |
KEY_STORE_TYPE
Stores the key-store name. |
Constructor Summary
| Constructor | Description |
|---|---|
| KeyVaultKeyStore() |
Constructor. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
| Enumeration<String> |
engineAliases()
Lists all the alias names of this keystore. |
| boolean |
engineContainsAlias(String alias)
Checks if the given alias exists in this keystore. |
| void |
engineDeleteEntry(String alias)
Deletes the entry identified by the given alias from this keystore. |
| boolean |
engineEntryInstanceOf(String alias, Class<? extends KeyStore.Entry> entryClass)
Determines if the keystore |
| Certificate |
engineGetCertificate(String alias)
Get the certificate associated with the given alias. |
| String |
engineGetCertificateAlias(Certificate cert)
Get the (alias) name of the first keystore entry whose certificate matches the given certificate. |
| Certificate[] |
engineGetCertificateChain(String alias)
Get the certificate chain associated with the given alias. |
| Date |
engineGetCreationDate(String alias)
Get the creation date of the entry identified by the given alias. |
| java.security.KeyStore.Entry |
engineGetEntry(String alias, KeyStore.ProtectionParameter protParam)
Gets a |
| Key |
engineGetKey(String alias, char[] password)
Get key associated with the given alias. |
| boolean |
engineIsCertificateEntry(String alias)
Check whether the entry identified by the given alias contains a trusted certificate. |
| boolean |
engineIsKeyEntry(String alias)
Check whether the entry identified by the given alias is a key-related. |
| void |
engineLoad(InputStream stream, char[] password)
Loads the keystore from the given input stream. |
| void |
engineLoad(KeyStore.LoadStoreParameter param)
Loads the keystore using the given |
| void |
engineSetCertificateEntry(String alias, Certificate certificate)
Assigns the given certificate to the given alias. |
| void |
engineSetEntry(String alias, KeyStore.Entry entry, KeyStore.ProtectionParameter protParam)
Saves a |
| void |
engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
Assigns the given key (that has already been protected) to the given alias. |
| void |
engineSetKeyEntry(String alias, Key key, char[] password, Certificate[] chain)
Assigns the given key to the given alias, protecting it with the given password. |
| int |
engineSize()
Retrieves the number of entries in this keystore. |
| void |
engineStore(KeyStore.LoadStoreParameter param)
Stores this keystore using the given. |
| void |
engineStore(OutputStream stream, char[] password)
Stores this keystore to the given output stream, and protects its integrity with the given password. |
|
static
Key |
getKeyVaultKeyStoreBySystemProperty()
Gets a Key Vault key store configured from a snapshot of the supported system properties. |
Methods inherited from java.lang.Object
Methods inherited from java.security.KeyStoreSpi
Field Details
ALGORITHM_NAME
public static final String ALGORITHM_NAME
Stores the algorithm name.
KEY_STORE_TYPE
public static final String KEY_STORE_TYPE
Stores the key-store name.
Constructor Details
KeyVaultKeyStore
public KeyVaultKeyStore()
Constructor.
The constructor uses fromSystemProperties() to capture the supported system properties and initialize all certificate sources from one configuration snapshot.
Method Details
engineAliases
public Enumeration<String> engineAliases()
Lists all the alias names of this keystore.
Overrides:
KeyVaultKeyStore.engineAliases()Returns:
engineContainsAlias
public boolean engineContainsAlias(String alias)
Checks if the given alias exists in this keystore.
Overrides:
KeyVaultKeyStore.engineContainsAlias(String alias)Parameters:
Returns:
engineDeleteEntry
public void engineDeleteEntry(String alias)
Deletes the entry identified by the given alias from this keystore.
Overrides:
KeyVaultKeyStore.engineDeleteEntry(String alias)Parameters:
engineEntryInstanceOf
public boolean engineEntryInstanceOf(String alias, Class<? extends KeyStore.Entry> entryClass)
Determines if the keystore Entry for the specified alias is an instance or subclass of the specified entryClass.
Overrides:
KeyVaultKeyStore.engineEntryInstanceOf(String alias, Class<? extends KeyStore.Entry> entryClass)Parameters:
Returns:
Entry for the specified
alias is an instance or subclass of the
specified entryClass, false otherwiseengineGetCertificate
public Certificate engineGetCertificate(String alias)
Get the certificate associated with the given alias.
Overrides:
KeyVaultKeyStore.engineGetCertificate(String alias)Parameters:
Returns:
engineGetCertificateAlias
public String engineGetCertificateAlias(Certificate cert)
Get the (alias) name of the first keystore entry whose certificate matches the given certificate.
Overrides:
KeyVaultKeyStore.engineGetCertificateAlias(Certificate cert)Parameters:
Returns:
engineGetCertificateChain
public Certificate[] engineGetCertificateChain(String alias)
Get the certificate chain associated with the given alias.
Overrides:
KeyVaultKeyStore.engineGetCertificateChain(String alias)Parameters:
Returns:
engineGetCreationDate
public Date engineGetCreationDate(String alias)
Get the creation date of the entry identified by the given alias.
Overrides:
KeyVaultKeyStore.engineGetCreationDate(String alias)Parameters:
Returns:
engineGetEntry
public KeyStore.Entry engineGetEntry(String alias, KeyStore.ProtectionParameter protParam)
Gets a KeyStore.Entry for the specified alias with the specified protection parameter.
Overrides:
KeyVaultKeyStore.engineGetEntry(String alias, KeyStore.ProtectionParameter protParam)Parameters:
Returns:
KeyStore.Entry for the specified alias,or null if there is no such entryThrows:
engineGetKey
public Key engineGetKey(String alias, char[] password)
Get key associated with the given alias.
Overrides:
KeyVaultKeyStore.engineGetKey(String alias, char[] password)Parameters:
Returns:
engineIsCertificateEntry
public boolean engineIsCertificateEntry(String alias)
Check whether the entry identified by the given alias contains a trusted certificate.
Overrides:
KeyVaultKeyStore.engineIsCertificateEntry(String alias)Parameters:
Returns:
engineIsKeyEntry
public boolean engineIsKeyEntry(String alias)
Check whether the entry identified by the given alias is a key-related.
Overrides:
KeyVaultKeyStore.engineIsKeyEntry(String alias)Parameters:
Returns:
engineLoad
public void engineLoad(InputStream stream, char[] password)
Loads the keystore from the given input stream.
Overrides:
KeyVaultKeyStore.engineLoad(InputStream stream, char[] password)Parameters:
null
engineLoad
public void engineLoad(KeyStore.LoadStoreParameter param)
Loads the keystore using the given KeyStore.LoadStoreParameter. A KeyVaultLoadStoreParameter replaces the complete configuration captured by the constructor.
Overrides:
KeyVaultKeyStore.engineLoad(KeyStore.LoadStoreParameter param)Parameters:
KeyStore.LoadStoreParameter
that specifies how to load the keystore,
which may be null
engineSetCertificateEntry
public void engineSetCertificateEntry(String alias, Certificate certificate)
Assigns the given certificate to the given alias.
Overrides:
KeyVaultKeyStore.engineSetCertificateEntry(String alias, Certificate certificate)Parameters:
engineSetEntry
public void engineSetEntry(String alias, KeyStore.Entry entry, KeyStore.ProtectionParameter protParam)
Saves a KeyStore.Entry under the specified alias. The specified protection parameter is used to protect the Entry.
Overrides:
KeyVaultKeyStore.engineSetEntry(String alias, KeyStore.Entry entry, KeyStore.ProtectionParameter protParam)Parameters:
Throws:
engineSetKeyEntry
public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
Assigns the given key (that has already been protected) to the given alias.
Overrides:
KeyVaultKeyStore.engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)Parameters:
engineSetKeyEntry
public void engineSetKeyEntry(String alias, Key key, char[] password, Certificate[] chain)
Assigns the given key to the given alias, protecting it with the given password.
Overrides:
KeyVaultKeyStore.engineSetKeyEntry(String alias, Key key, char[] password, Certificate[] chain)Parameters:
engineSize
public int engineSize()
Retrieves the number of entries in this keystore.
Overrides:
KeyVaultKeyStore.engineSize()Returns:
engineStore
public void engineStore(KeyStore.LoadStoreParameter param)
Stores this keystore using the given.
Overrides:
KeyVaultKeyStore.engineStore(KeyStore.LoadStoreParameter param)Parameters:
engineStore
public void engineStore(OutputStream stream, char[] password)
Stores this keystore to the given output stream, and protects its integrity with the given password.
Overrides:
KeyVaultKeyStore.engineStore(OutputStream stream, char[] password)Parameters:
getKeyVaultKeyStoreBySystemProperty
public static KeyStore getKeyVaultKeyStoreBySystemProperty()
Gets a Key Vault key store configured from a snapshot of the supported system properties.
Returns:
Throws: