利用OPENSSL做证书转换

下载安装openssl,并将下发的key和crt文件转换为jks
install
download from the office site "http://www.openssl.org/source/"
chose the source to download
execuse the commond
tar -zxvf openssl-1.0.1.tar.gz
./config --prefix=/usr/local/ssl shared no-zlib
make
sudo make install
openssl will create file at the "/usr/local" file name is ssl
use the openssl
openssl pkcs12 -export -in cmccserver.crt -inkey cmccserver.key -out whatever.p12 -name "cmccserver"
use keytool
--query information in the keystore file
keytool -rfc -list -keystore whatever.p12 -storetype pkcs12
keytool -import keystore -v -srckeystore whatever.p12 -srcstoretype pkcs12 -srcstorepass xxxxxxxx -destkeystore cmccserver.keystore -deststoretype jks -deststorepass xxxxxxxx
1、keystore exprot .cer
keytool -export -keystore cmccserver.keystore -alias cmccserver.jks -file cmcc.cer
2、.cer import jks
keytool -import -trustcacerts -alias cmccserver.jks -file cmcc.cer -keystore cacerts
###########
Enter keystore password: changeit
Owner: CN=*.ac.10086.cn, OU=cmcc, O=cmcc, ST=beijing, C=cn
Issuer: CN=*.ac.10086.cn, C=cn, ST=beijing, L=beijing, EMAILADDRESS=cmcc@cmcc, OU=cmcc, O=cmcc
Serial number: 1
Valid from: 12/14/11 6:25 PM until: 12/13/12 6:25 PM
Certificate fingerprints:
MD5: F5:BE:DA:69:FC:B7:10:7D:B6:30:83:F7:53:F5:E3:3F
SHA1: 4C:11:86:CB:16:7C:D5:7E:8E:63:60:7B:61:2C:D1:06:F8:C2:9C:4F
Trust this certificate? [no]: yes
Certificate was added to keystore

你可能感兴趣的:(key,OpenSSL,jks,crt)