Hello ,
I have exported the public key of my cyberflex 32k card
by sending the values of the modulus and the exponent to the pc, i put these
values into 2 arrays of bytes (the card sent a exp which size is 3 bytes and
a mod of 128 bytes)
i have converted the bytes arrays of the "exp" and the "mod" into Biginteger
like it suggerated in the java doc
but the the message encrypted is different all the time whereas the modulus
and the exponent received from the card are all time the same,
here is the snippet of the code that make problem:
BigInteger Exp = new BigInteger(1, exp);
BigInteger Mod = new BigInteger(1, mod);
RSAPublicKeySpec pubKeySpec;
KeyFactory keyFactory;
PublicKey pubKey;
try {
cipher =Cipher.getInstance("RSA/ECB/PKCS1Padding");
pubKeySpec = new RSAPublicKeySpec(Mod,Exp);
keyFactory = KeyFactory.getInstance("RSA");
pubKey = keyFactory.generatePublic(pubKeySpec);
cipher.init(Cipher.ENCRYPT_MODE,pubKey);
byte[] env={0x01,0x02,0x03,0x04};
byte[] encrypted = cipher.doFinal(env);
/* for (int j= 0; j<128; j++)
System.out.println(encrypted[j]); */
so of course when i send this encrypted array to the card she isn't able to
decrypt it : --------> erreur 6F00
note that the encryption an decryption work well in the card , but not if i
crypt on the pc
it's a java problem , but if you have any other solution in order to use the
public key of the card i'm interested
thanks
kind regards ,
Franck
--
View this message in context:
http://www.nabble.com/Export-RSA-public-key-out-of-the-card-tp23239829p23239829.html
Sent from the MuscleCard mailing list archive at Nabble.com.
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle