Class DefaultPKCS11ProviderManager

  • All Implemented Interfaces:
    PKCS11ProviderManager

    public class DefaultPKCS11ProviderManager
    extends java.lang.Object
    implements PKCS11ProviderManager
    PKCS#11 provider manager in charge of creating, adding and loading a java PKCS#11 keystore, using Sun PKCS#11.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String addPKCS11Provider​(java.io.InputStream config)
      Create and add a PKCS#11 provider to the system
      static java.security.Provider createPKCS11Provider​(java.io.InputStream config)  
      java.security.KeyStore loadPKCS11Keystore​(char[] password)
      Load the PKCS#11 keystore and make it available for use.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultPKCS11ProviderManager

        public DefaultPKCS11ProviderManager()
    • Method Detail

      • createPKCS11Provider

        public static java.security.Provider createPKCS11Provider​(java.io.InputStream config)
                                                           throws java.lang.SecurityException,
                                                                  java.lang.NullPointerException,
                                                                  java.security.ProviderException
        Throws:
        java.lang.SecurityException
        java.lang.NullPointerException
        java.security.ProviderException
      • addPKCS11Provider

        public java.lang.String addPKCS11Provider​(java.io.InputStream config)
                                           throws java.lang.SecurityException,
                                                  java.lang.NullPointerException,
                                                  java.security.ProviderException
        Create and add a PKCS#11 provider to the system
        Specified by:
        addPKCS11Provider in interface PKCS11ProviderManager
        Parameters:
        config - Configuration to use when creating the provider
        Returns:
        the name of the created provider.
        Throws:
        java.lang.NullPointerException - If an empty provider was created based on the configuration.
        java.lang.SecurityException - If a security manager exists and its SecurityManager.checkSecurityAccess method denies access to add a new provider
        java.security.ProviderException - If error occurred when creating the provider.
      • loadPKCS11Keystore

        public java.security.KeyStore loadPKCS11Keystore​(char[] password)
                                                  throws java.security.KeyStoreException,
                                                         java.security.cert.CertificateException,
                                                         java.security.NoSuchAlgorithmException,
                                                         java.io.IOException
        Load the PKCS#11 keystore and make it available for use.
        Specified by:
        loadPKCS11Keystore in interface PKCS11ProviderManager
        Parameters:
        password - PKCS#11 Password to use when loading keystore
        Returns:
        Java PKCS#11 keystore
        Throws:
        java.security.KeyStoreException - If error occurred when instantiating the keystore.
        java.security.cert.CertificateException - If any of the certificates in the keystore could not be loaded.
        java.security.NoSuchAlgorithmException - if the algorithm used to check the integrity of the keystore cannot be found
        java.io.IOException - If there was a problem loading the keystore (not found or incorrect password).