在JCIDE中调试时,在安装.cap文件时遇到错误'6985''6A88'

时间:2015-04-03 05:56:10

标签: java debugging applet ide javacard

我正在使用JCIDE调试其示例applet- walletdemo。

我输入错误6985

  

条件不满足'和6A88'参考数据或参考数据   找不到

在调试时在 JCVM 上安装 .cap 文件期间。但我不知道什么是错的,该怎么做。

以下是applet的一部分:

private WalletDemoApplet(byte bArray[], short bOffset, byte bLength)
{
   /* cardid=new byte[MAX_NUM_CARDID];
    key  =new byte[MAX_NUM_KEYS];
    for (byte i = 0; i < MAX_NUM_KEYS; i++)
        key[i] =i;
    for (byte i = 0; i < MAX_NUM_CARDID; i++)
        cardid[i] =i;*/

    balance  = 0;
    integral = 0;


    Key = (DESKey)KeyBuilder.buildKey(KeyBuilder.TYPE_DES, KeyBuilder.LENGTH_DES3_2KEY, false);         
    //cipherDES_ECB_NOPAD = Cipher.getInstance(Cipher.ALG_DES_ECB_NOPAD, false);
    cipherDES_ECB_NOPAD = Cipher.getInstance(Cipher.ALG_DES_CBC_ISO9797_M1, false);
    myRandomS = RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);

    pin = new OwnerPIN(PIN_TRY_LIMIT,   MAX_PIN_SIZE);
    cardID = new byte[10];
    output = new byte[16];
    //input = new byte[16];
    bRand = false;
    ExternalMark=false;
    verifyMark=false;
    byte iLen = bArray[bOffset]; // aid length
    bOffset = (short) (bOffset+iLen+1);
    byte cLen = bArray[bOffset]; // info length
    bOffset = (short) (bOffset+cLen+1);
    byte aLen = bArray[bOffset]; // applet data length
    bOffset = (short)(bOffset+1);        
    byte pinLen = bArray[bOffset];


    // The installation parameters contain the PIN
    // initialization value
    pin.update(bArray, (short)(bOffset+1), pinLen);

    // Initialize key
    bOffset = (short)(bOffset+pinLen+1);
    byte keyLen = bArray[bOffset];
    Key.setKey(bArray, (short)(bOffset+1));

    // Initialize cardID
    bOffset = (short)(bOffset+keyLen+1);
    byte idLen = bArray[bOffset];
    Util.arrayCopy(bArray, (short)(bOffset+1), cardID, (short)0, (short)idLen); 

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

}

2 个答案:

答案 0 :(得分:4)

如果问题不是由算法引起的,可能是因为安装时需要安装参数。您可以尝试设置安装参数,例如“08112233445566778810404142434445464748494A4B4C4D4E4F080010203040506070”。

我希望我能帮助你。

答案 1 :(得分:1)

@TheGoodUser

第一季度和第三季度:即08112233445566778810和080010203040506070.我基于此代码,

// The installation parameters contain the PIN
// initialization value
pin.update(bArray, (short)(bOffset+1), pinLen);

// Initialize key
bOffset = (short)(bOffset+pinLen+1);
byte keyLen = bArray[bOffset];
Key.setKey(bArray, (short)(bOffset+1));

// Initialize cardID
bOffset = (short)(bOffset+keyLen+1);
byte idLen = bArray[bOffset];
Util.arrayCopy(bArray, (short)(bOffset+1), cardID, (short)0, (short)idLen); 

需要三个参数:PIN,密钥和cardID。

只要Tag-Len-Value格式,这些数字可以是其他数字。

具体您可以看到&#34; GlobalPlatform规范&#34;。