使用 Java 卡的 RandonData.getInstance
Using Java Card 's RandonData.getInstance
当我调用以下代码行时,我的小程序崩溃了
RandomData rd = RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);
我得到以下输出:
OffCard Installer [v3.0.2]
Copyright (c) 2009 Sun Microsystems, Inc.
All rights reserved.
Use is subject to license terms.
[ INFO: ] [Creating an instance of ClassicApplet1 with instance ID //aid/E96473AB62/DF on http://localhost:8019/cardmanager]
[ INFO: ] "Off Card Installer validating create information"
[ INFO: ] "Off Card Installer preparing create information"
[ INFO: ] "Off Card Installer sending create request"
[ INFO: ] Create failed: null
run-client:
run-script:
Invoking apdutool on C:\Users\Daniel\Documents\NetBeansProjects\ClassicApplet1/scripts/classicapplet1.scr
ApduTool [v3.0.2]
Copyright (c) 2009 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: 06, e9, 64, 73, ab, 62, df, Le: 00, SW1: 69, SW2: 99
run-for-debug:
BUILD SUCCESSFUL (total time: 25 seconds)
什么是崩溃cause/reason。注意:我是 java 智能购物车生态系统的新手。
Off Card Installer sending create request
怎么了
您的网卡可能不支持RandomData.ALG_SECURE_RANDOM
。
为了证明这一点,尝试用这样的 try-catch 块包围该行:
try {
RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);
} catch(CryptoException e) {
if (e.getReason() != CryptoException.NO_SUCH_ALGORITHM) {
throw e;
}
}
您将不得不使用 RandomData.ALG_PSEUDO_RANDOM
。不幸的是,这个算法的安全性没有保证,所以你必须非常小心,你应该联系你的卡供应商。
当我调用以下代码行时,我的小程序崩溃了
RandomData rd = RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);
我得到以下输出:
OffCard Installer [v3.0.2]
Copyright (c) 2009 Sun Microsystems, Inc.
All rights reserved.
Use is subject to license terms.
[ INFO: ] [Creating an instance of ClassicApplet1 with instance ID //aid/E96473AB62/DF on http://localhost:8019/cardmanager]
[ INFO: ] "Off Card Installer validating create information"
[ INFO: ] "Off Card Installer preparing create information"
[ INFO: ] "Off Card Installer sending create request"
[ INFO: ] Create failed: null
run-client:
run-script:
Invoking apdutool on C:\Users\Daniel\Documents\NetBeansProjects\ClassicApplet1/scripts/classicapplet1.scr
ApduTool [v3.0.2]
Copyright (c) 2009 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: 06, e9, 64, 73, ab, 62, df, Le: 00, SW1: 69, SW2: 99
run-for-debug:
BUILD SUCCESSFUL (total time: 25 seconds)
什么是崩溃cause/reason。注意:我是 java 智能购物车生态系统的新手。
Off Card Installer sending create request
您的网卡可能不支持RandomData.ALG_SECURE_RANDOM
。
为了证明这一点,尝试用这样的 try-catch 块包围该行:
try {
RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);
} catch(CryptoException e) {
if (e.getReason() != CryptoException.NO_SUCH_ALGORITHM) {
throw e;
}
}
您将不得不使用 RandomData.ALG_PSEUDO_RANDOM
。不幸的是,这个算法的安全性没有保证,所以你必须非常小心,你应该联系你的卡供应商。