[Muscle] Export RSA public key out of the card
Michael StJohns
mstjohns at comcast.net
Fri May 1 09:41:29 PDT 2009
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
>Muscle at lists.musclecard.com
>http://lists.drizzle.com/mailman/listinfo/muscle
More information about the Muscle
mailing list