Hello,
> I just have one qusetion, I am developing an application that makes
> use of a cryptographic token (cryptocombo2048). The token exports the
> public key to a file in the following format :
>  
> Public Key Label[128byte]
> Public Key ID[128byte]
> Public Key Modulus[128 byte]
> Public Key Exponent[4 bytes]
> Buffer[2 bytes]
> verify[1 byte]
> wrap[1byte]
>  
> Can anyone please direct me as to how to use this public key with
> openssl's rsa algorithm. (i.e. does it need to be reformated? or what
> needs to be done?)
You should convert modulus and exponent to ASN1 format called
SubjectPublicKeyInfo (you may find this in RFC 2459).
Next save to file and use in OpenSSL.

Short example of getting such public key in OpenSSL:
        // key generation
        $ openssl genrsa -out rsa.pem 1024
        // extract public key in PEM form
        $ openssl rsa -in rsa.pem -out rsapub.pem -pubout
        // extract public key in DER form
        $ openssl rsa -in rsa.pem -out rsapub.der -pubout -outform der

        // display ASN1 format
        $ openssl asn1parse -in rsapub.der -inform der
            0:d=0  hl=3 l= 159 cons: SEQUENCE
            3:d=1  hl=2 l=  13 cons: SEQUENCE
            5:d=2  hl=2 l=   9 prim: OBJECT            :rsaEncryption
           16:d=2  hl=2 l=   0 prim: NULL
           18:d=1  hl=3 l= 141 prim: BIT STRING
        // display encoded modulus and public exponent
        $ openssl asn1parse -in rsapub.der -inform der -strparse 18
            0:d=0  hl=3 l= 137 cons: SEQUENCE
            3:d=1  hl=3 l= 129 prim: INTEGER :A903A915C13F1AF044D618 ...
          135:d=1  hl=2 l=   3 prim: INTEGER           :010001

You may encode you modulus and public exponent to this format
using "openssl asn1parse" or Perl or C program or ...

Best regards,
-- 
Marek Marcola <[EMAIL PROTECTED]>

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to