Class PKCS12KeyStoreSpi

    • Field Detail

      • random

        protected java.security.SecureRandom random
    • Method Detail

      • setRandom

        public void setRandom​(java.security.SecureRandom rand)
        Description copied from interface: BCKeyStore
        set the random source for the key store
        Specified by:
        setRandom in interface BCKeyStore
      • engineAliases

        public java.util.Enumeration engineAliases()
        Specified by:
        engineAliases in class java.security.KeyStoreSpi
      • engineContainsAlias

        public boolean engineContainsAlias​(java.lang.String alias)
        Specified by:
        engineContainsAlias in class java.security.KeyStoreSpi
      • engineDeleteEntry

        public void engineDeleteEntry​(java.lang.String alias)
                               throws java.security.KeyStoreException
        this is not quite complete - we should follow up on the chain, a bit tricky if a certificate appears in more than one chain... the store method now prunes out unused certificates from the chain map if they are present.
        Specified by:
        engineDeleteEntry in class java.security.KeyStoreSpi
        Throws:
        java.security.KeyStoreException
      • engineGetCertificate

        public java.security.cert.Certificate engineGetCertificate​(java.lang.String alias)
        simply return the cert for the private key
        Specified by:
        engineGetCertificate in class java.security.KeyStoreSpi
      • engineGetCertificateAlias

        public java.lang.String engineGetCertificateAlias​(java.security.cert.Certificate cert)
        Specified by:
        engineGetCertificateAlias in class java.security.KeyStoreSpi
      • engineGetCertificateChain

        public java.security.cert.Certificate[] engineGetCertificateChain​(java.lang.String alias)
        Specified by:
        engineGetCertificateChain in class java.security.KeyStoreSpi
      • engineGetCreationDate

        public java.util.Date engineGetCreationDate​(java.lang.String alias)
        Specified by:
        engineGetCreationDate in class java.security.KeyStoreSpi
      • engineGetKey

        public java.security.Key engineGetKey​(java.lang.String alias,
                                              char[] password)
                                       throws java.security.NoSuchAlgorithmException,
                                              java.security.UnrecoverableKeyException
        Specified by:
        engineGetKey in class java.security.KeyStoreSpi
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.UnrecoverableKeyException
      • engineIsCertificateEntry

        public boolean engineIsCertificateEntry​(java.lang.String alias)
        Specified by:
        engineIsCertificateEntry in class java.security.KeyStoreSpi
      • engineIsKeyEntry

        public boolean engineIsKeyEntry​(java.lang.String alias)
        Specified by:
        engineIsKeyEntry in class java.security.KeyStoreSpi
      • engineSetCertificateEntry

        public void engineSetCertificateEntry​(java.lang.String alias,
                                              java.security.cert.Certificate cert)
                                       throws java.security.KeyStoreException
        Specified by:
        engineSetCertificateEntry in class java.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:
        engineSetKeyEntry in class java.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:
        engineSetKeyEntry in class java.security.KeyStoreSpi
        Throws:
        java.security.KeyStoreException
      • engineSize

        public int engineSize()
        Specified by:
        engineSize in class java.security.KeyStoreSpi
      • unwrapKey

        protected java.security.PrivateKey unwrapKey​(AlgorithmIdentifier algId,
                                                     byte[] data,
                                                     char[] password,
                                                     boolean wrongPKCS12Zero)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • wrapKey

        protected byte[] wrapKey​(java.lang.String algorithm,
                                 java.security.Key key,
                                 PKCS12PBEParams pbeParams,
                                 char[] password)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • cryptData

        protected byte[] cryptData​(boolean forEncryption,
                                   AlgorithmIdentifier algId,
                                   char[] password,
                                   boolean wrongPKCS12Zero,
                                   byte[] data)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • engineLoad

        public void engineLoad​(java.io.InputStream stream,
                               char[] password)
                        throws java.io.IOException
        Specified by:
        engineLoad in class java.security.KeyStoreSpi
        Throws:
        java.io.IOException
      • engineStore

        public void engineStore​(java.security.KeyStore.LoadStoreParameter param)
                         throws java.io.IOException,
                                java.security.NoSuchAlgorithmException,
                                java.security.cert.CertificateException
        Overrides:
        engineStore in class java.security.KeyStoreSpi
        Throws:
        java.io.IOException
        java.security.NoSuchAlgorithmException
        java.security.cert.CertificateException
      • engineStore

        public void engineStore​(java.io.OutputStream stream,
                                char[] password)
                         throws java.io.IOException
        Specified by:
        engineStore in class java.security.KeyStoreSpi
        Throws:
        java.io.IOException