JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html
https://ftsafe.en.alibaba.com/index.html
SELECT command
SELECT command
Can we override a select AID command and cause it to pass some data as response data? Thanks for any help.
Re: SELECT command
Can you describe your problem more detailed so that we can provide specific help for you.
Re: SELECT command
Just like this:
Code: Select all
// "some data "
private static final byte[] somedata= new byte[] {
(byte)0x47, (byte)0x72, (byte)0x65, (byte)0x65,
(byte)0x74, (byte)0x69, (byte)0x6E, (byte)0x67,
(byte)0x73, (byte)0x20
};
public void process(APDU apdu) {
// Good practice: Return 9000 on SELECT
if (selectingApplet()) {
response=somedata;
responseApdu=JCSystem.makeTransientByteArray(
(short)(response.length),
JCSystem.CLEAR_ON_DESELECT);
apdu.setOutgoing();
apdu.setOutgoingLength((short)response.length);
apdu.sendBytesLong(responseApdu, (short)0, (short)responseApdu.length);
}
byte[] buf = apdu.getBuffer();
switch (buf[ISO7816.OFFSET_INS]) {
case (byte) 0x00:
break;
default:
// good practice: If you don't know the INStruction, say so:
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
}
}
Re: SELECT command
Your code has told the OS to get ready to send the required data and then keeps executing through to your switch statement which does not understand the INS and throws the appropriate error. Please add a "return" statement after sendBytesLong().
Who is online
Users browsing this forum: No registered users and 38 guests