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

[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 !

OK, I can build the correct SEQUENCE by myself, but is this a wanted
behaviour or a problem? Is there another straight way to encode an

    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