接收SW =`" 6999"," 6422"," 6444"和" 6D00"在NetBeans,CREF和JCWDE的模拟过程中?

时间:2015-03-12 22:07:38

标签: netbeans javacard

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

这是该计划:

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

}

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

enter image description here

问题:

当我按照HelloWorld applet的上述过程进行操作时,在 3 部分(上图中)我的applet AID出现,在 4 部分,模拟器返回SW = 9000响应命令。但对于上述程序,如您所见,既不显示小程序AID,也不显示SW = 9000。为什么呢?

对于HelloWorld小程序,我右键单击默认设备并选择 Console 并发送APDU命令,该卡返回预期的APDU响应。但对于此applet,它仅返回SW=6999。为什么呢?

其他信息:

当我尝试使用 CREF JCWDE 模拟此applet时,我收到了一些不同的状态字:

这是我在下面的模拟中使用的 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:(对于加载上限命令,返回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正在运行(对于加载上限命令,返回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>

这个小程序有什么问题?

请注意,任何使applet更高效的评论也会受到欢迎。

编辑/更新:CREF和JCWDE的输出彼此不同。并且与NetBeans不同。 (我在上一版中错了)

1 个答案:

答案 0 :(得分:1)

可能是支持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。 另外,尝试从头开始重新创建项目。