客户端密钥库访问被拒绝



当我想创建一个带有keytool密钥库时,我收到拒绝访问错误消息。见下文

PS C:Program FilesJavajdk1.8.0_144bin> .keytool.exe -keystore clientkeystore -genkey -alias client
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]:  ...
What is the name of your organizational unit?
[Unknown]:  ...
What is the name of your organization?
[Unknown]:  ...
What is the name of your City or Locality?
[Unknown]:  ...
What is the name of your State or Province?
[Unknown]:  ...
What is the two-letter country code for this unit?
[Unknown]:  ..
Is CN=..., OU=..., O=..., L=..., ST=..., C=.. correct?
[no]:  yes
Enter key password for <client>
(RETURN if same as keystore password):
Re-enter new password:
keytool error: java.io.FileNotFoundException: clientkeystore (Access is denied)
PS C:Program FilesJavajdk1.8.0_144bin>

我该如何解决这个问题?

我能够在JDK 1.8.0_171上重现它,然后解决它。

基本上,您正在被拒绝写入文件的访问:

C:Program FilesJavajdk1.8.0_144binclientkeystore

您需要执行以下操作之一:

从主目录运行命令并指定密钥库二进制文件的完整路径。

PS> cd $HOME;
PS> C:Program FilesJavajdk1.8.0_144binkeytool.exe -keystore clientkeystore -genkey -alias client

指定您具有写入访问权限的clientkeystore文件的路径。在这个例子中,我使用的是你的主目录:

PS> cd C:Program FilesJavajdk1.8.0_144bin
PS> .keytool.exe -keystore $HOMEclientkeystore -genkey -alias client

(我会推荐这个(将JDK bin目录附加到路径环境变量,并指定您有权访问的目录:

PS> $env:Path += "C:Program FilesJavajdk1.8.0_144bin"
PS> keytool.exe -keystore $HOMEclientkeystore -genkey -alias client

做。

最新更新