Fix for Cannot recover key error in JAVA
来源:互联网 发布:python ascii转utf8 编辑:程序博客网 时间:2024/04/27 00:32
This is how i fixed Cannot recover key error in JAVA while i was setting up an SSL configuration for one of the Application Servers. Following is the part of the exception that i noted in the error log of my app,I couldn't start my tomcat and jboss servers because of the below error.
ERROR - Could not start server:java.security.UnrecoverableKeyException: Cannot recover key
java.io.IOException: !JsseListener: java.security.UnrecoverableKeyException: Cannot recover key
at org.mortbay.jetty.security.SslSocketConnector.newServerSocket(SslSocketConnector.java:516)
at org.mortbay.jetty.bio.SocketConnector.open(SocketConnector.java:73)
at org.mortbay.jetty.AbstractConnector.doStart(AbstractConnector.java:283)
at org.mortbay.jetty.bio.SocketConnector.doStart(SocketConnector.java:147)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
I see there are lot of post in google, but hard to find the exact solution, here it goes.
What causes this SSL error?
The answer is simple, the passwords of the Certificate Key and the generated keystore are different, they cannot be different and they should be same.If your certificate cer/crt/pfx key has a password called hpanswers then your generated keystore file should also have a similar password called hpanswers, it cannot be different, so both the certificate key and the jks keystore file should have the same password.
You either need to regenerate the keystore with the same password as certificate key or change the password for both..Set the key password to be the same as keystore password, using the below java keytool command
The below is an example , here the certificate key password is oldpass and the key password is hpanswers, we are now changing they certificate key password to hpanswers
$ keytool -keypasswd -keystore test.jks -alias ssltest
Enter keystore password: hpanswers
Enter key password for ssltesr: oldpass
New key password for ssltest: hpanswers
Re-enter new key password for : hpanswers
Following is some useful information i noted while i was solving this posted on globalsign
How to Fix "Cannot Recover Key" Error
The error “java.security.UnrecoverableKeyException: Cannot recover key” occurs when the keystore and keyEntry passwords are different. To resolve this issue, you must remove all traces of the past certificate and request the file.
You must generate a new keystore, keyEntry and CSR. You must also specify the same password for the keystore and the keyEntry.
New key password for ssltest: hpanswers
Re-enter new key password for : hpanswers
Following is some useful information i noted while i was solving this posted on globalsign
How to Fix "Cannot Recover Key" Error
The error “java.security.UnrecoverableKeyException: Cannot recover key” occurs when the keystore and keyEntry passwords are different. To resolve this issue, you must remove all traces of the past certificate and request the file.
You must generate a new keystore, keyEntry and CSR. You must also specify the same password for the keystore and the keyEntry.
Useful References to understand this issue better.
- java.io.IOException: Cannot recover key
- Cannot recover key tomcat
- Fish Eye Server Error
0 0
- Fix for Cannot recover key error in JAVA
- 【Error大杂烩】Cannot recover key
- Java.security.UnrecoverableKeyException: Cannot recover key
- Cannot recover key
- Cannot recover key
- Cannot recover key
- eclipse 签名打包出错 ERROR: Cannot recover key
- CAS部署错误2:java.security.UnrecoverableKeyException: Cannot recover key
- Fix for mount error(12): Cannot allocate memory
- How to fix no public key available for the following key IDs in debian
- Tomcat配置HTTPS .keystore 文件发生java.io.IOException: Cannot recover key
- java.security.UnrecoverableKeyException: Cannot recover
- How to fix the “Cannot retrieve repository metadata (repomd.xml)” error in Fedora?
- ffmpeg error fix for librtmp
- fix:error: stray '\357' in program
- ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint
- Fix EEPROM access error for WinAVR
- DVE错误Fatal: Internal system error, cannot recover.
- Maven项目架构的默认资源路径
- DMA解析
- PressGrid 多用户墙贴(花瓣) WordPress主题[更新至v3.1]
- Winform 获取Win7 UAC 管理员权限
- go安装
- Fix for Cannot recover key error in JAVA
- dockerfile_instructions(指令)
- #if DEBUG的妙用
- Sofa OpnPress wordpress社交信息发布平台主题[更新至v2.0]
- Ubuntu12.04 安装jdk
- 复合索引和多个单列索引的效率比较
- java.lang.OutOfMemoryError: Java heap space
- 基本SQL语句学习1.0
- #110 Balanced Binary Tree