1

I get this error while trying to set up a DSACryptoServiceProvider to be used for a DSA Signature on a HSM that accepts DSA Signature :

"The specified cryptographic service provider (CSP) does not support this key algorithm."

Call stack :

at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle) at System.Security.Cryptography.DSACryptoServiceProvider.GetKeyPair() at ProjektDemoHSM.Controller.setDSAAlgo(Dictionary`2 listProp) in Controller.cs:line 788

Code :

CSP = new CspParameters(1, "Luna Cryptographic Services for Microsoft Windows");
l.788 : DSAcsp = new DSACryptoServiceProvider(CSP);

And I am sure the CSP accepts DSA as : (I spared you the whole list of supported algorithms)

c:\Program Files\SafeNet\LunaClient\KSP>certutil -csp "Luna Cryptographic Services for Microsoft Windows" -csptest   
  Signature Algorithms:
    DSA

  Asymmetric Algorithms:
    DSA

CertUtil: -csptest command completed successfully.

If anyone had any idea what could cause such an error, I am interessed. FYI, I am running on .NET 3.5, and trying to use an HSM Luna SA. I have no problem using RSACryptoServiceProvider or ECDsaCng, but ``DSA just won't work. Thanks in advance!

Meer
  • 2,765
  • 2
  • 19
  • 28
spock
  • 31
  • 5
  • 1
    You're passing in `1` for the CSP Provider type (the first parameter to `CspParameters`), which is `PROV_RSA_FULL`. Try `13` or `3` instead of 1. – vcsjones Jan 23 '17 at 19:26

0 Answers0