Andrus, as Stephen explains the key is represented in an ASN.1 structure called "SubjectPublicKeyInfo" and is coded in DER (Distinguished Encoding Rules). The structure consits of an ObjectIdentifier ([06 09] 2A...01 01 01) and the parameter NULL ([05 00]) followed by the public modulus of your key. The "footer" ([02 01] 03) is your public exponent (in ASN.1, BER coded)
Regards Thomas > -----Ursprüngliche Nachricht----- > Von: Andrus [mailto:[EMAIL PROTECTED] > Gesendet: Dienstag, 14. Dezember 2004 22:29 > An: [EMAIL PROTECTED] > Betreff: Re: DER public key file structure > > > Charles, > > thank you for reply. I studied those documents carefully bot > havent found > yet a solution. > rfc3280.txt appendix C does not describe public key format. > PKCS #1 v2.1: RSA Cryptography Standard does not not describe > data storage > exact format. > > The hex dump of my public.der file looks like: > > 00: 30 81 9D 30 0D 06 09 2A ¦ 86 48 86 F7 0D 01 01 01 > 0üØ0. *åHå"... > 10: 05 00 03 81 8B 00 30 81 ¦ 87 02 81 81 00 B0 6D 8D > ür 0ücüü _mZ > 20: 8D 76 FB DA B6 91 A2 EA ¦ 11 DB 8A C2 92 AC 50 59 > Zv¹-CæóL-R-ƼPY > 30: 83 30 39 87 F7 51 5C 1B ¦ F5 1B 5C 4D 83 5C 71 A4 > a09c"Q\§\Ma\qz > 40: 5D 19 B2 1F 24 2E 0B 7F ¦ 5E C1 CF E9 93 3D F3 7B ]_$. > ^-Zko=¾{ > 50: 1B 1F 60 74 B5 68 93 83 ¦ F4 C8 55 18 3E BB 97 73 > `tAhoa¶+U>+Ss > 60: BC 8C 27 8E 70 7C 89 13 ¦ 26 B0 13 55 57 67 F7 3E > +i'Äp|e&_UWg"> > 70: 6B 07 FA C9 58 57 36 0E ¦ D7 9D 5A 24 A3 4A F5 8A > k·+XW6uØZ$ZJ§R > 80: D5 A3 62 A1 C2 18 12 90 ¦ 35 85 F7 34 18 BD 1D F1 > sZbI-É5g"4I± > 90: 37 5C 0D 29 48 E2 C7 FC ¦ 6A AD 55 D2 EB 02 01 03 > 7\)HOU³jLUel > > The 1024 bit modulus starts at bytes 00 B0 6D and ends with > 55 D2 EB > > After that It seems that 02 01 03 is constant suffix at the > end of .der > file. > > What is the meaning of the file header bytes ? > Where the modulus length is stored ? > Where is the publix exponent (03) stored ? > > Can you point me any documentation of the openssl source code > file where I > can find information about this format ? > > Thanks, > > Andrus. > > ----- Original Message ----- > From: "Charles B Cranston" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, December 14, 2004 10:35 PM > Subject: Re: DER public key file structure > > > > DER is short for ASN.1 Distinguished Encoding Rules. The actual > > format of certificates and things are standardized by X.500 but > > these documents are expensive, so the Internet RFC people have > > reprinted the information in a series of documents. Take a look > > at ftp://www.ietf.org/rfc/rfc3280.txt particularly the examples > > in Appendix C for the DER formats for certificates. > > > > As for keys, I think the standards document are the PKCS documents > > which can be found at http://www.rsasecurity.com/rsalabs > > look on the left for PKCS and get PKCS #1 RSA Cryptography Standard. > > Look in chapter 11 ASN.1 syntax > > 11.1 Key representations > > 11.1.1 Public-key syntax > > > > I think this is right -- good luck! > > > > Andrus wrote: > > > I need to decrypt RSA signature using RSA public key. > > > Thanks to Nils Larsch reply I discovered that the > following command can > be > > > used for this: > > > > > > openssl rsautl -verify -in sig.bin -inkey public.der > -pubin -keyform > > > DER -out signout.bin > > > > > > I have a RSA 1024 bits modulus and exponent 3 > > > > > > I need to create a public.der file (160 bytes) from this > data to be > passed > > > to openssl using not a C language. > > > > > > I looked into openssl sources but havent yet found DER > file structure > > > description. > > > > > > Where I can found the DER public file structure > description which this > > > command accepts ? > > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List [EMAIL PROTECTED] > Automated List Manager [EMAIL PROTECTED] > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]