Last active
May 11, 2019 15:35
-
-
Save mefarazath/79b9b22657cadcb42b0055c6efac791a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# export a public certificate | |
keytool -export -alias wso2carbon -file key.crt -keystore wso2carbon.jks | |
or | |
keytool -export -keystore pathToKeystore -rfc -alias aliasNameForCertificate | |
#print out the certificate | |
openssl x509 -text -inform DER -in key.crt | |
or | |
keytool -printcert -rfc -file pathToCertificate | |
#Import a cert into a keystore | |
keytool -import -trustcacerts -alias mydomain -file mydomain.crt -keystore keystore.jks | |
Extract the Private Key | |
----------- | |
1. Import JKS --> PKCS12 store | |
keytool -importkeystore -srckeystore wso2carbon.jks -destkeystore wso2carbon.p12 -srcstoretype JKS -deststoretype PKCS12 -srcstorepass wso2carbon -deststorepass wso2carbon -srcalias wso2carbon -destalias wso2carbon -srckeypass wso2carbon -destkeypass wso2carbon | |
2. Extract Private Key | |
openssl pkcs12 -in wso2carbon.p12 -out wso2privateKey.pem -passin pass:wso2carbon -passout pass:wso2carbon | |
3. RSA key extraction | |
openssl rsa -in wso2privateKey.pem -out wso2RSA.pem | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment