Skip to Main Content

Java Card

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JCOP Tools Problem Error code: 6985 (Conditions of use not satisfied)

843851Nov 13 2006 — edited Jul 1 2013
I have a problem with the JCOP tools. I am developing a very simple applet which does nothing at all. It is a "hello world" type applet so that I can get something working. It compiles ok, however as soon as I try to run it under the emulator I get an error.

Status: Conditions of use not satisfied jcshell: Error code: 6985 (Conditions of use not satisfied) jcshell: Wrong response APDU: 6985

This always happens when the jcshell issues the install command.

The install command is:

install -i 1234567890 -t -l -d -m -p -s -b -e -q C9#(1234567890) 1234567890 1234567890

I must be doing something very basic incorrectly. I have tried searching the forums and internet and I haven't found anything. Any help would be appreciated.


The code is this:

/**
*
*/
package pt.microfil.test;

import javacard.framework.*;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.APDU;



public class testcard extends Applet {

final static byte CLASS = (byte) 0x80; // Class of the APDU commands
final static byte INS_READ = (byte) 0x02; // instruction for the READ APDU command

// this is the text string which will send back from the ICC to the IFD
final static byte[] text = {(byte) 'e', (byte) 't', (byte) 's', (byte) ' ',
(byte) 'g', (byte) 'e', (byte) 'h', (byte) 't', (byte) 's', (byte) ' ',
(byte) 'd', (byte) 'e', (byte) 's', (byte) ' ',
(byte) 'G', (byte) 'l', (byte) 'u', (byte) 'm', (byte) 'p'};


public static void install(byte[] bArray, short bOffset, byte bLength) {
// GP-compliant JavaCard applet registration
//new testcard().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
new testcard().register();
}

public static void install() {
new testcard().register();

}

public void process(APDU apdu) {
byte[] cmd_apdu = apdu.getBuffer(); // the cmd_apdu variable is used because of performance reasons

if (cmd_apdu[ISO7816.OFFSET_CLA] == CLASS) { // it is the rigth class
switch(cmd_apdu[ISO7816.OFFSET_INS]) { // check the instruction byte
case INS_READ: // it is a READ instruction
// check if P1=P2=0
if ((cmd_apdu[ISO7816.OFFSET_P1] != 0) || (cmd_apdu[ISO7816.OFFSET_P2] != 0)) {
ISOException.throwIt(ISO7816.SW_WRONG_P1P2);
} // if
// check if P3=length of the text field
short le = (short)(cmd_apdu[ISO7816.OFFSET_LC] & 0x00FF); // calculate Le (expected length)
short len_text = (short)text.length; // the len_text variable is used because of performance reasons
if (le != len_text) {
ISOException.throwIt((short)(ISO7816.SW_CORRECT_LENGTH_00 + len_text)); // give the expected length back to the IFD
} // if
apdu.setOutgoing(); // set transmission to outgoing data
apdu.setOutgoingLength((short)len_text); // set the number of bytes to send to the IFD
apdu.sendBytesLong(text, (short)0, (short)len_text);
break;
default : // the instruction in the command apdu is not supported
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
} // switch
} // if
else { // the class in the command apdu is not supported
ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
}
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 29 2013
Added on Nov 13 2006
2 comments
2,297 views