For example:
Code: Select all
30450221008443B0B08EACBF7B4F718AF441154CE79391AC2206715A13950DBDF65E2004A2022041C8086F556D4BD4F5B0B87412A3982F75C12447901886BE01F0EBC44C937B2E
My code
Code: Select all
private void processSign(APDU apdu) {
byte[] apduBuffer = apdu.getBuffer();
apdu.setIncomingAndReceive();
try {
privateKey.setS(privateKeyDigest, (short) 0, PRIVATE_KEY_LENGTH);
signature.init(privateKey, Signature.MODE_SIGN);
byte[] tempBuffer = JCSystem.makeTransientByteArray(SIGN_BUFFER_LENGTH, JCSystem.CLEAR_ON_DESELECT);
short len = signature.sign(hashDigest, (short) 0, HASH_LENGTH, tempBuffer, SIGN_BUFFER_OFFSET);
Util.arrayCopyNonAtomic(tempBuffer, (short) 0, apduBuffer, (short) 0, len);
apdu.setOutgoingAndSend((short) 0, len);
} catch (CryptoException e) {
ISOException.throwIt(e.getReason());
} catch (SystemException e) {
ISOException.throwIt(e.getReason());
}
}
Thanks, for help!