Keytool EC KeyPairGenerator not available

不想你离开。 提交于 2019-12-21 06:57:15

问题


When I use keytool to generate a key with ECC, I get this error:

Error keytool: java.security.NoSuchAlgorithmException: EC KeyPairGenerator not available

Then syntax used to generate a key is:

keytool -genkey -alias testing -keyalg EC -keysize 256 -keystore try.jks -dname "CN=localhost,OU=dep,O=lks,L=ny,ST=ny,C=USA"

I have this Java version:

openjdk version "1.8.0_60"
OpenJDK Runtime Environment (build 1.8.0_60-b16)                            
OpenJDK 64-Bit Server VM (build 25.60-b16, mixed mode)

回答1:


I had the same error with pepk (Play Encrypt Private Key) on Ubuntu 16.04.

I solved this with a solution close to CipherX's answer:

  1. Download Java Oracle (tar.gz)
  2. Extract the files
  3. Instead of launching java installed on the sytem, launch java from the extracted files:
~/Downloads/android/jdk-9.0.1/bin/java -jar pepk.jar --keystore=acme.keystore \
--alias=acme --output=encrypted_private_key_path --encryptionkey=eb…

And the Error: EC KeyPairGenerator not available error disappeared.




回答2:


This error indicates that your EC security provider is missing, please do the following to add it:

  • Edit the file "jdk1.8.0_65\lib\security\java.security"
  • Search for "List of providers and their preference order"
  • Add "security.provider.[Last security provider id +1]=sun.security.ec.SunEC" to the list of security providers.

see this link for more details about the sunEC security provider.




回答3:


I resolved the problem reading this article (linked by the user @QuakeCore). If anyone have this problem you can resolve following my steps:

  1. Download Java Oracle (tar.gz);
  2. Copy the file jdk1.8.0_*/jre/lib/amd64/libsunec.so from extracted folder to /usr/lib/jvm/java-1.8.0-openjdk.x86_64/jre/lib/amd64/libsunec.so;
  3. Use the syntax written in my original question to generate the key.


来源:https://stackoverflow.com/questions/40957280/keytool-ec-keypairgenerator-not-available

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!