Hi,

I'm trying to write a 3-DES decoder in Javascript, but I'm dealing
with input generated by other libraries, encoded in ASN.1. I ran
openssl on one of the sample inputs, to decode the ASN.1 for me,
here's the output:

[h-118 test]$ openssl asn1parse -i -inform DER -in dec
0:d=0 hl=2 l=inf cons: SEQUENCE
2:d=1 hl=2 l= 9 prim: OBJECT kcs7-encryptedData
13:d=1 hl=2 l=inf cons: cont [ 0 ]
15:d=2 hl=2 l=inf cons: SEQUENCE
17:d=3 hl=2 l= 1 prim: INTEGER :00
20:d=3 hl=2 l=inf cons: SEQUENCE
22:d=4 hl=2 l= 9 prim: OBJECT kcs7-data
33:d=4 hl=2 l= 35 cons: SEQUENCE
35:d=5 hl=2 l= 10 prim: OBJECT beWithSHA1And3-
KeyTripleDES-CBC
47:d=5 hl=2 l= 21 cons: SEQUENCE
49:d=6 hl=2 l= 16 prim: OCTET STRING [HEX DUMP]:
41547850E21772D405568A3360142909
67:d=6 hl=2 l= 1 prim: INTEGER :01
70:d=4 hl=2 l=inf cons: cont [ 0 ]
72:d=5 hl=2 l= 16 prim: OCTET STRING [HEX DUMP]:
65271944D9552B0D52A817FCE68DB23A
90:d=5 hl=2 l= 8 prim: OCTET STRING [HEX DUMP]:
35BA7C869EFD6D6E
100:d=5 hl=2 l= 0 prim: EOC
102:d=4 hl=2 l= 0 prim: EOC
104:d=3 hl=2 l= 0 prim: EOC
106:d=2 hl=2 l= 0 prim: EOC
108:d=1 hl=2 l= 0 prim: EOC

Now, the 3-DES algorithm which I implemented (pretty standard),
expects a 16 byte key, an 8 byte initialization vector and the
encrypted string itself. How do I find out which of the ASN.1 fields
correspond to the IV and data? How can I generate a 24 bit key from
the salt (some ASN.1 field I can't figure out which) and passphrase?
Also, can I use openssl to decode the input file? If yes, looking at
the openssl code might help me figure things out.

Thanks in advance!
--
Anant

P.S. I'm not on the list, so I would appreciate it if you could Cc me
on any replies.
__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majordomo@openssl.org