// the used ISO7816 fields are all valid public void process(APDU apdu) throws ISOException { byte[] buffer = apdu.getBuffer(); // .. process the incoming data and reply if (buffer[ISO7816.OFFSET_CLA] == (byte) 0) { switch (buffer[ISO7816.OFFSET_INS]) { case ISO7816.INS_SELECT: //... // send response data to select command short Le = apdu.setOutgoing(); // assume data containing response bytes in // replyData[] array. if ( Le < 5) ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); apdu.setOutgoingLength((short) replyData.length ); apdu.sendBytesLong(replyData, (short) 0, (short)replyData.length); break; // possibly more case statements } } }
public void process(APDU apdu) {}
public void process() {}
public void process(APDU apdu) { super.process(apdu); }
public void process(APDU apdu) { byte[] byteArray = apdu.getBuffer();
// the field OFFSET_CLA is a byte if (byteArray[ISO7816.OFFSET_CLA] == SELECT_APDU_COMMAND) { return; }
if (byteArray[ISO7816.OFFSET_CLA] != VirtualCurrency_CLA) { return; }
if (!ownerPin.isValidated()) { ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED); }
// perform requested service /* * assume that the service methods called in here are defined in this * class! The ISO7816 fields used in here are all valid as well. */ switch (byteArray[ISO7816.OFFSET_INS]) { case CHECK_PIN: checkPIN(apdu); break;
case GET_ALL_GROUP_PRIVILEGES: getAllGroupPrivileges(apdu); break;
case GET_GROUP_ROLES: getGroupRoles(apdu); break;
case SET_GROUP_ROLES: setGroupRoles(apdu); break;
case GET_VIRTUAL_SCORE: getVirtualScore(apdu); break;
case ADD_SCORE: addScore(apdu); break;
case SUBTRACT_SCORE: subtractScore(apdu); break;
case GET_IDENTITY: getIdentity(apdu); break;
default: ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); } }
public boolean process() { return false; }
|