Retired Microsoft Blog disclaimer

This directory is a mirror of retired "Decrypt My World" MSDN blog and is provided as is. All posting authorship and copyrights belong to respective authors.
Original URL: https://blogs.msdn.microsoft.com/alejacma/2011/11/07/certificate-request-wont-set-key-usage-to-digital-signature-in-enrolled-certificate/
Post name: Certificate request won’t set Key Usage to Digital Signature in enrolled certificate
Original author: Alejandro Campos Magencio
Posting date: 2011-11-07T07:34:20+00:00


Hi all,

The other day a customer of mine was creating certificate requests with a code like the following: How to create a certificate request with CertEnroll and .NET (C#). He wanted to set the certificate's Key Usage to Digital Signature instead of Key Encipherment. So he did something like this in his code:

 objPrivateKey.KeySpec = X509KeySpec.XCN_AT_SIGNATURE; 
 objPrivateKey.KeyUsage = X509PrivateKeyUsageFlags.XCN_NCRYPT_ALLOW_SIGNING_FLAG;

But even after doing that, the enrolled certificate showed Key Encipherment usage.The cause of this was their custom certificate template, which was configured for Key Encipherment instead of Signing, thus overriding the settings we were configuring in our code. We modified the template andthe code worked as expected.

I hope this helps.

Regards,

Alex (Alejandro Campos Magencio)


Share this article:

Comments:

Comments are closed.