Hello ,
Sorry my code is working very well, i didn't see i was using again the
public key to decrypt.
it's working only with  RSA/ECB.PKCS1 , not  with RSA/NONE/PKCS11.
Now we wil make the authentication with our Tomcat server , during this
phase some messages sended by the server are more than 128 bytes, i think i
will use RSA to send a 3DES key in order to crypt the message, or i have too
a 64 ko  card that support the RSA 2048, so i don't really need to use the
3DES if i just want to crypt a message of about 150 bytes,
what do you think
thanks 
kind regards ,
Franck





Michael StJohns-2 wrote:
> 
> 
> Sorry - I forgot that from your original posts.
> 
> I do suggest exporting the private key and doing a manual decrypt to find
> out how the card encrypts the data.
> 
> byte[] ciphertext (after the card encrypts your data)
> byte[] privateModulus
> byte[] privateExponent
> 
> BigInteger cipherBig = new BigInteger (1, ciphertext);
> BigInteger modBig = new BigInteger (1, privateModulus);
> BigInteger expBig = new BigInteger (1, privateExponent);
> 
> BigInteger plaintextBig = cipherBig.modpow(expBig, modBig);
> 
> The last 4 octets of plaintextBig.toByteArray() should be your 01 02 03 04
> bytes.  The rest should be the padding.
> 
> Mike
> 
> 
> At 12:27 PM 5/1/2009, jose85 wrote:
> 
>>No my initial text was only 4 bytes array, like in the first post,
>>but once it is crypted by the card the length is 128 bytes .
>>
>>
>>OK - I think I see one more possibility for the problem.  If you're using
>>padding, then the plain text MUST be shorter than the key length to allow
>>for the addition of padding.  Reduce the cipher text by 20 octets and try
>>again.  
>>
>>Mike
>>
>>
>>-- 
>>View this message in context:
http://www.nabble.com/Export-RSA-public-key-out-of-the-card-tp23239829p23335864.html
>>Sent from the MuscleCard mailing list archive at Nabble.com.
>>
>>_______________________________________________
>>Muscle mailing list
>>[email protected]
>>http://lists.drizzle.com/mailman/listinfo/muscle
> 
> 
> _______________________________________________
> Muscle mailing list
> [email protected]
> http://lists.drizzle.com/mailman/listinfo/muscle
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Export-RSA-public-key-out-of-the-card-tp23239829p23385523.html
Sent from the MuscleCard mailing list archive at Nabble.com.

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to