public class CloudHsmKeyStore
extends java.security.KeyStoreSpi
CloudHsmKeyStore extends KeyStoreSpi to create an instance of a KeyStore
which can be used to store keys or certificates.| Constructor and Description |
|---|
CloudHsmKeyStore(CloudHsmProvider provider)
Constructs a CloudHSM
KeyStore. |
| Modifier and Type | Method and Description |
|---|---|
java.util.Enumeration<java.lang.String> |
engineAliases() |
boolean |
engineContainsAlias(java.lang.String alias) |
void |
engineDeleteEntry(java.lang.String alias)
CloudHsmKeyStore's deleteEntry method only supports deleting certificates and does not
support deleting keys.
|
java.security.cert.Certificate |
engineGetCertificate(java.lang.String alias) |
java.lang.String |
engineGetCertificateAlias(java.security.cert.Certificate cert) |
java.security.cert.Certificate[] |
engineGetCertificateChain(java.lang.String alias) |
java.util.Date |
engineGetCreationDate(java.lang.String alias) |
java.security.Key |
engineGetKey(java.security.spec.KeySpec findSpec)
Returns the key that matches the provided key spec.
|
java.security.Key |
engineGetKey(java.lang.String alias,
char[] password)
engineGetKey returns the key associated with the given alias. |
java.util.List<java.security.Key> |
engineGetKeys(java.security.spec.KeySpec keySpec)
Returns the keys that matches the provided key spec.
|
boolean |
engineIsCertificateEntry(java.lang.String alias) |
boolean |
engineIsKeyEntry(java.lang.String alias) |
void |
engineLoad(java.io.InputStream stream,
char[] password) |
void |
engineSetCertificateEntry(java.lang.String alias,
java.security.cert.Certificate cert) |
void |
engineSetKeyEntry(java.lang.String alias,
byte[] key,
java.security.cert.Certificate[] chain)
Method not supported by CloudHSM.
|
void |
engineSetKeyEntry(java.lang.String alias,
java.security.Key key,
char[] password,
java.security.cert.Certificate[] chain)
Assigns the given key to the given alias, protecting it with the given password.
|
int |
engineSize() |
void |
engineStore(java.io.OutputStream stream,
char[] password) |
public CloudHsmKeyStore(CloudHsmProvider provider) throws java.security.KeyStoreException, java.lang.IllegalStateException
KeyStore. It creates a KeyStore instance and holds a
reference to it.provider - CloudHSM provider offering this service.java.security.KeyStoreException - if it fails to get KeyStoreSpi.java.lang.IllegalStateException - when provider is null.public java.util.Enumeration<java.lang.String> engineAliases()
engineAliases in class java.security.KeyStoreSpipublic boolean engineContainsAlias(java.lang.String alias)
engineContainsAlias in class java.security.KeyStoreSpipublic void engineDeleteEntry(java.lang.String alias)
throws java.security.KeyStoreException
To delete CloudHSM keys, use Destroyable.destroy().
engineDeleteEntry in class java.security.KeyStoreSpijava.security.KeyStoreException - if the provided alias is null, or the provided alias is not an
alias of a certificate entry.public java.security.cert.Certificate engineGetCertificate(java.lang.String alias)
engineGetCertificate in class java.security.KeyStoreSpipublic java.lang.String engineGetCertificateAlias(java.security.cert.Certificate cert)
engineGetCertificateAlias in class java.security.KeyStoreSpipublic java.security.cert.Certificate[] engineGetCertificateChain(java.lang.String alias)
engineGetCertificateChain in class java.security.KeyStoreSpipublic java.util.Date engineGetCreationDate(java.lang.String alias)
engineGetCreationDate in class java.security.KeyStoreSpipublic java.security.Key engineGetKey(java.lang.String alias,
char[] password)
throws java.security.NoSuchAlgorithmException,
java.security.UnrecoverableKeyException
engineGetKey returns the key associated with the given alias.
Using a password to recover keys is not supported by CloudHSM. The password should be null.
engineGetKey in class java.security.KeyStoreSpijava.security.NoSuchAlgorithmException - if the algorithm for recovering the key cannot be found.java.security.UnrecoverableKeyException - if the key cannot be recovered.public boolean engineIsCertificateEntry(java.lang.String alias)
engineIsCertificateEntry in class java.security.KeyStoreSpipublic boolean engineIsKeyEntry(java.lang.String alias)
engineIsKeyEntry in class java.security.KeyStoreSpipublic void engineLoad(java.io.InputStream stream,
char[] password)
throws java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.cert.CertificateException
engineLoad in class java.security.KeyStoreSpijava.io.IOExceptionjava.security.NoSuchAlgorithmExceptionjava.security.cert.CertificateExceptionpublic void engineSetCertificateEntry(java.lang.String alias,
java.security.cert.Certificate cert)
throws java.security.KeyStoreException
engineSetCertificateEntry in class java.security.KeyStoreSpijava.security.KeyStoreExceptionpublic void engineSetKeyEntry(java.lang.String alias,
byte[] key,
java.security.cert.Certificate[] chain)
engineSetKeyEntry in class java.security.KeyStoreSpialias - Unusedkey - Unusedchain - Unusedjava.lang.UnsupportedOperationException - Always.public void engineSetKeyEntry(java.lang.String alias,
java.security.Key key,
char[] password,
java.security.cert.Certificate[] chain)
throws java.security.KeyStoreException
If the given key is of type javax.crypto.SecretKey, it must NOT be accompanied by
a certificate chain.
If the given key is of type java.security.PrivateKey, it must be accompanied by a
certificate chain certifying the corresponding public key.
engineSetKeyEntry in class java.security.KeyStoreSpialias - the alias namekey - the key to be associated with the aliaspassword - the password to protect the keychain - the certificate chain for the corresponding public key (only required if the
given key is of type java.security.PrivateKey).java.security.KeyStoreException - if invalid parameters are given, or if the key given is
unsupported, or if the given key cannot be protected, or this operation fails for some
other reasonpublic int engineSize()
engineSize in class java.security.KeyStoreSpipublic void engineStore(java.io.OutputStream stream,
char[] password)
throws java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.cert.CertificateException
engineStore in class java.security.KeyStoreSpijava.io.IOExceptionjava.security.NoSuchAlgorithmExceptionjava.security.cert.CertificateExceptionpublic java.security.Key engineGetKey(java.security.spec.KeySpec findSpec)
throws java.security.spec.InvalidKeySpecException
findSpec - the specification of the key. This must be either an instance of KeyAttributesMap or KeyReferenceSpec.java.security.spec.InvalidKeySpecException - If the provided key spec is invalid.KeyAttributesMap,
KeyReferenceSpecpublic java.util.List<java.security.Key> engineGetKeys(java.security.spec.KeySpec keySpec)
throws java.security.spec.InvalidKeySpecException
keySpec - The attributes and their values that the keys should have.java.security.spec.InvalidKeySpecException - If the provided key spec is invalid.