在使用NetBeans、CREF 和JCWDE 的模拟过程中收到SW=`"6999"、"6422"、"6444" 和"6D00"?

Receiving SW=`"6999", "6422", "6444" and "6D00" in the simulating procedure with NetBeans , CREF and JCWDE?

一个简单的 8 字节随机数生成器程序是用 NetBeans 为 Java 卡片编写的。

这是程序:

public class RandGen extends Applet {
    byte[] generatedArray;
    RandomData randData =   RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);

    private RandGen() {
        generatedArray = JCSystem.makeTransientByteArray((short)8, JCSystem.CLEAR_ON_DESELECT);
    }

    public static void install(byte bArray[], short bOffset, byte bLength)
            throws ISOException {
        new RandGen().register();
    }

    public void process(APDU arg0) throws ISOException {
        byte[] byffer = arg0.getBuffer();
        byte[] generatedRandom = MyGenerator(arg0);
        Util.arrayCopyNonAtomic(generatedRandom, (short) 0, byffer, (short) 0,
                (short) generatedRandom.length);
        arg0.setOutgoingAndSend((short) 0, (short) generatedRandom.length);
    }

    public byte[] MyGenerator(APDU apdu) {
        randData.generateData(generatedArray, (short) 0, (short) 8);
        return generatedArray;
    }

}

我点击锤子按钮来构建项目,然后绿色三角形 运行 模拟器上的项目如下:

问题:

当我对 HelloWorld 小程序执行上述过程时,在 3 部分(上图)我的小程序 AID 出现在 4 模拟器 returns SW=9000 响应命令。但是对于上面的程序,如你所见,既没有出现小程序AID,也没有出现SW=9000。为什么?

对于 HelloWorld 小程序,我右键单击 Default Device 和 select Console 并发送 APDU 命令,然后卡片 returns 预期 APDU 响应。但是对于这个小程序,它 returns SW=6999 而已。为什么?

附加信息:

当我尝试使用 CREFJCWDE 模拟此小程序时,我收到了一些不同的状态词 :

这是我在下面的模拟中使用的 MyScrip.script 文件的内容:

powerup;
// Select the installer applet
0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F;
0x80 0xB0 0x00 0x00 0x00 0x7F;

// randGen/javacard/Header.cap
0x80 0xB2 0x01 0x00 0x00 0x7F;
0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x0A 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x00 0x7F;
0x80 0xBC 0x01 0x00 0x00 0x7F;

// randGen/javacard/Directory.cap
0x80 0xB2 0x02 0x00 0x00 0x7F;
0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x0F 0x00 0x1F 0x00 0x32 0x00 0x0E 0x00 0x51 0x00 0x0A 0x00 0x13 0x00 0x00 0x00 0x83 0x00 0x00 0x00 0x00 0x00 0x00 0x03 0x7F;
0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F;
0x80 0xBC 0x02 0x00 0x00 0x7F;

// randGen/javacard/Import.cap
0x80 0xB2 0x04 0x00 0x00 0x7F;
0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x1F 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x02 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F;
0x80 0xB4 0x04 0x00 0x02 0x00 0x01 0x7F;
0x80 0xBC 0x04 0x00 0x00 0x7F;

// randGen/javacard/Applet.cap
0x80 0xB2 0x03 0x00 0x00 0x7F;
0x80 0xB4 0x03 0x00 0x12 0x03 0x00 0x0F 0x01 0x0B 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x00 0x00 0x00 0x16 0x7F;
0x80 0xBC 0x03 0x00 0x00 0x7F;

// randGen/javacard/Class.cap
0x80 0xB2 0x06 0x00 0x00 0x7F;
0x80 0xB4 0x06 0x00 0x11 0x06 0x00 0x0E 0x00 0x80 0x03 0x02 0x00 0x02 0x07 0x02 0x00 0x00 0x00 0x23 0x00 0x42 0x7F;
0x80 0xBC 0x06 0x00 0x00 0x7F;

