Error 6F00 when generating and verifying a signature
Posted: Wed Aug 16, 2017 11:11 pm
I am going to generate and verify a signature for some dummy data on a Java Card. It's strange that I always got error code 6F00. I also tried to debug the applet to confirm where the problem is, but failed. Any clue?
Code: Select all
private void signIt(APDU apdu) {
byte[] buffer = apdu.getBuffer();
RSASign = Signature.getInstance(Signature.ALG_RSA_MD5_PKCS1, true);
RSASign.init(priv, Signature.MODE_SIGN);
byte[] inputData = {0x01, 0x02, 0x03};
byte[] sig_buffer = new byte[50];
//ISOException.throwIt((short)0x1234); is thrown here
RSASign.sign(inputData, (short)0, (short)(inputData.length), sig_buffer, (short)0);
//ISOException.throwIt((short)0x1234); not thrown anymore - Instead 6F00 is thrown
Sig = sig_buffer;
}
private void verifyIt(APDU apdu) {
byte[] buffer = apdu.getBuffer();
byte[] inputData = {0x01, 0x02, 0x03};
// sigOffset correct?
if (RSASign.verify(inputData, (short)0, (short)(inputData.length), realSig,
(short)0, (short)(realSig.length)) != true) {
ISOException.throwIt(SW_WRONG_SIGNATURE); //unknown error thrown again
}
}