Subject: ASN.1 question to PKIHeader in CMP (RFC 2510)

From: Anette Byskov <[email-masked]>
Date: Mon, 15 Nov 1999 15:30:39 +0100

This is a pure and somewhat trivial ASN.1 tagging question but I hope
some knowledgeable people will help my anyway :-)

In the PKIHeader in Certificate Management Protocols the sender and
recipient are GeneralName SEQUENCES. In GeneralName the tagging is
IMPLICIT - except for the directoryName which is promoted to EXPLICIT as
Name is a Choice. Right? So if you set the directoryName in the sender
and/or recipient you get an encoding like A4 xx 30 .. for that component
within the PKIHeader encoding.
But how do you distinguish between this and the transactionID which also
has an explicit tag [4] (resulting in an encoding like A4 xx 04 ..)?  
Ought the two outer tags not be different?

Regards,
Anette
-- 
Anette Byskov                          Cryptomathic A/S
Phone:  +45 86 13 90 20                Klostergade 28
Fax:    +45 86 20 29 75                DK-8000 Aarhus C
http://www.cryptomathic.dk/            Denmark

---

From: "Salter, Thomas A" <[email-masked]>
Date: Mon, 15 Nov 1999 09:58:24 -0500

There's no ambiguity because the sender and recipient fields are not
optional;  they will always be the second and third elements in the
sequence.  So, you could end up with a sequence containing elements like
this:
   Sequence {
	INTEGER
	[4] sender-DN
	[4] recipient-DN
	[4] transaction ID
	}

 > -----Original Message-----
 > From: Anette Byskov [mailto:[email-masked]]
 > Sent: Monday, November 15, 1999 9:31 AM
 > To: [email-masked]
 > Subject: ASN.1 question to PKIHeader in CMP (RFC 2510) 
 > 
 >

---

From: Darren Harter <[email-masked]>
Date: Mon, 15 Nov 1999 15:15:10 -0000

Anette,

The important thing to remember here is that the sender and recipient are not OPTIONAL in the definition of PKIHeader, so they will always appear in the encoding.  So if you chose Name's for the sender and recipient then the encoding would begin:  30 ... 02 ... A4 ... A4 ....  This would then be followed by the OPTIONAl elements in the order shown in the definition..  So if you didn't have a messageTime, protectionAlg, senderKID or recipKID in your PKIHeader you encoding would begin 30 ... 02 ... A4 .. A4 ... 84 ...

Here the first A4 is the sender, the second A4 is the recipient and the 84 is the transactionID.  Note the use of 84 here not A4.  The reason that you have 84 for transactionID is that OCTET STRING are not a constructed type (they do not hold other ASN.1 elements*) where as Name (or more specifically RDNSequence) is a constructed type. The 6th bit is only set for constructed types.

Hope this helps,

Darren

p.s. * For the ASN.1 pedants, I'm aware that octet strings can be constructed when encoded using BER, and that they are often used to hold ASN.1-encoded data internally.  The description above is intended to be descriptive not prescriptive.

-------------------------------------------
Darren Harter B.Sc. (Hons) MBCS CEng
Application Development Group, UK
Entegrity Solutions Corp
Tel: +44 (0) 1452 371383
Fax: +44 (0) 1452 371384
Cell: +44 (0) 7801 812850
Mail: <mailto:[email-masked]>
Web: <http://www.entegrity.com>

-----Original Message-----
From:	Anette Byskov [SMTP:[email-masked]]
Sent:	15 November 1999 14:31
To:	[email-masked]
Subject:	ASN.1 question to PKIHeader in CMP (RFC 2510) 

Regards,
Anette