// randGen/javacard/Method.cap
0x80 0xB2 0x07 0x00 0x00 0x7F;
0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0x51 0x00 0x02 0x10 0x18 0x8C 0x00 0x03 0x18 0x10 0x08 0x90 0x0B 0x87 0x00 0x18 0x05 0x8D 0x00 0x02 0x87 0x01 0x7A 0x02 0x30 0x8F 0x00 0x04 0x3D 0x8C 0x7F;
0x80 0xB4 0x07 0x00 0x20 0x00 0x05 0x8B 0x00 0x06 0x7A 0x05 0x22 0x19 0x8B 0x00 0x07 0x2D 0x18 0x19 0x8B 0x00 0x08 0x2E 0x1B 0x03 0x1A 0x03 0x1B 0x92 0x8D 0x00 0x09 0x3B 0x19 0x03 0x1B 0x7F;
0x80 0xB4 0x07 0x00 0x14 0x92 0x8B 0x00 0x0A 0x7A 0x04 0x20 0xAD 0x01 0xAD 0x00 0x03 0x10 0x08 0x8B 0x00 0x0B 0xAD 0x00 0x77 0x7F;
0x80 0xBC 0x07 0x00 0x00 0x7F;

// randGen/javacard/StaticField.cap
0x80 0xB2 0x08 0x00 0x00 0x7F;
0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;
0x80 0xBC 0x08 0x00 0x00 0x7F;

// randGen/javacard/ConstantPool.cap
0x80 0xB2 0x05 0x00 0x00 0x7F;
0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x32 0x00 0x0C 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x06 0x81 0x0E 0x00 0x06 0x80 0x03 0x00 0x01 0x00 0x00 0x00 0x06 0x00 0x00 0x01 0x03 0x80 0x03 0x7F;
0x80 0xB4 0x05 0x00 0x15 0x01 0x03 0x80 0x0A 0x01 0x03 0x00 0x00 0x08 0x06 0x80 0x10 0x02 0x03 0x80 0x0A 0x08 0x03 0x81 0x0E 0x01 0x7F;
0x80 0xBC 0x05 0x00 0x00 0x7F;

// randGen/javacard/RefLocation.cap
0x80 0xB2 0x09 0x00 0x00 0x7F;
0x80 0xB4 0x09 0x00 0x16 0x09 0x00 0x13 0x00 0x05 0x0D 0x07 0x31 0x02 0x08 0x00 0x0A 0x05 0x0C 0x08 0x04 0x03 0x07 0x06 0x0A 0x08 0x0D 0x7F;
0x80 0xBC 0x09 0x00 0x00 0x7F;

0x80 0xBA 0x00 0x00 0x00 0x7F;

// Select the installer applet
0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F;
// create RandGen applet
// select RandGen applet
0x00 0xA4 0x04 0x00 0xb 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x00 0x00 0x7F;
0x80 0xB8 0x00 0x00 0xd 0xb 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x00 0x00 0x00 0x7F;

powerdown;

1- CREF 是 运行ning :(Returns SW=9000 对于负载上限命令,但 SW=6D00 和 SW=6444 对于最后的命令)

