Class PEMPKCS8KeyMasterConfiguration

  • All Implemented Interfaces:
    IKeyMasterConfiguration

    public class PEMPKCS8KeyMasterConfiguration
    extends java.lang.Object
    implements IKeyMasterConfiguration

    The PEMPKCS8KeyMasterConfiguration class creates a configuration for KeyMaster using a private key stored in a pkcs#8 PEM format file. The private key must not be password protected.

    Use the following openssl command to convert an openssl generated PEM file to a pkcs8 encoded PEM file

    openssl pkcs8 -topk8 -inform PEM -outform PEM -in privatekey_openssl.pem -out privatekey.pem -nocrypt
    • Constructor Detail

      • PEMPKCS8KeyMasterConfiguration

        public PEMPKCS8KeyMasterConfiguration​(java.io.InputStream pemKeyInputStream,
                                              KeyMasterHashingAlgorithm hashingAlgorithm,
                                              java.lang.String securityProviderName)
                                       throws java.lang.Exception
        Initializes a new instance of the PEMPKCS8KeyMasterConfiguration class that uses the private key in the supplied PKCS#8 PEM format file.
        Parameters:
        pemKeyInputStream - The input stream for the PEM private key file.
        hashingAlgorithm - The hashing algorithm to use.
        securityProviderName - The name of the security provider to use or null to use the first suitable security provider registered.
        Throws:
        java.lang.IllegalArgumentException - The specified key file is an inappropriate format.
        java.lang.Exception - The specified key file cannot be found.
      • PEMPKCS8KeyMasterConfiguration

        public PEMPKCS8KeyMasterConfiguration​(java.lang.String pemKeyFile,
                                              KeyMasterHashingAlgorithm hashingAlgorithm,
                                              java.lang.String securityProviderName)
                                       throws java.lang.Exception
        Initializes a new instance of the PEMPKCS8KeyMasterConfiguration class that uses the private key in the supplied PKCS#8 PEM format file.
        Parameters:
        pemKeyFile - The file pathname of the PEM private key file.
        hashingAlgorithm - The hashing algorithm to use.
        securityProviderName - The name of the security provider to use or null to use the first suitable security provider registered.
        Throws:
        java.lang.IllegalArgumentException - The specified key file is an inappropriate format.
        java.lang.Exception - The specified key file cannot be found.
    • Method Detail

      • getPrivateKey

        public java.security.PrivateKey getPrivateKey()
        Description copied from interface: IKeyMasterConfiguration
        Gets a private key object.

        The KeyMaster token generator retrieves this property whenever it needs to generate a token.

        Specified by:
        getPrivateKey in interface IKeyMasterConfiguration
        Returns:
        The private key.
      • getSecurityProviderName

        public java.lang.String getSecurityProviderName()
        Description copied from interface: IKeyMasterConfiguration
        The name of the Java Security provider to be used to generate the token. If set to null the token generation traverses the list of registered security Providers, starting with the most preferred Provider, the first provider that supports the specified signature algorithm will be used.
        Specified by:
        getSecurityProviderName in interface IKeyMasterConfiguration
        Returns:
        The name of the security provider or null.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object