views:

636

answers:

3

We have been handed a set of test sertificates on smart cards for developing a solution that requires XML messages to be signed using PKI. Each (physical) smart card seems to have two certificates stored on it. I import them into the Windows certificate store using software supplied by the smart card provider, and then use code resembling the following to iterate over the installed certificates:

foreach (X509Certificate2 x509 in CertStore.Certificates) {
  foreach (X509Extension extension in x509.Extensions) {
     if (extension.Oid.Value == "one we are interested in") {
        X509KeyUsageExtension ext = (X509KeyUsageExtension)extension;
        if ((ext.KeyUsages & X509KeyUsageFlags.DigitalSignature) != X509KeyUsageFlags.None) {
            // process certs here

We have been told to use the certificates that have the NonRepudiation key usage flag set to sign the XMLs. However, the certificate that has the NonRepudiation flag has this flag only, and not for instance the DigitalSignature flag which I check for above. Does this strike anyone but me as slightly odd? I am in other words told to sign with a certificate that does not (appear to) have the DigitalSignature usage flag set. Is this normal procedure? Any comments?

Thanks.

+1  A: 

What key use does it have? You're right, this is a little odd, however if, for example, the key was used to provide AD logins then it may not have the flags set for DigitalSignature use. That's not to say you can't use it for that, it just indicates that the certificate issuer provides no guarantee when you go outside the key's indicated usage.

blowdart
The one with the NonRepudiation flag set has *only* that flag, and this is what occurs as odd to me (given that I'm explicitly told to use that one for signing), however, I'm far from an expert in this field so I thought it best to ask around :)
Eyvind
By the way; these certificates are generated specifically for this purpose, and are not intended for AD logins etc.
Eyvind
Well that is a little weird, it ought to have both, but that depends on the policy of the issuer. The flags really are indicators of use, but it's up to you to decide if you should approve or reject certificates based upon them
blowdart
A: 

As I read RFC 5280 (4.2.1.3), nonRepudiation is a superset of digitalSignature. In other words it grants all the abilities of digitalSignature and then some. So technically, what they are asking for is valid, though perhaps unusual.

Von
+1  A: 

If you want to provide a non-repudiation service, i.e. you want signatures have a LEGAL value, then you are supposed to use nonRepudiation only. Indeed, this is RECOMMENDED by standards (see ETSI TS 102 280) since the usage of other keyUsage bits together with nonRepudation may have security issues.

G.P.
Thanks for clearing that up, and for getting back to this question after such a long time :) +1
Eyvind