Class Pkcs11SigningProviderFactory

java.lang.Object
zeroecho.pki.impl.crypto.pkcs11.Pkcs11SigningProviderFactory
All Implemented Interfaces:
ConfigurableProvider<SigningProvider>, SigningProviderFactory

public final class Pkcs11SigningProviderFactory extends Object implements SigningProviderFactory
ServiceLoader factory for the PKCS#11 / HSM signing provider.

Keys are generated on the HSM and never exported. Cryptographic operations execute on the HSM token via the JDK's built-in SunPKCS11 provider. This satisfies FIPS 140-3 Level 3 requirements for key non-exportability.

Configuration keys

  • pkcs11ConfigFile (required): path to the SunPKCS11 library config file
  • pinVariable (required): name of the environment variable holding the HSM PIN
  • slot (optional, default 0): PKCS#11 slot index
  • keyLabelPattern (optional, default zeroecho-{authorityId}): key label template
  • keyRefPrefix (optional): prefix applied to key references
  • operationHorizon (optional, ISO-8601 duration, default P90D)
  • sessionPoolSize (optional, default 2): number of PKCS#11 sessions
  • supportedAlgorithms (optional, comma-separated JCA names)

Security

The PIN is read from the environment variable named by pinVariable, never from the config file itself. Configuration values must not be logged.

Since:
1.0
  • Field Details

    • DC_PIN_ENV_NOT_SET

      public static final String DC_PIN_ENV_NOT_SET
      Stable failure code when the HSM PIN environment variable is absent or empty.
      See Also:
    • DC_PKCS11_PROVIDER_LOAD_FAILED

      public static final String DC_PKCS11_PROVIDER_LOAD_FAILED
      Stable failure code when the PKCS#11 provider cannot be loaded.
      See Also:
    • DC_HSM_KEYSTORE_OPEN_FAILED

      public static final String DC_HSM_KEYSTORE_OPEN_FAILED
      Stable failure code when the HSM KeyStore cannot be opened.
      See Also:
  • Constructor Details

    • Pkcs11SigningProviderFactory

      public Pkcs11SigningProviderFactory()
      Creates a provider factory without opening an HSM session.
  • Method Details