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
}
}