本文介绍了java keytool给出“最终块没有正确填充”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据,我正在执行命令:

Per step 3b of this Jetty guide for using Keytool and OpenSSL, last step, I'm doing the command:

keytool -importkeystore -srckeystore jetty.pkcs12 -srcstoretype PKCS12 -destkeystore keystore

当我运行命令时,我得到: keytool error:java。 io.IOException:无法解密安全内容条目:javax.crypto.BadPaddingException:给定最终块没有正确填充

When I run the command, I get: keytool error: java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded

你知道怎么做解决这个问题?

Do you know how to resolve this?

推荐答案

在我的情况下,我使用我下载的Windows openSSL完成了一些步骤,并使用了其他步骤openSSL已经存在于CentOs6盒子上。当我在CentOs / linux盒子上完成所有步骤时,错误就消失了。

In my case, I had done some of the steps using Windows openSSL that I downloaded, and other steps using the openSSL already existing on the CentOs6 box. When I did all the steps on the CentOs/linux box, the error went away.

辅助或许是helcle note linux openSSL和Godaddy,请注意当你开始创建CSR时进程,使用2048生成site.key,即:

Secondary perhaps helful note linux openSSL and Godaddy, note when you begin the "create CSR" process, use 2048 in generating the site.key, namely:

openssl genrsa -des3 -out site.key 2048

openssl genrsa -des3 -out site.key 2048

-----------------更新------------------

----------------- update ------------------

我认为这个错误与我在步骤中遇到的密码问题有关。

I think this error is instead related to a password problem I made in the steps.

之后:

openssl pkcs12 -export -inkey jetty.key -in cert-chain.txt -out jetty.pkcs12

工具提示,输入导出密码:

the tool prompts, Enter Export Password:

输入此密码后,必须在下一步中使用我做的那个是:

This password entered, must then be used in the next step, the one I did was:

java -classpath jetty-util-6.1.19.jar:jetty-6.1.19.jar org.mortbay.jetty.security.PKCS12Import jetty.pkcs12 keystore

但每该步骤显然可能同样如下:

however per this documentation that step may apparently equally be:

keytool -importkeystore -srckeystore jetty.pkcs12 -srcstoretype PKCS12 -destkeystore keystore

这篇关于java keytool给出“最终块没有正确填充”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 20:48