java - How to convert trust certificate from .jks to .pem? -
java - How to convert trust certificate from .jks to .pem? -
i have java ssl server want java ssl client , c++ ssl client able connect. java client connects without issues. want have c++ ssl client able connect. purpose ,i imagined, want export serverpub.jks .pem file c++ client can load ssl context. not working.
below description of how created jks keystores java client , server , how trying export serverpub.jks .pem file.
step 1: generate client , server keystores
c:\keytool -genkeypair -alias myserverkeys -keyalg rsa -dname "cn=my server,ou=kl2217,o=kl2217org,l=nyc,st=ny,c=us" -keypass password -keystore server.jks -storepass password c:\keytool -genkeypair -alias myclientkeys -keyalg rsa -dname "cn=my client,ou=kl2217,o=kl2217org,l=nyc,st=ny,c=us" -keypass password -keystore myclient.jks -storepass password
step 2: export server public certificate , create seperate keystore
c:\keytool -exportcert -alias myserverkeys -file serverpub.cer -keystore myserver.jks -storepass spacex c:\keytool -importcert -keystore serverpub.jks -alias serverpub -file serverpub.cer -storepass password
step 3: export client public certificate , create seperate keystore
c:\keytool -exportcert -alias myclientkeys -file clientpub.cer -keystore myclient.jks -storepass spacey c:\keytool -importcert -keystore clientpub.jks -alias clientpub -file clientpub.cer -storepass password
so far good.
now here run problems.
step 4: convert serverpub.jks .pem format
c:\keytool -importkeystore -srckeystore serverpub.jks -destkeystore serverpub.p12 -srcstoretype jks -deststoretype pkcs12
and reply
enter destination keystore password: re-enter new password: come in source keystore password: problem importing entry alias serverpub: java.security.keystoreexception: trustedcertentry not supported. entry alias serverpub not imported. want quit import process? [no]:
what mean? doing wrong?
step 5: have been
c:\openssl pkcs12 -in serverpub.p12 -out serverpub.pem
but can see couldn't far.
i appreciate help understanding how right.
thanks
java keytool pem
Comments
Post a Comment