Register Login
Internet / AI Technology University (ITU/AITU)
Created by info@itofthefuture.com
Welcome Anonimous.User to this quiz related to Java Card.

Read the question and choose correct answers. Time is limited to 40 seconds!

Important! Do not forget to rank the quality of the question (from bad to excellent).
An initiator of the quiz will get royalty score for QnAs created by her/him and can win the Top Creativity Prize.
Question:
Assuming that no other process-methods are defined, identify correct implementations of the process-method in this applet: public class MyApplet extends Applet { private final OwnerPIN ownerPin; private static final byte VirtualCurrency_CLA = (byte) 0x18; private static final short SW_PIN_VERIFICATION_REQUIRED = 0x6301; private static final short SW_PIN_VERIFICATION_FAILED = 0x6300; private static final byte SELECT_APDU_COMMAND = (byte) (0xA4); // more code here ... }

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



Rank the Quality of the Question from "-10" (bad) or "0" (not clear) to 10 (correct) or even 20 (very good!)
-10 (bad/wrong) 0 (not clear) 10 (correct) 20 (very good!)
Your summary report will be available to you and your instructor. Thank you for your work!!!