C:\Java\java_card_kit-2_2_2-rr-bin-windows-do\bin>apdutool.bat C:\Users\AmirEbrahim\Documents\EclipseProjects\RandomGenerator\bin\randGen\javacard\MyScript.script
Java Card 2.2.2 APDU Tool, Version 1.3
Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
Opening connection to localhost on port 9025.
Connected.
Received ATR = 0x3b 0xf0 0x11 0x00 0xff 0x01
CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b0, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b2, P1: 01, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 01, P2: 00, Lc: 17, 01, 00, 14, de, ca, ff, ed, 01, 02, 04, 00, 01, 0a, 01, 02, 03, 04, 05, 06, 07, 08, 09, 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: bc, P1: 01, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b2, P1: 02, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 02, P2: 00, Lc: 20, 02, 00, 1f, 00, 14, 00, 1f, 00, 0f, 00, 1f, 00, 32, 00, 0e, 00, 51, 00, 0a, 00, 13, 00, 00, 00, 83, 00, 00, 00, 00, 00, 00, 03, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 02, P2: 00, Lc: 02, 01, 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: bc, P1: 02, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b2, P1: 04, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 04, P2: 00, Lc: 20, 04, 00, 1f, 03, 03, 01, 07, a0, 00, 00, 00, 62, 01, 01, 03, 01, 07, a0, 00, 00, 00, 62, 01, 02, 00, 01, 07, a0, 00, 00, 00, 62, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 04, P2: 00, Lc: 02, 00, 01, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: bc, P1: 04, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b2, P1: 03, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 03, P2: 00, Lc: 12, 03, 00, 0f, 01, 0b, 01, 02, 03, 04, 05, 06, 07, 08, 09, 00, 00, 00, 16, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: bc, P1: 03, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b2, P1: 06, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 06, P2: 00, Lc: 11, 06, 00, 0e, 00, 80, 03, 02, 00, 02, 07, 02, 00, 00, 00, 23, 00, 42, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: bc, P1: 06, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b2, P1: 07, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 07, P2: 00, Lc: 20, 07, 00, 51, 00, 02, 10, 18, 8c, 00, 03, 18, 10, 08, 90, 0b, 87, 00, 18, 05, 8d, 00, 02, 87, 01, 7a, 02, 30, 8f, 00, 04, 3d, 8c, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 07, P2: 00, Lc: 20, 00, 05, 8b, 00, 06, 7a, 05, 22, 19, 8b, 00, 07, 2d, 18, 19, 8b, 00, 08, 2e, 1b, 03, 1a, 03, 1b, 92, 8d, 00, 09, 3b, 19, 03, 1b, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 07, P2: 00, Lc: 14, 92, 8b, 00, 0a, 7a, 04, 20, ad, 01, ad, 00, 03, 10, 08, 8b, 00, 0b, ad, 00, 77, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: bc, P1: 07, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b2, P1: 08, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 08, P2: 00, Lc: 0d, 08, 00, 0a, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: bc, P1: 08, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b2, P1: 05, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 05, P2: 00, Lc: 20, 05, 00, 32, 00, 0c, 02, 00, 00, 00, 02, 00, 00, 01, 06, 81, 0e, 00, 06, 80, 03, 00, 01, 00, 00, 00, 06, 00, 00, 01, 03, 80, 03, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 05, P2: 00, Lc: 15, 01, 03, 80, 0a, 01, 03, 00, 00, 08, 06, 80, 10, 02, 03, 80, 0a, 08, 03, 81, 0e, 01, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: bc, P1: 05, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b2, P1: 09, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 09, P2: 00, Lc: 16, 09, 00, 13, 00, 05, 0d, 07, 31, 02, 08, 00, 0a, 05, 0c, 08, 04, 03, 07, 06, 0a, 08, 0d, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: bc, P1: 09, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: ba, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00
CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, 01, 02, 03, 04, 05, 06, 07, 08, 09, 00, 00, Le: 00, SW1: 6d, SW2: 00
CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0d, 0b, 01, 02, 03, 04, 05, 06, 07, 08, 09, 00, 00, 00, Le: 00, SW1: 64, SW2: 44

2- JCWDE 是 运行ning :(Returns SW=6421 对于负载上限命令,SW=6d00 和 SW=6444 对于最后的命令)

