Unable to import .p12 certificate to cacerts

谁都会走 提交于 2019-12-04 13:55:16

It probably means that:

  1. in cacerts you already have an entry with alias mb_ca
  2. in .p12 you don't have an entry with alias mb_ca

Try to do the following:

  1. Use -list to see the existing entries of .p12 and their alias. Adapted to your example it will be something like this: keytool -list -keystore /home/sogadm/MB_copy/MB_client.p12 -storepass 123456 -storetype PKCS12 -v

  2. -delete the existing mb_ca entry in cacerts, if it is a wrong one or if you don't need it

  3. Use -srcalias and -destalias for better control

Actually, if cacerts is a trusted certificates store you shouldn't import to it the private key entry from your .p12. Export the public key first, then import it to cacerts:

keytool -exportcert -keystore /home/sogadm/MB_copy/MB_client.p12 -storepass 123456 -storetype PKCS12 -alias p12_entry_alias -file /home/sogadm/MB_copy/MB_client.cer

keytool -importcert -keystore /usr/java/default/jre/lib/security/cacerts -storepass changeit -alias mb_client -file /home/sogadm/MB_copy/MB_client.cer

Hope it helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!