[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] DER encoding an RSAPublicKey

> sorry there was a problem with our mailing list. It should work now again.

I didn't get any response, so maybe I have got to repost my question. Sorry
for eventual repetitions.

----- Original Message -----
From: "Mauro Marini" <mmarini@intesigroup.com>
To: <iaik-jce@iaik.tu-graz.ac.at>
Sent: Wednesday, December 20, 2000 2:45 PM
Subject: [iaik-jce] DER encoding an RSAPublicKey

iaik.security.rsa.RSAPublicKey documentation claims:

PKCS#1 describes a X.509/PEM compatible syntax for RSA public keys to be
used in certificates. The corresponding ASN.1 type RSAPublicKey is defined
 RSAPublicKey ::= SEQUENCE {
   modulus INTEGER, -- n
   publicExponent INTEGER -- e }

Well, if I  use this code:
iaik.security.rsa.RSAPublicKey PubKey1 =
    new iaik.security.rsa.RSAPublicKey (Modulus, Exponent);
ASN1Object asn1object = PubKey1.toASN1Object();
System.err.write( ASN1.print(asn1object).getBytes());

I get:

SEQUENCE[C] = 2 elements
  SEQUENCE[C] = 2 elements
    OBJECT ID = rsaEncryption
    NULL = null
  BIT STRING = 139 byte(s); 0 bit(s) not valid

But this is the DER encoding of the superclass iaik.x509.PublicKeyInfo !
I tried in different ways but that's the result I always get.
OK, I can build the correct SEQUENCE  (INTEGER INTEGER)
by myself, but is this a wanted behaviour or am I doing something wrong?
Is there another straight way to encode an RSAPublicKey?

    thanks, bye

Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-jce/jcethreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-jce