2
Vote

CreateSelfSignedCertificate on any non-RSA key fails with 'The parameter is incorrect.'

description

This vague error occurs for all CngAlgorithms except RSA:
using (var key = CngKey.Create(CngAlgorithm.ECDsaP521, null, new CngKeyCreationParameters { ExportPolicy = CngExportPolicies.AllowExport, KeyUsage = CngKeyUsages.Signing }))
{
    var test = key.CreateSelfSignedCertificate(new X500DistinguishedName("CN=John Doe"));
}

comments