Class BcKeyStoreSpi

    • Constructor Detail

      • BcKeyStoreSpi

        public BcKeyStoreSpi​(int version)
    • Method Detail

      • makePBECipher

        protected Cipher makePBECipher​(String algorithm,
                                       int mode,
                                       char[] password,
                                       byte[] salt,
                                       int iterationCount)
                                throws IOException
        Throws:
        IOException
      • engineAliases

        public Enumeration engineAliases()
        Description copied from class: KeyStoreSpi
        Returns an Enumeration over all alias names stored in this KeyStoreSpi.
        Specified by:
        engineAliases in class KeyStoreSpi
        Returns:
        an Enumeration over all alias names stored in this KeyStoreSpi.
      • engineContainsAlias

        public boolean engineContainsAlias​(String alias)
        Description copied from class: KeyStoreSpi
        Indicates whether the given alias is present in this KeyStoreSpi.
        Specified by:
        engineContainsAlias in class KeyStoreSpi
        Parameters:
        alias - the alias of an entry.
        Returns:
        true if the alias exists, false otherwise.
      • engineGetCertificate

        public Certificate engineGetCertificate​(String alias)
        Description copied from class: KeyStoreSpi
        Returns the trusted certificate for the entry with the given alias.
        Specified by:
        engineGetCertificate in class KeyStoreSpi
        Parameters:
        alias - the alias for the entry.
        Returns:
        the trusted certificate for the entry with the given alias, or null if the specified alias is not bound to an entry.
      • engineGetCertificateAlias

        public String engineGetCertificateAlias​(Certificate cert)
        Description copied from class: KeyStoreSpi
        Returns the alias associated with the first entry whose certificate matches the specified certificate.
        Specified by:
        engineGetCertificateAlias in class KeyStoreSpi
        Parameters:
        cert - the certificate to find the associated entry's alias for.
        Returns:
        the alias or null if no entry with the specified certificate can be found.
      • engineGetCertificateChain

        public Certificate[] engineGetCertificateChain​(String alias)
        Description copied from class: KeyStoreSpi
        Returns the certificate chain for the entry with the given alias.
        Specified by:
        engineGetCertificateChain in class KeyStoreSpi
        Parameters:
        alias - the alias for the entry
        Returns:
        the certificate chain for the entry with the given alias, or null if the specified alias is not bound to an entry.
      • engineGetCreationDate

        public Date engineGetCreationDate​(String alias)
        Description copied from class: KeyStoreSpi
        Returns the creation date of the entry with the given alias.
        Specified by:
        engineGetCreationDate in class KeyStoreSpi
        Parameters:
        alias - the alias for the entry.
        Returns:
        the creation date, or null if the specified alias is not bound to an entry.
      • engineSetCertificateEntry

        public void engineSetCertificateEntry​(String alias,
                                              Certificate cert)
                                       throws KeyStoreException
        Description copied from class: KeyStoreSpi
        Associates the given alias with a certificate.

        If the specified alias already exists, it will be reassigned.

        Specified by:
        engineSetCertificateEntry in class KeyStoreSpi
        Parameters:
        alias - the alias for the certificate.
        cert - the certificate.
        Throws:
        KeyStoreException - if an existing alias is not associated to an entry containing a trusted certificate, or this method fails for any other reason.
      • engineSetKeyEntry

        public void engineSetKeyEntry​(String alias,
                                      byte[] key,
                                      Certificate[] chain)
                               throws KeyStoreException
        Description copied from class: KeyStoreSpi
        Associates the given alias with a key and a certificate chain.

        If the specified alias already exists, it will be reassigned.

        Specified by:
        engineSetKeyEntry in class KeyStoreSpi
        Parameters:
        alias - the alias for the key.
        key - the key in an encoded format.
        chain - the certificate chain.
        Throws:
        KeyStoreException - if this operation fails.
      • engineSetKeyEntry

        public void engineSetKeyEntry​(String alias,
                                      Key key,
                                      char[] password,
                                      Certificate[] chain)
                               throws KeyStoreException
        Description copied from class: KeyStoreSpi
        Associates the given alias with the key, password and certificate chain.

        If the specified alias already exists, it will be reassigned.

        Specified by:
        engineSetKeyEntry in class KeyStoreSpi
        Parameters:
        alias - the alias for the key.
        key - the key.
        password - the password.
        chain - the certificate chain.
        Throws:
        KeyStoreException - if the specified key can not be protected, or if this operation fails for another reason.
      • engineSize

        public int engineSize()
        Description copied from class: KeyStoreSpi
        Returns the number of entries stored in this KeyStoreSpi.
        Specified by:
        engineSize in class KeyStoreSpi
        Returns:
        the number of entries stored in this KeyStoreSpi.
      • engineLoad

        public void engineLoad​(InputStream stream,
                               char[] password)
                        throws IOException
        Description copied from class: KeyStoreSpi
        Loads this KeyStoreSpi from the given InputStream. Utilizes the given password to verify the stored data.
        Specified by:
        engineLoad in class KeyStoreSpi
        Parameters:
        stream - the InputStream to load this KeyStoreSpi's data from.
        password - the password to verify the stored data, maybe null.
        Throws:
        IOException - if a problem occurred while reading from the stream.
      • engineStore

        public void engineStore​(OutputStream stream,
                                char[] password)
                         throws IOException
        Description copied from class: KeyStoreSpi
        Writes this KeyStoreSpi to the specified OutputStream. The data written to the OutputStream is protected by the specified password.
        Specified by:
        engineStore in class KeyStoreSpi
        Parameters:
        stream - the OutputStream to write the store's data to.
        password - the password to protect the data.
        Throws:
        IOException - if a problem occurred while writing to the stream.