tags:

views:

84

answers:

3

I need an OID to use to add a custom extension (already ASN1.encoded) to an X.509v3/PKCS#7 digital signature. I don't care if it's interoperable; this is a private proprietary application (actually, a research project). Right now I actually don't even care if it's an OID that's in use in some proprietary application, although obviously I couldn't use that OID for long.

Currently I've been using 1.2.3.4.5, which is in the test code for the crypto library I'm using (cryptlib). However, signature creation is crashing and I don't know if this might be why. I do know that the library rejects at least some invalid OID's when checking inputs.

+2  A: 

I suspect that the problem is that you are not correctly encoding the OID you are using as an ASN.1 OBJECT ID object. I know of Cryptlib but haven't used it so I can't be sure why it's crashing, but I suspect that the reason will be invalid coding rather than just choosing an inappropriate OID value. I doubt that Cryptlib attaches any significance to the OID value you supply (unless, possibly, you supply the OID for a known certificate extenssion such as "basic constraints" with an unexpected value).

I notice from http://www.imc.org/ietf-pkix/pkix-oid.asn that PKIX defines an OID range for testing, and I expect that you will confuse no-one if you (ab)use an oid in that range for your own (internal, unofficial) testing. The testing OIDs are anything starting with 1.3.6.1.5.5.7.13.

I'm a bit concerned by your talk of "an X.509v3/PKCS#7 digital signature" ... X.509 and PKCS#7 are really quite different. I gather from your talk of a custom "Extension" that it's an X.509v3 certificate you're trying to create, not a PKCS#7 signature ... is that correct?

dajames
X.509 versus PKCS#7: what am I really doing? Excellent question! I studied this some more, and I believe that this is what is going on. cryptlib allows me to add additional fields to a digital signature by specifying them as part of an X.509 attribute certificate.(See http://www.tml.tkk.fi/Opinnot/Tik-110.501/2000/papers/nykanen.pdf and http://www.ietf.org/rfc/rfc3281.txt) So I can add custom extensions to a digital signature by adding custom extensions to the X.509 attribute certificate used to specify attributes of the signature.
Paul
So actually, I have a follow-on question. Cryptlib actually accepts the OID separately from the ASN.1. I.e., I perform the following invocation: cryptAddCertExtension( signatureAttributes, "1.2.3.4.5",CRYPT_UNUSED, extensionData, 6 ). Given that, and the fact the the cryptlib example code specifies the OID in the invocation, and ASN.1 is a simple short OCTET STRING with like 4 characters, do you think I'm correct in believing I only need specify the OID in the function invocation? Do you think the fact that my ASN.1 does contain its own field named OID might cause the segfault?
Paul
I sense some confusion. Attribute Certificates and Public Key Certificates are quite different. A PKC identifies the owner of a public keyset, but doesn't tell you much about that owniner apart from a name. An AC tells you things about an entity (role, clearance, etc) and associates that information with a PKC (e.g. by containing the PKC's issuer and serial number). When authenticating with an AC you will have to sign the request to prove your identity, but when signing normal data an AC is not used. Maybe you want to add an Attribute (not AC) to the PKCS#7 SignedData object you create?
dajames
+1  A: 

You can request an "official" private OID here and be safe about collisions in future.

Ken Johnson
+1  A: 

In addition to the (correct) answers by @dajames and @Ken Johnson, you could also use a UUID based OID, if you don't want/need to register a PEN OID (although PEN is probably better in the long run).

Bruno
This might work. It's not clear to me that all requests are approved, and I suspect the ITU might view using this to create a UUID solely for the purpose of creating an OID as abusive.
Paul