how to export RSA public key from card?
843851Feb 11 2004 — edited Feb 17 2004hi, first, i�m sorry if my english is not very good
i�m using a Cryproflex 32k. First, i�ve generated a RSA pair keys into the card. after that, i would like to export the public key to use into an "standard" aplication (with IAIK).
for this, i�ve tried succesfully to extract exponent & modulus, and i send them to the CAD in two byte arrays, then the external application takes them (supossing the byte arrays to save them are: 'exp' and 'mod')
In IAIK, to construct a RSAPublicKey I need to transform exponent and modulus into BigInteger. I make it this way:
BigInteger bi_exp = new BigInteger(exp);
BigInteger bi_mod = new BigInteger(mod);
then IAIK generates a public key with both values, but when i try to use it for encrypt/decrypt, I get an error:
java.lang.ArithmeticException: BigInteger: modulus not positive
at java.math.BigInteger.modPow(BigInteger.java:1428)
at iaik.security.rsa.RSAPrivateKey.crypt(Unknown Source)
at iaik.pkcs.pkcs1.RSACipher.rawCrypt(Unknown Source)
at iaik.pkcs.pkcs1.RSACipher.b(Unknown Source)
at iaik.pkcs.pkcs1.RSACipher.engineDoFinal(Unknown Source)
at javax.crypto.Cipher.doFinal(DashoA6275)
why modulus sent by the card is not positive? what is wrong about this?
thanks