Java中ECC的实现

发布于 2024-09-03 09:00:00 字数 537 浏览 3 评论 0原文

在尝试使用 Java 中的椭圆曲线加密术加密给定输入时,我使用以下算法来生成密码和密钥:

KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA"); Cipher cipher = Cipher.getInstance("ECIES");

现在,正如预期的那样,密码不接受 ECDSA 算法生成的密钥。我收到错误消息 - 必须传递 IE 密钥。

我在这里搜索了这两种方法支持的密码: http://java.sun.com/javase/6/docs/technotes/guides/security/StandardNames.html#Cipher

不幸的是,ECC 不支持其他算法。有人使用 ECC 生成的密钥来加密/解密输入吗?我应该对两者使用哪种算法,以免它们相互冲突?

While trying to encrypt a given input using Elliptic Curve Cryptography in Java I'm using the following algorithms for generating the cipher and the key:

KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA");
Cipher cipher = Cipher.getInstance("ECIES");

Now as expected, the cipher isn't accepting the keys generated by the ECDSA algorithm. I get the error as - must be passed IE key.

I searched for the ciphers being supported by these 2 methods here: http://java.sun.com/javase/6/docs/technotes/guides/security/StandardNames.html#Cipher

Unfortunately no else algo is supported for ECC. Has anyone used ECC generated keys to encrypt/decrypt an input? Which algo should I use for both so that they don't clash with each other?

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

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

发布评论

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

评论(2

给妤﹃绝世温柔 2024-09-10 09:00:00

根据 http://java.sun。 com/javase/6/docs/technotes/guides/security/StandardNames.html#KeyPairGenerator,您需要为 ECC 的 KeyPairGenerator 实例传递“EC”。

According to http://java.sun.com/javase/6/docs/technotes/guides/security/StandardNames.html#KeyPairGenerator, you need to pass "EC" for an instance of the KeyPairGenerator for ECC.

别忘他 2024-09-10 09:00:00

另外,要获得功能更丰富的加密实现,请查看 Bouncycastle

Also for a more feature-rich cryptography implementation take a look at Bouncycastle.

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