如何查看和编辑cacerts文件?

2023-12-22

将 RAD 8.5 与 WAS 8.5 运行时结合使用,我在控制台上遇到异常:

The keystore located at "C:\IBM\Websphere85\jdk\jre\lib\security\cacerts" failed to load due to the following error: DerInputStream.getLength(): lengthTag=109, too big..

搜索错误后我得到了这个link http://blog.webspheretools.com/2011/12/25/common-ssl-certificate-errors/这建议编辑文件并删除空行/多余字符。

我如何编辑该文件?我在Windows环境下,文件似乎是base64编码的。


至于原来的问题,您可以使用keytool command https://docs.oracle.com/en/java/javase/12/tools/keytool.html查看和编辑密钥库,例如cacerts.

To view密钥库中的所有密钥,使用keytool -list:

$ keytool -list -keystore ${keystore.file}

where ${keystore.file}是到的路径cacerts文件,在你的情况下C:\IBM\Websphere85\jdk\jre\lib\security\cacerts.

To remove特定的键,使用keytool -delete:

$ keytool -delete -alias ${cert.alias} -keystore ${keystore.file}

where ${cert.alias}是上面的现有密钥别名-list命令。*

To add已经在其他地方生成的新密钥,使用keytool -importcert:

$ keytool -importcert -alias ${cert.alias} -keystore ${keystore.file} -file ${cer.file} 

where ${cer.file}是现有证书或证书链的路径。

请注意,对于每个命令,系统都会提示您输入密钥库密码,您可以使用-storepass选项。例如:

$ keytool -delete -noprompt -alias ${cert.alias} -keystore ${keystore.file} -storepass ${keystore.pass}

* The ${cert.alias}是输出行中最左边的值keytool -list.

例如,如果这是来自的输出keytool -list:

$ keytool -list -keystore ./cacerts
Enter keystore password:  

Keystore type: jks
Keystore provider: SUN

Your keystore contains 2 entries

verisignclass1ca, Jun 29, 1998, trustedCertEntry,
    Certificate fingerprint (MD5): 51:86:E8:1F:BC:B1:C3:71:B5:18:10:DB:5F:DC:F6:20
verisignserverca, Jun 29, 1998, trustedCertEntry,
    Certificate fingerprint (MD5): 74:7B:82:03:43:F0:00:9E:6B:B3:EC:47:BF:85:A5:93

then verisignclass1ca and verisignserverca是您可以指定要删除的别名。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何查看和编辑cacerts文件? 的相关文章

随机推荐