>On Tue 10/02/09 10:53 PM , Michael Sierchio ku...@tenebras.com sent: >Tomasz Kaźmierczak wrote: >> I've managed to base64 decode a public key (at least I think so;). >> Now I'm trying to understand how to interpret the key data. I've found the >> definitions of RSAPublicKey and RSAPrivateKey structures (in the >> "PKCS #1: RSA Cryptography Standard"), but there is no information >> about what are the lengths of those structures' fields. > >You should locate and follow one of the ASN.1 tutorials floating >about on the web before proceeding any further. The syntax of >the representation contains tags that identify to contents of >components of an object, and their length in octets. And more, >sometimes. ;-)
I'm assuming Tomasz has access to the openssl binary!? Use the asn1parse option to decode the key data from PEM format. Use 'openssl asn1parse -inform PEM -in your-key-file-name' and this will dump a file. This is a certificate rather than a key file: OpenSSL> asn1parse -inform PEM -in enc-root.pem -dump 0:d=0 hl=4 l= 495 cons: SEQUENCE 4:d=1 hl=4 l= 344 cons: SEQUENCE 8:d=2 hl=2 l= 3 cons: cont [ 0 ] 10:d=3 hl=2 l= 1 prim: INTEGER :02 13:d=2 hl=2 l= 17 prim: INTEGER :EC7F6C3FF7F74C7A856FB59A6941F2C 32:d=2 hl=2 l= 13 cons: SEQUENCE 34:d=3 hl=2 l= 9 prim: OBJECT :sha1WithRSAEncryption etc... Carl ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org