keytool错误:java.lang.Exception: 必须指定-keyalg

huangapple go评论78阅读模式
英文:

keytool error: java.lang.Exception: The -keyalg must be specified

问题

我正在尝试在Windows命令行提示符中创建一对密钥,并将它们存储在密钥存储中(使用Windows 10 JDK 14)。以下是我输入的命令:

keytool -genkey -alias chris -keystore chirskeystore

首先,系统提示我输入密码,然后重新输入密码,最后返回以下错误:

keytool error: java.lang.Exception: The -keyalg option must be specified.

该命令直接来自Oracle关于Java安全性的教程:
https://docs.oracle.com/javase/tutorial/security/toolfilex/step2.html

寻找-keyalg或错误的解决方法没有取得任何进展。任何见解都将非常有帮助。

谢谢。

英文:

I am trying to create a key pair and storing them in a key store from the Windows command line prompt (using Windows 10 JDK 14). Here is the command I am typing:

keytool -genkey -alias chris -keystore chirskeystore

First, system prompts me for a password then re-enter the password and finally, it returns with the following error:

keytool error: java.lang.Exception: The -keyalg option must be specified.

The command is directly from the Oracle tutorial on java security:
https://docs.oracle.com/javase/tutorial/security/toolfilex/step2.html
<br>
Searching for the -keyalg or the error led to nowhere. Any insight will be great.

Thanks.

答案1

得分: 1

我在使用 Adoptium Temurin Java 版本 17.0.3 时遇到了完全相同的错误,使用以下命令:

keytool -genkeypair -alias chris -keystore chirskeystore \
    -storepass &quot;MyPassword123&quot; -dname &quot;CN=MY_FQDN&quot;

对我来说,修复方法是明确指定 -keyalg 的值:

keytool -genkeypair -alias chris -keystore chirskeystore \
    -storepass &quot;MyPassword123&quot; -dname &quot;CN=MY_FQDN&quot; \
    -keyalg dsa

请注意,初始问题中的 -genkey-genkeypair 的别名。

而且,-keyalg 选项在 -genkey 中以前的默认值是 dsa,但现在需要明确指定。Oracle 应该更新他们关于 Java 安全的教程。

还有一件事:关于 -keyalg 的最新文档可以在 这里 在 oracle.com 上找到。

英文:

I get the exact same error with Adoptium Temurin Java version 17.0.3 with command:

keytool -genkeypair -alias chris -keystore chirskeystore \
    -storepass &quot;MyPassword123&quot; -dname &quot;CN=MY_FQDN&quot;

The fix for me is to be explicit about -keyalg value:

keytool -genkeypair -alias chris -keystore chirskeystore \
    -storepass &quot;MyPassword123&quot; -dname &quot;CN=MY_FQDN&quot; \
    -keyalg dsa

Note -genkey from initial question is an alias for -genkeypair.

And option -keyalg had before default value dsa for -genkey. But now it's required to specify it. Oracle should update their tutorial on java security.

One more thing: the latest documentation of -keyalg can be find here on oracle.com

答案2

得分: -2

The keytool in the JRE\bin is more recent 6/6/2020 than the one in the JDK\bin 5/4/2020. The keytool in the JRE\bin works fine.

英文:

Well it turned out that keytool in the JRE\bin is more recent 6/6/2020 than the one in the JDK\bin 5/4/2020. The keytool in the JRE\bin works fine.

huangapple
  • 本文由 发表于 2020年7月31日 20:18:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/63191708.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定