Package com.fortanix.sdkms.jce.provider
Class LocalKeyStore
- java.lang.Object
-
- java.security.KeyStoreSpi
-
- com.fortanix.sdkms.jce.provider.KeyStore
-
- com.fortanix.sdkms.jce.provider.LocalKeyStore
-
public final class LocalKeyStore extends KeyStore
-
-
Constructor Summary
Constructors Constructor Description LocalKeyStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Enumeration<java.lang.String>engineAliases()Lists all the alias names of this keystore.booleanengineContainsAlias(java.lang.String alias)Checks if the given alias exists in this keystore.voidengineDeleteEntry(java.lang.String alias)Deletes the entry identified by the given alias from this keystore.java.security.cert.CertificateengineGetCertificate(java.lang.String alias)Returns the certificate associated with the given alias.java.lang.StringengineGetCertificateAlias(java.security.cert.Certificate cert)Returns the (alias) name of the first keystore entry whose certificate matches the given certificate.java.security.cert.Certificate[]engineGetCertificateChain(java.lang.String alias)Returns the certificate chain associated with the given alias.java.util.DateengineGetCreationDate(java.lang.String alias)Returns the creation date of the entry identified by the given alias.java.security.KeyengineGetKey(java.lang.String alias, char[] password)Returns the key associated with the given alias, using the given password to recover it.booleanengineIsCertificateEntry(java.lang.String alias)Returns true if the entry identified by the given alias is a trusted certificate entry, and false otherwise.booleanengineIsKeyEntry(java.lang.String alias)Returns true if the entry identified by the given alias is a key entry, and false otherwise.voidengineLoad(java.io.InputStream stream, char[] password)Loads the keystore from the given input stream.voidengineSetCertificateEntry(java.lang.String alias, java.security.cert.Certificate cert)Assigns the given certificate to the given alias.voidengineSetKeyEntry(java.lang.String alias, java.security.Key key, char[] password, java.security.cert.Certificate[] chain)Assigns the given private key to the given aliasintengineSize()Retrieves the number of entries in this keystore.voidengineStore(java.io.OutputStream stream, char[] password)Stores this keystore to the given output stream, and protects its integrity with the given password.-
Methods inherited from class com.fortanix.sdkms.jce.provider.KeyStore
engineSetKeyEntry, setCertificateEntry
-
-
-
-
Method Detail
-
engineGetKey
public java.security.Key engineGetKey(java.lang.String alias, char[] password) throws java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyExceptionReturns the key associated with the given alias, using the given password to recover it.- Specified by:
engineGetKeyin classKeyStore- Parameters:
alias- the alias namepassword- : always null- Returns:
- the requested key, or null if the given alias does not exist or does not identify a key entry.
- Throws:
java.security.NoSuchAlgorithmExceptionjava.security.UnrecoverableKeyException
-
engineGetCertificateChain
public java.security.cert.Certificate[] engineGetCertificateChain(java.lang.String alias)
Returns the certificate chain associated with the given alias.- Specified by:
engineGetCertificateChainin classKeyStore- Parameters:
alias- the alias name- Returns:
- the certificate chain
-
engineGetCertificate
public java.security.cert.Certificate engineGetCertificate(java.lang.String alias)
Description copied from class:KeyStoreReturns the certificate associated with the given alias.- Overrides:
engineGetCertificatein classKeyStore- Parameters:
alias- the alias name- Returns:
- the certificate, or null if the given alias does not exist or does not contain a certificate.
-
engineGetCreationDate
public java.util.Date engineGetCreationDate(java.lang.String alias)
Returns the creation date of the entry identified by the given alias.- Specified by:
engineGetCreationDatein classKeyStore- Parameters:
alias- the alias name- Returns:
- the creation date of this entry, or null if the given alias does not exist
-
engineSetKeyEntry
public void engineSetKeyEntry(java.lang.String alias, java.security.Key key, char[] password, java.security.cert.Certificate[] chain) throws java.security.KeyStoreExceptionAssigns the given private key to the given aliasThe given java.security.PrivateKey
keymust be accompanied by a certificate chain certifying the corresponding public key.If the given alias already exists, the keystore information associated with it is overridden by the given key and certificate chain.
- Specified by:
engineSetKeyEntryin classKeyStore- Parameters:
alias- the alias namekey- the private 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 typejava.security.PrivateKey).- Throws:
java.security.KeyStoreException
-
engineSetCertificateEntry
public void engineSetCertificateEntry(java.lang.String alias, java.security.cert.Certificate cert)Assigns the given certificate to the given alias.If the given alias already exists in this keystore and identifies a trusted certificate entry, the certificate associated with it is overridden by the given certificate.
- Specified by:
engineSetCertificateEntryin classKeyStore- Parameters:
alias- the alias namecert- the certificate
-
engineDeleteEntry
public void engineDeleteEntry(java.lang.String alias) throws java.security.KeyStoreExceptionDeletes the entry identified by the given alias from this keystore.- Specified by:
engineDeleteEntryin classKeyStore- Parameters:
alias- the alias name- Throws:
java.security.KeyStoreException- if the entry cannot be removed.
-
engineAliases
public java.util.Enumeration<java.lang.String> engineAliases()
Lists all the alias names of this keystore.- Specified by:
engineAliasesin classKeyStore- Returns:
- enumeration of the alias names
-
engineContainsAlias
public boolean engineContainsAlias(java.lang.String alias)
Checks if the given alias exists in this keystore.- Specified by:
engineContainsAliasin classjava.security.KeyStoreSpi- Parameters:
alias- the alias name- Returns:
- true if the alias exists, false otherwise
-
engineSize
public int engineSize()
Retrieves the number of entries in this keystore.- Specified by:
engineSizein classKeyStore- Returns:
- the number of entries in this keystore
-
engineIsKeyEntry
public boolean engineIsKeyEntry(java.lang.String alias)
Returns true if the entry identified by the given alias is a key entry, and false otherwise.- Specified by:
engineIsKeyEntryin classKeyStore- Returns:
- true if the entry identified by the given alias is a key entry, false otherwise.
-
engineIsCertificateEntry
public boolean engineIsCertificateEntry(java.lang.String alias)
Returns true if the entry identified by the given alias is a trusted certificate entry, and false otherwise.- Specified by:
engineIsCertificateEntryin classKeyStore- Returns:
- true if the entry identified by the given alias is a trusted certificate entry, false otherwise.
-
engineGetCertificateAlias
public java.lang.String engineGetCertificateAlias(java.security.cert.Certificate cert)
Returns the (alias) name of the first keystore entry whose certificate matches the given certificate.- Specified by:
engineGetCertificateAliasin classKeyStore- Parameters:
cert- the certificate to match with.- Returns:
- the (alias) name of the first entry with matching certificate, or null if no such entry exists in this keystore.
-
engineStore
public void engineStore(java.io.OutputStream stream, char[] password) throws java.io.IOExceptionStores this keystore to the given output stream, and protects its integrity with the given password.- Specified by:
engineStorein classKeyStore- Parameters:
stream- the output stream to which this keystore is written.password- the password (optional)- Throws:
java.io.IOException- if there was an I/O problem with data
-
engineLoad
public void engineLoad(java.io.InputStream stream, char[] password) throws java.io.IOExceptionLoads the keystore from the given input stream.- Specified by:
engineLoadin classKeyStore- Parameters:
stream- the input stream from which the keystore is loadedpassword- the (optional) password- Throws:
java.io.IOException- if there is an I/O or format problem with the keystore data
-
-