Java中ECC的实现
在尝试使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据 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.
另外,要获得功能更丰富的加密实现,请查看 Bouncycastle。
Also for a more feature-rich cryptography implementation take a look at Bouncycastle.