在Javacard上使用椭圆曲线DSA中使用getk()时非初始化的密钥例外
尝试在javacard中的密钥对上使用getk()
方法时,我会得到此异常代码:cryptoexception.uninitialized_key
这是我的代码,我在其中生成键对:
KeyPair key = new KeyPair(KeyPair.ALG_EC_FP, (short)256);
key.genKeyPair();
稍后我在我试图运行的代码中
ECPublicKey eCPublicKey = (ECPublicKey) key.getPublic();
short hLeng = eCPublicKey.getK();
,这是我得到异常的时候。我需要做其他事情来启动密钥吗?
When trying to use the getK()
method on a key pair in JavaCard I get this exception code: CryptoException.UNINITIALIZED_KEY
Here is my code where I generate the key pair:
KeyPair key = new KeyPair(KeyPair.ALG_EC_FP, (short)256);
key.genKeyPair();
later on in the code I am trying to run
ECPublicKey eCPublicKey = (ECPublicKey) key.getPublic();
short hLeng = eCPublicKey.getK();
but this is when I get the exception thrown. Is there something else I need to do to init the key?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要初始化域参数A,B,G,K,R和字段。您可以在此处找到NIST推荐曲线的列表: https:/> https:/ /nvlpubs.nist.gov/nistpubs/fips/nist.fips.186-4.pdf
getk()正在抛出一个例外,因为它尚未初始化。
You need to have initialised the domain parameters a, b, g, k, r and the field. You can find a list of NIST recommended curves here: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf
getK() is throwing an exception because it has not been initialised.