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

[iaik-jce] FW: Key Pair problem



Apology for reposting this. There was a problem with the earlier post.
(Probably many will not be able to read that format).

-----Original Message-----
From: Godson Menezes [mailto:gmenezes@medilinq.com]
Sent: Monday, November 15, 1999 8:17 PM
To: 'iaik-jce@iaik.tu-graz.ac.at'
Subject: Key Pair problem


Hi:
	I successfully use the following data to construct a KeyPair
object. This data is generated by a Hardware Encryption Card.

      ---- RSA PCKS#1 Public Key Values...
     Modulus        : [16 bytes]:
                      {0xB8, 0xEC, 0x7B, 0x00, 0x5A, 0x68, 0x8F, 0x9A,
                       0x1C, 0xD7, 0xD8, 0x1D, 0x82, 0x46, 0xA0, 0x9F}
     Modulus Bits   : [ 4 bytes]: [128]
     Public Exponent: [ 3 bytes]:
                      {0x01, 0x00, 0x01}
      ----
      ---- RSA PCKS#1 Private Key Values...
     Modulus n      : [16 bytes]:
                      {0xB8, 0xEC, 0x7B, 0x00, 0x5A, 0x68, 0x8F, 0x9A,
                       0x1C, 0xD7, 0xD8, 0x1D, 0x82, 0x46, 0xA0, 0x9F}
     Public Exponent e: [ 3 bytes]:
                      {0x01, 0x00, 0x01}
     Private Exponent d: [16 bytes]:
                      {0xB0, 0x41, 0xDF, 0x00, 0x3F, 0x00, 0x00, 0x00,
                       0xFF, 0xFF, 0xFF, 0xFF, 0x50, 0x3F, 0xDF, 0x00}
     Prime1 p       : [ 8 bytes]:
                      {0xE7, 0xC9, 0x4E, 0x7C, 0x99, 0xA2, 0xEA, 0xA9}
     Prime2 q       : [ 8 bytes]:
                      {0xCC, 0x3D, 0xEB, 0xCA, 0xBE, 0x68, 0x46, 0x07}
     Exponent1 d mod p-1: [ 8 bytes]:
                      {0x76, 0x81, 0x4A, 0xDA, 0x93, 0xA6, 0x62, 0xF9}
     Exponent2 d mod q-1: [ 8 bytes]:
                      {0x74, 0xDF, 0x62, 0x14, 0x4C, 0x4C, 0xE2, 0xF5}
     Coefficient    : [ 8 bytes]:
                      {0x5C, 0xAF, 0xAA, 0xDF, 0xB4, 0x5D, 0x73, 0x55}

However, when I attempt to sign using the resulting Key I get an
exception As
---------
KeyPair kp= ...
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding", "IAIK");
cipher.init(Cipher.ENCRYPT_MODE, kp.getPrivate());
byte[] enc = cipher.doFinal(data.getBytes());
----------
java.lang.ArithmeticException: BigInteger: modulus not positive
        at java.math.BigInteger.mod(BigInteger.java:490)
        at iaik.security.rsa.RSAPrivateKey.crypt(Unknown Source)
        at iaik.pkcs.pkcs1.RSACipher.a(Unknown Source)
        at iaik.pkcs.pkcs1.RSACipher.engineDoFinal(Unknown Source)
        at javax.crypto.Cipher.doFinal(Unknown Source)
        at keygen.main(Compiled Code)As is evident from the Exception
---------
As is evident from the data above, the Modulus is not positive. Is this
problem due to the incorrect key generated by the card or a acceptance
problem with the IAIK toolkit?

Thank you,
-- Godson

--
Mailinglist-archive at http://jcewww.iaik.tu-graz.ac.at/mailarchive/iaik-jce/maillist.html

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