Class JSSKeyStoreSpi
- java.lang.Object
-
- java.security.KeyStoreSpi
-
- org.mozilla.jss.provider.java.security.JSSKeyStoreSpi
-
public class JSSKeyStoreSpi extends java.security.KeyStoreSpiThe JSS implementation of the JCA KeyStore SPI.Implementation notes
- deleteEntry will delete all entries with that label. If the entry is a cert with a matching private key, it will also delete the private key.
- getCertificate returns first cert with matching nickname. Returns it as a PK11Cert, when possible.
- getCreationDate is unsupported because NSS doesn't store that information.
- getKey first looks for a private/symmetric key with the given label. It returns the first one it finds. If it doesn't find one, it looks for a cert with the given nickname. If it finds one, it returns the private key for that cert.
- isCertificateEntry returns true if there is a cert with this nickname, but it doesn't have a private key. isKeyEntry returns true if there is a key with this nickname, or if there is a cert with this nickname and the cert has an associated private key.
- load updates the token in the keystore.
- store is a no-op.
- setCertificateEntry doesn't work.NSS doesn't have a way of storing a certificate on a specific token unless it has an associated private key. That rules out trusted certificate entries.
- setKeyEntry not supported yet. Need to convert a temporary key into a permanent key.
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Loggerloggerprotected TokenProxyproxy
-
Constructor Summary
Constructors Constructor Description JSSKeyStoreSpi()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Enumeration<java.lang.String>engineAliases()booleanengineContainsAlias(java.lang.String alias)voidengineDeleteEntry(java.lang.String alias)java.security.cert.CertificateengineGetCertificate(java.lang.String alias)java.lang.StringengineGetCertificateAlias(java.security.cert.Certificate cert)java.security.cert.Certificate[]engineGetCertificateChain(java.lang.String alias)java.util.DateengineGetCreationDate(java.lang.String alias)java.security.KeyengineGetKey(java.lang.String alias, char[] password)booleanengineIsCertificateEntry(java.lang.String alias)Returns true if there is a cert with this nickname but there is no key associated with the cert.booleanengineIsKeyEntry(java.lang.String alias)Returns true if there is a key with this alias, or if there is a cert with this alias that has an associated key.voidengineLoad(java.io.InputStream stream, char[] password)voidengineLoad(java.security.KeyStore.LoadStoreParameter param)voidengineSetCertificateEntry(java.lang.String alias, java.security.cert.Certificate cert)NSS doesn't have a way of storing a certificate on a specific token unless it has an associated private key.voidengineSetKeyEntry(java.lang.String alias, byte[] key, java.security.cert.Certificate[] chain)voidengineSetKeyEntry(java.lang.String alias, java.security.Key key, char[] password, java.security.cert.Certificate[] chain)intengineSize()voidengineStore(java.io.OutputStream stream, char[] password)java.util.Collection<java.lang.String>getAliases()
-
-
-
Field Detail
-
logger
public static org.slf4j.Logger logger
-
proxy
protected TokenProxy proxy
-
-
Method Detail
-
engineAliases
public java.util.Enumeration<java.lang.String> engineAliases()
- Specified by:
engineAliasesin classjava.security.KeyStoreSpi
-
getAliases
public java.util.Collection<java.lang.String> getAliases()
-
engineContainsAlias
public boolean engineContainsAlias(java.lang.String alias)
- Specified by:
engineContainsAliasin classjava.security.KeyStoreSpi
-
engineDeleteEntry
public void engineDeleteEntry(java.lang.String alias) throws java.security.KeyStoreException- Specified by:
engineDeleteEntryin classjava.security.KeyStoreSpi- Throws:
java.security.KeyStoreException
-
engineGetCertificate
public java.security.cert.Certificate engineGetCertificate(java.lang.String alias)
- Specified by:
engineGetCertificatein classjava.security.KeyStoreSpi
-
engineGetCertificateAlias
public java.lang.String engineGetCertificateAlias(java.security.cert.Certificate cert)
- Specified by:
engineGetCertificateAliasin classjava.security.KeyStoreSpi
-
engineGetCertificateChain
public java.security.cert.Certificate[] engineGetCertificateChain(java.lang.String alias)
- Specified by:
engineGetCertificateChainin classjava.security.KeyStoreSpi
-
engineGetCreationDate
public java.util.Date engineGetCreationDate(java.lang.String alias)
- Specified by:
engineGetCreationDatein classjava.security.KeyStoreSpi
-
engineGetKey
public java.security.Key engineGetKey(java.lang.String alias, char[] password)- Specified by:
engineGetKeyin classjava.security.KeyStoreSpi
-
engineIsCertificateEntry
public boolean engineIsCertificateEntry(java.lang.String alias)
Returns true if there is a cert with this nickname but there is no key associated with the cert.- Specified by:
engineIsCertificateEntryin classjava.security.KeyStoreSpi
-
engineIsKeyEntry
public boolean engineIsKeyEntry(java.lang.String alias)
Returns true if there is a key with this alias, or if there is a cert with this alias that has an associated key.- Specified by:
engineIsKeyEntryin classjava.security.KeyStoreSpi
-
engineLoad
public void engineLoad(java.io.InputStream stream, char[] password) throws java.io.IOException- Specified by:
engineLoadin classjava.security.KeyStoreSpi- Throws:
java.io.IOException
-
engineLoad
public void engineLoad(java.security.KeyStore.LoadStoreParameter param) throws java.io.IOException- Overrides:
engineLoadin classjava.security.KeyStoreSpi- Throws:
java.io.IOException
-
engineSetCertificateEntry
public void engineSetCertificateEntry(java.lang.String alias, java.security.cert.Certificate cert) throws java.security.KeyStoreExceptionNSS doesn't have a way of storing a certificate on a specific token unless it has an associated private key. That rules out trusted certificate entries, so we can't supply this method currently.- Specified by:
engineSetCertificateEntryin classjava.security.KeyStoreSpi- Throws:
java.security.KeyStoreException
-
engineSetKeyEntry
public void engineSetKeyEntry(java.lang.String alias, byte[] key, java.security.cert.Certificate[] chain) throws java.security.KeyStoreException- Specified by:
engineSetKeyEntryin classjava.security.KeyStoreSpi- Throws:
java.security.KeyStoreException
-
engineSetKeyEntry
public void engineSetKeyEntry(java.lang.String alias, java.security.Key key, char[] password, java.security.cert.Certificate[] chain) throws java.security.KeyStoreException- Specified by:
engineSetKeyEntryin classjava.security.KeyStoreSpi- Throws:
java.security.KeyStoreException
-
engineSize
public int engineSize()
- Specified by:
engineSizein classjava.security.KeyStoreSpi
-
engineStore
public void engineStore(java.io.OutputStream stream, char[] password) throws java.io.IOException- Specified by:
engineStorein classjava.security.KeyStoreSpi- Throws:
java.io.IOException
-
-