Javacard上的椭圆曲线DSA-我还需要最初的内容?

发布于 2025-01-26 19:55:27 字数 526 浏览 3 评论 0原文

我正在尝试在Javacard上实施ECDSA。到目前为止,我有此代码:

Signature sig = Signature.getInstance(Signature.ALG_ECDSA_SHA_256, false);
KeyPair key = new KeyPair(KeyPair.ALG_EC_FP, (short)256);
key.genKeyPair();
sig.init(key.Private(), Signature.MODE_SIGN);
sig.sign(data, (short)0, dataLen, outputBuf, (short)0);

当我尝试使用getk()方法退休K时,以便我可以在APDU中发送公共密钥,我会得到错误代码6f 00。

根据文档<代码> getk()可以扔cryptoexception.uninitialized_key如果键曲线的固定点g的“ cofactor”尚未成功初始化

'设置密钥/签名时需要初始化吗?

I am trying to implement ECDSA on JavaCard. So far I have this code:

Signature sig = Signature.getInstance(Signature.ALG_ECDSA_SHA_256, false);
KeyPair key = new KeyPair(KeyPair.ALG_EC_FP, (short)256);
key.genKeyPair();
sig.init(key.Private(), Signature.MODE_SIGN);
sig.sign(data, (short)0, dataLen, outputBuf, (short)0);

When I try to retire K using the getK() method so that I can send the public key in an APDU I get the error code 6F 00.

According to the documentation getK() can throw CryptoException.UNINITIALIZED_KEY if the 'cofactor of the order of the fixed point G of the curve of the key has not been successfully initialized'

Is there something else I need to initialise when setting up the keys/signature?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

故人爱我别走 2025-02-02 19:55:28

您需要初始化域参数:A,B,G,R,K和字段。对于建议曲线的NIST列表,您可以在此处查看: https”> https: //nvlpubs.nist.gov/nistpubs/fips/nist.fips.186-4.pdf

You need to initialise the domain parameters: A,B, G, R, K and the field. For a list of NIST recommended curves you can look here: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf

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