Hi All,
I am completely fresher to ASN.1 world.
I am trying to encode following ASN.1 structure w.r.t. DER.
I intended to make a CHOICE of "certificates" type.
PKCS15Objects ::= CHOICE {
privateKeys [0] PrivateKeys,
publicKeys [1] PublicKeys,
trustedPublicKeys [2] PublicKeys,
secretKeys [3] SecretKeys,
certificates [4] Certificates,
trustedCertificates [5] Certificates,
usefulCertificates [6] Certificates,
dataObjects [7] DataObjects,
authObjects [8] AuthObjects,
... -- For future extensions
}
Certificates ::= PathOrObjects {CertificateType}
PathOrObjects {ObjectType} ::= CHOICE {
path Path,
objects [0] SEQUENCE OF ObjectType,
...,
indirect-protected [1] ReferencedValue {EnvelopedData {SEQUENCE OF
ObjectType}},
direct-protected [2] EnvelopedData {SEQUENCE OF ObjectType},
}
Path ::= SEQUENCE {
path OCTET STRING,
index INTEGER (0..pkcs15-ub-index) OPTIONAL,
length [0] INTEGER (0..pkcs15-ub-index) OPTIONAL
}( WITH COMPONENTS {..., index PRESENT, length PRESENT}
I think Ill follow as steps mentioned below. (Please correct me if I am
going in wrong way)
1>I create CDF path in OCTET String form.
2> There to are optional, so lets omit them
index INTEGER (0..pkcs15-ub-index) OPTIONAL,
length [0] INTEGER (0..pkcs15-ub-index) OPTIONAL
3> "30" Tag indicates SEQUENCE TAG in ASN.1 representation
4> So now Path would look like
30 [Length of Octet String (path of CDF)] [Value(OCTET
Representation of PATH)]
I don't have any clue to how to proceed further.
Please help me in encoding CHOICE Tag, in above described Example.
And while looking on internet I found following example for encoding CHOICE
type
ExtendedCertificateOrCertificate ::= CHOICE {
certificate Certificate, -- X.509
extendedCertificate [0] IMPLICIT ExtendedCertificate
}
"The identifier octets for the BER encoding are 30 if the chosen alternative
is certificate and a0 if the chosen alternative is extendedCertificate."
Please correct me if I am interpreting this statement wrongly, 1st item of
CHOICE becomes 30 and 2nd item of CHOICE becomes a0 ... But what abt 3rd
4th...10th Item...?
Am I missing something here?
Are there any links where I can see some ASN.1 is encoded in to DER format?
Awaiting for a quick response.
Thanks & Regards,
Chandu
---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.
_______________________________________________
Asn1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1