在Javacard上使用椭圆曲线DSA中使用getk()时非初始化的密钥例外

发布于 2025-01-26 06:23:13 字数 405 浏览 4 评论 0原文

尝试在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑着哭最痛 2025-02-02 06:23:13

您需要初始化域参数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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文