Hello,
I'm working on a Node.js PR to support OpenSSL provider-backed private keys in node:crypto, with pkcs11-provider as a realistic test case for non-exportable keys whose operations are performed by a token/HSM which we can execute in CI.
Node PR: nodejs/node#63949
The intended Node behavior is roughly:
- allow private-key inputs to be loaded from OpenSSL STORE URLs such as
pkcs11:object=...;type=private;
- keep the private key non-exportable when the provider/token does not expose key material;
- still support operations such as sign/verify, public-key derivation, and WebCrypto
CryptoKey wrapping where OpenSSL/provider semantics allow it;
- avoid hard-coding assumptions that are only true for one provider or one SoftHSM setup.
We have a local SoftHSM + pkcs11-provider harness covering RSA, RSA-PSS, EC P-256, Ed25519, Ed448, export behavior, WebCrypto wrapping, and some cipher/KEM/ECDH cases. Some things look straightforward, but others are harder to classify as "Node bug", "provider limitation", "token/mechanism limitation", or "expected OpenSSL provider contract".
Current areas where feedback would be especially useful:
-
Which operations should a consumer reasonably expect from PKCS#11 private keys loaded through STORE?
For example: digest sign vs raw/prehashed sign, RSA-PSS parameters, EdDSA one-shot signing, private decrypt, ECDH, and KEM/decapsulate.
-
Are failures for private-key export, RSA private decrypt, EC ECDH, or KEM operations expected with the current SoftHSM + pkcs11-provider setup, or are there provider parameters/mechanisms Node should be using differently?
-
For ECDSA, Node can sometimes recover by using the lower-level prehashed sign/verify path when provider digest-sign is unavailable. Does that match how pkcs11-provider expects consumers to use ECDSA keys, or is there a better EVP-level pattern?
-
Are there additional key types or operations we should include in the harness?
SM2, DSA, X25519/X448, and eventually PQC keys are all areas where we do not want to make incorrect assumptions from a narrow RSA/EC test matrix.
-
Would anyone with access to real tokens/HSMs be willing to try the Node branch and report which operations work or fail?
I'm not asking pkcs11-provider to conform to Node's assumptions. The goal is the opposite: make sure Node's API behavior is aligned with OpenSSL provider semantics and tested against realistic provider-backed keys.
Even short guidance like "this failure is expected", "you should call this EVP operation instead", or "SoftHSM cannot represent this mechanism usefully" would help a lot.
Hello,
I'm working on a Node.js PR to support OpenSSL provider-backed private keys in
node:crypto, withpkcs11-provideras a realistic test case for non-exportable keys whose operations are performed by a token/HSM which we can execute in CI.Node PR: nodejs/node#63949
The intended Node behavior is roughly:
pkcs11:object=...;type=private;CryptoKeywrapping where OpenSSL/provider semantics allow it;We have a local SoftHSM + pkcs11-provider harness covering RSA, RSA-PSS, EC P-256, Ed25519, Ed448, export behavior, WebCrypto wrapping, and some cipher/KEM/ECDH cases. Some things look straightforward, but others are harder to classify as "Node bug", "provider limitation", "token/mechanism limitation", or "expected OpenSSL provider contract".
Current areas where feedback would be especially useful:
Which operations should a consumer reasonably expect from PKCS#11 private keys loaded through STORE?
For example: digest sign vs raw/prehashed sign, RSA-PSS parameters, EdDSA one-shot signing, private decrypt, ECDH, and KEM/decapsulate.
Are failures for private-key export, RSA private decrypt, EC ECDH, or KEM operations expected with the current SoftHSM + pkcs11-provider setup, or are there provider parameters/mechanisms Node should be using differently?
For ECDSA, Node can sometimes recover by using the lower-level prehashed sign/verify path when provider digest-sign is unavailable. Does that match how pkcs11-provider expects consumers to use ECDSA keys, or is there a better EVP-level pattern?
Are there additional key types or operations we should include in the harness?
SM2, DSA, X25519/X448, and eventually PQC keys are all areas where we do not want to make incorrect assumptions from a narrow RSA/EC test matrix.
Would anyone with access to real tokens/HSMs be willing to try the Node branch and report which operations work or fail?
I'm not asking pkcs11-provider to conform to Node's assumptions. The goal is the opposite: make sure Node's API behavior is aligned with OpenSSL provider semantics and tested against realistic provider-backed keys.
Even short guidance like "this failure is expected", "you should call this EVP operation instead", or "SoftHSM cannot represent this mechanism usefully" would help a lot.