Hello,
I am testing my host apps ability to read public key that was saved in file after being exported from smart card where it was generated.
I have successfully used the private key on card to encrypt a small piece of data and the cryptogram is returned to the host.
On host side I retrieve public key from file and decrypt ciphertext
The on-card alg for Cipher is declared as follows-
RSAcipher = Cipher.getInstance(Cipher.ALG_RSA_PKCS1, true);
and in the host app
Cipher rsaCipher = Cipher.getInstance("RSA","BC");
I can see from what is returned from
byte[] decrypted = rsaCipher.doFinal(this.encryptedData);
that the correct data is being returned, but is is padded by
01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFF00
How do I know where the padding ends and the plaintext begins?
Can anyone help me with this?
Thanks in advance,
Ann