NitroKeyHSM2, OpenSC and Microsoft CA - no SHA512

Trying to create a new standalone CA, leveraging the NitroKey with an RSA4096 stored on the HSM2 itself, and then using it to generate a SHA512 cert to deploy the root CA using Windows Server 2025. However, I cannot seem to find a way to have additional options beyond the SHA1, md2, md4 or md5 available.

How do I get SHA512 visible in the Microsoft CA, connecting to the nitrokey HSM via OpenSC when deploying a new standalone root CA, and have the CA configuration wizard leverage the keypair on the HSM2 to proceed with the deployment using SHA512? I’ve installed both the 32 and 64 bit versions of OpenSC (latest version 0.26.1) on the server. Am I missing drivers? or some .conf or .ini configuration which points to a dll somewhere I might have missed?

any suggestions and ideas would be appreciated.

edited for additional clarity.

nothing from anyone? the NitrokeyHSM2 is perfect, but I just can’t get the Windows Certificate Authority to see any cryptography higher than SHA1, md2, md4 or md5, to generate a cert for a standalone root CA deployment based on the 4096 RSA key I had the HSM generate internally.

I scoured the documentation, Git forums, OpenSC wiki/bugs, and followed those respective tangents, but still no viable solution.

surely i’m not the first person who has attempted this?

hey,

generally the HSM2 should have far more mechanisms available apart from sha1, see pkcs11-tool -M outputs:

❯ pkcs11-tool -M
Using slot 0 with a present token (0x0)
Supported mechanisms:
  SHA-1, digest
  SHA224, digest
  SHA256, digest
  SHA384, digest
  SHA512, digest
  MD5, digest
  RIPEMD160, digest
  GOSTR3411, digest
  ECDSA, keySize={192,521}, hw, sign, verify, EC F_P, EC parameters, EC OID, EC uncompressed
  ECDSA-SHA1, keySize={192,521}, hw, sign, verify, EC F_P, EC parameters, EC OID, EC uncompressed
  ECDSA-SHA224, keySize={192,521}, hw, sign, verify, EC F_P, EC parameters, EC OID, EC uncompressed
  ECDSA-SHA256, keySize={192,521}, hw, sign, verify, EC F_P, EC parameters, EC OID, EC uncompressed
  ECDSA-SHA384, keySize={192,521}, hw, sign, verify, EC F_P, EC parameters, EC OID, EC uncompressed
  ECDSA-SHA512, keySize={192,521}, hw, sign, verify, EC F_P, EC parameters, EC OID, EC uncompressed
  ECDH1-COFACTOR-DERIVE, keySize={192,521}, hw, derive, EC F_P, EC parameters, EC OID, EC uncompressed
  ECDH1-DERIVE, keySize={192,521}, hw, derive, EC F_P, EC parameters, EC OID, EC uncompressed
  ECDSA-KEY-PAIR-GEN, keySize={192,521}, hw, generate_key_pair, EC F_P, EC parameters, EC OID, EC uncompressed
  RSA-X-509, keySize={1024,4096}, hw, decrypt, sign, verify
  RSA-PKCS, keySize={1024,4096}, hw, decrypt, sign, verify
  SHA1-RSA-PKCS, keySize={1024,4096}, sign, verify
  SHA256-RSA-PKCS, keySize={1024,4096}, sign, verify
  SHA384-RSA-PKCS, keySize={1024,4096}, sign, verify
  SHA512-RSA-PKCS, keySize={1024,4096}, sign, verify
  RSA-PKCS-PSS, keySize={1024,4096}, hw, sign, verify
  SHA1-RSA-PKCS-PSS, keySize={1024,4096}, sign, verify
  SHA256-RSA-PKCS-PSS, keySize={1024,4096}, sign, verify
  SHA384-RSA-PKCS-PSS, keySize={1024,4096}, sign, verify
  SHA512-RSA-PKCS-PSS, keySize={1024,4096}, sign, verify
  RSA-PKCS-OAEP, keySize={1024,4096}, hw, decrypt
  RSA-PKCS-KEY-PAIR-GEN, keySize={1024,4096}, hw, generate_key_pair

So my assumption would be (w/o having any experience with a Windows CA) that the tooling is responsible to use any of those. In order to help, you might also want to share more specifics or even the exact commands so somebody else can reproduce your issue.

best

Hey there.

I have exactly the same problem as you and have already tried several things and read through what feels like all the Github posts, unfortunately I’m also getting nowhere and I’m slowly running out of things to try.

To reproduce:

  • Install blank Windows Server 2025 (already tried it with 2022, 2019 too)

  • Install the Certificate Authority role through Server Manager

  • During setup, select create new private key

  • Select “OpenSC CSP” as cryptographic provider

It would be cool to find a way to support this correctly. I work at an MSP and a lot of customers would want to use this feature.

I’ve also installed both the 32 and 64 bit versions of OpenSC (latest version 0.26.1).

I think the Windows CA does not natively support PKCS11, but maybe there is a way around this?

Nobrac has demonstrated the exact issue we’re experiencing. any additional suggestions?

I’ve tried adjusting the opensc.conf to prevent caching and have added the regkeys for the nitrokeys into the registry of the Server 2025. I’ve playing with the opensc pcks11 on a debian 12 linux box and can see all those options, but even using the pcks11 wrapper from opensc on server 2025 also shows me all the cryptography options. The problem is when the Microsoft CA wizard calls OpenSC, I only see the same options in nobrac’s post. I’ve also, using the pcks11 wrapper to generate an x509 cert on the NitroKeyHSM2, and within the wizard selecting “use an existing private key” and selecting the OpenSC, I can see a serial number, but i cannot import them either as i cannot get cryptography higher than SHA1.

my questions, is Windows leveraging a wrong driver? is there a “better” .dll which I should be using rather than the defaults for the WindowsCA wizard, when calling openSC, generate the cert on the USB. I’m not interested in compiling my own for this, but it would be fantastic for my use case, and also for the usecase that Nobrac has.

I think that you have already correctly figured out that this might be a problem with OpenSC CSP minidriver that is tracked at

Anyway, getting out the following info might give some clues

C:\Windows\System32\certutil.exe -scinfo
C:\Windows\SysWOW64\certutil.exe -scinfo

Certutil - scinfo is able to communicate with the HSM2, correctly identifies the slot it seems, if you’d like output, I’ll see what I can do.

I think you might want to start preparing an issue for OpenSC with that information…

You might also want to give the following minidriver a try:

@saper i’ve opened an issue 3341 in the OpenSC github, and have been discussing this issue with some additional investigation. an interesting observation was made related to the usage of OpenSC, sc-hsm-starterkit, which I think merits some review by Nitrokey, and I would appreciate some assistance in proceeding forward, where I currently appear to be stuck, without a way for the NitroKey to perform it’s desired function as the HSM for ADCS.

OpenSC 26.1 + NitrokeyHSM2 + Windows Certificate Authority (Server 2025, 2022, 2019) unable to select cryptography higher than SHA1 · Issue #3341 · OpenSC/OpenSC

please advise next steps.

I think the last remark OpenSC 26.1 + NitrokeyHSM2 + Windows Certificate Authority (Server 2025, 2022, 2019) unable to select cryptography higher than SHA1 · Issue #3341 · OpenSC/OpenSC · GitHub deserves some attention, as there might be some confusion about the actual software being run, but I can judge it only on face value.

I am not Nitrokey and not using Windows, so here you are.