Class CustomPkcs11Configuration

java.lang.Object
se.swedenconnect.security.credential.pkcs11.AbstractSunPkcs11Configuration
se.swedenconnect.security.credential.pkcs11.CustomPkcs11Configuration
All Implemented Interfaces:
Pkcs11Configuration

public class CustomPkcs11Configuration extends AbstractSunPkcs11Configuration
A Pkcs11Configuration where a PKCS#11 each configuration setting is supplied.

Note: This implementation assumes that the SunPKCS11 security provider is used, or other security providers that supports the KeyStoreSpi. See AbstractSunPkcs11Configuration.

See PKCS#11 Reference Guide.

Author:
Martin Lindström
  • Constructor Details

    • CustomPkcs11Configuration

      public CustomPkcs11Configuration(@Nonnull String library, @Nonnull String name, @Nullable String slot, @Nullable Integer slotListIndex, @Nullable String baseProviderName)
      Constructor setting the library, name, slot and slotListIndex individually.

      The baseProviderName is the name of the security provider that we use to create new instances that have names according to <base-provider-name>-<instance-name>, where 'instance-name' is gotten from the configuration. Implementations wishing to use another provider than "SunPKCS11" should supply this provider name.

      Parameters:
      library - the PKCS#11 library path
      name - the name of the HSM slot
      slot - the slot number/id (may be null)
      slotListIndex - the slot index (may be null)
      baseProviderName - the base provider name (if not given, SunPKCS11 is assumed)
  • Method Details

    • getConfigurationData

      @Nonnull protected String getConfigurationData()
      Gets the configuration data for this configuration. The data returned is supplied in the Provider.configure(String) call that is made to configure the PKCS#11 security provider.

      The returned string represents either a file name to an PKCS#11 configuration file or PKCS#11 configuration commands (in that case the string must be prefixed with --.

      Note: For configuration objects using a pre-configured security provider, the method must return null.

      Specified by:
      getConfigurationData in class AbstractSunPkcs11Configuration
      Returns:
      configuration data for a PKCS#11 provider, or null if no configuration is needed
    • toString

      public String toString()
      Overrides:
      toString in class AbstractSunPkcs11Configuration