I’m rewriting an application so that we can stop using the old Microsoft.Web.Services2.Security.X509 from Microsoft.Web.Services2.dll and start using System.Security.Cryptography.X509Certificates.
There is one method that I can’t figure out, though:
bool Microsoft.Web.Services2.Security.X509.X509Certificate.SupportsDigitalSignature()
I can’t find its equivalent in
System.Security.Cryptography.X509Certificates.X509Certificate2.
Do I even need to test for whether a certificate supports digital signature? I don’t see how it cannot…
First of all the certificate must have a private key in order to be used for signing. Use X509Certificate2.HasPrivateKey property to check this.
Use
X509Certificate2.Extensionsproperty to get access to Key Usage extension. One of key usages is Digital Signature. This is what you are looking for.