C:\Java\java_card_kit-2_2_2-rr-bin-windows-do\bin>apdutool.bat C:\Users\AmirEbrahim\Documents\EclipseProjects\RandomGenerator\bin\randGen\javacard\MyScript.script
Java Card 2.2.2 APDU Tool, Version 1.3
Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
Opening connection to localhost on port 9025.
Connected.
Received ATR = 0x3b 0xf0 0x11 0x00 0xff 0x00
CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b0, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b2, P1: 01, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00
CLA: 80, INS: b4, P1: 01, P2: 00, Lc: 17, 01, 00, 14, de, ca, ff, ed, 01, 02, 04, 00, 01, 0a, 01, 02, 03, 04, 05, 06, 07, 08, 09, 00, Le: 00, SW1: 64, SW2: 3a
CLA: 80, INS: bc, P1: 01, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b2, P1: 02, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 02, P2: 00, Lc: 20, 02, 00, 1f, 00, 14, 00, 1f, 00, 0f, 00, 1f, 00, 32, 00, 0e, 00, 51, 00, 0a, 00, 13, 00, 00, 00, 83, 00, 00, 00, 00, 00, 00, 03, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 02, P2: 00, Lc: 02, 01, 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: bc, P1: 02, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b2, P1: 04, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 04, P2: 00, Lc: 20, 04, 00, 1f, 03, 03, 01, 07, a0, 00, 00, 00, 62, 01, 01, 03, 01, 07, a0, 00, 00, 00, 62, 01, 02, 00, 01, 07, a0, 00, 00, 00, 62, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 04, P2: 00, Lc: 02, 00, 01, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: bc, P1: 04, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b2, P1: 03, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 03, P2: 00, Lc: 12, 03, 00, 0f, 01, 0b, 01, 02, 03, 04, 05, 06, 07, 08, 09, 00, 00, 00, 16, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: bc, P1: 03, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b2, P1: 06, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 06, P2: 00, Lc: 11, 06, 00, 0e, 00, 80, 03, 02, 00, 02, 07, 02, 00, 00, 00, 23, 00, 42, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: bc, P1: 06, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b2, P1: 07, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 07, P2: 00, Lc: 20, 07, 00, 51, 00, 02, 10, 18, 8c, 00, 03, 18, 10, 08, 90, 0b, 87, 00, 18, 05, 8d, 00, 02, 87, 01, 7a, 02, 30, 8f, 00, 04, 3d, 8c, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 07, P2: 00, Lc: 20, 00, 05, 8b, 00, 06, 7a, 05, 22, 19, 8b, 00, 07, 2d, 18, 19, 8b, 00, 08, 2e, 1b, 03, 1a, 03, 1b, 92, 8d, 00, 09, 3b, 19, 03, 1b, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 07, P2: 00, Lc: 14, 92, 8b, 00, 0a, 7a, 04, 20, ad, 01, ad, 00, 03, 10, 08, 8b, 00, 0b, ad, 00, 77, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: bc, P1: 07, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b2, P1: 08, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 08, P2: 00, Lc: 0d, 08, 00, 0a, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: bc, P1: 08, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b2, P1: 05, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 05, P2: 00, Lc: 20, 05, 00, 32, 00, 0c, 02, 00, 00, 00, 02, 00, 00, 01, 06, 81, 0e, 00, 06, 80, 03, 00, 01, 00, 00, 00, 06, 00, 00, 01, 03, 80, 03, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 05, P2: 00, Lc: 15, 01, 03, 80, 0a, 01, 03, 00, 00, 08, 06, 80, 10, 02, 03, 80, 0a, 08, 03, 81, 0e, 01, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: bc, P1: 05, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b2, P1: 09, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: b4, P1: 09, P2: 00, Lc: 16, 09, 00, 13, 00, 05, 0d, 07, 31, 02, 08, 00, 0a, 05, 0c, 08, 04, 03, 07, 06, 0a, 08, 0d, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: bc, P1: 09, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 80, INS: ba, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 64, SW2: 21
CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00
CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, 01, 02, 03, 04, 05, 06, 07, 08, 09, 00, 00, Le: 00, SW1: 6d, SW2: 00
CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0d, 0b, 01, 02, 03, 04, 05, 06, 07, 08, 09, 00, 00, 00, Le: 00, SW1: 64, SW2: 44

C:\Java\java_card_kit-2_2_2-rr-bin-windows-do\bin>

这个小程序有什么问题?

请注意,任何使小程序更高效的评论也将不胜感激。

Edit/Update:CREF和JCWDE的输出是不一样的。并且与 NetBeans 也不同。 (上一版我错了)

也许这是支持 ALG_SECURE_RANDOM 的模拟器限制问题。

请尝试 ALG_PSEUDO_RANDOM

来自Class RandomData

ALG_PSEUDO_RANDOM

Utility pseudo-random number generation algorithms. The random number sequence generated by this algorithm need not be the same even if seeded with the same seed data.

Even if a transaction is in progress, the update of the internal state shall not participate in the transaction. 

ALG_SECURE_RANDOM

加密安全随机数生成算法。

P.S。 另外,尝试从头开始重新创建项目。