While importing .p12
to cacerts
I'm facing the following issue. First line says alias already exists and then when I try to overwrite it says alias not found. Please help me tackle this issue.
/usr/java/default/jre/bin/keytool -importkeystore -deststorepass changeit -destkeystore /usr/java/default/jre/lib/security/cacerts -srckeystore /home/sogadm/MB_copy/MB_client.p12 -srcstoretype pkcs12 -srcstorepass 123456 -alias mb_ca
Existing entry alias mb_ca exists, overwrite? [no]: yes
keytool error: java.lang.Exception: Alias <mb_ca> does not exist
It probably means that:
cacerts
you already have an entry with alias mb_ca.p12
you don't have an entry with alias mb_caTry to do the following:
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
-delete
the existing mb_ca entry incacerts
, if it is a wrong one or if you don't need it-srcalias
and-destalias
for better controlActually, 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 tocacerts
:Hope it helps.