Skip to content

Instantly share code, notes, and snippets.

@dtheodor
Created July 4, 2018 11:41
Show Gist options
  • Save dtheodor/02a544b9eb08aa7c02bdc4add8cca0e5 to your computer and use it in GitHub Desktop.
Save dtheodor/02a544b9eb08aa7c02bdc4add8cca0e5 to your computer and use it in GitHub Desktop.
SSL tools cheatsheet

x509

certificate info

openssl x509 -in <file.pem> -text -noout

certificate subject

openssl x509 -subject -nameopt RFC2253 -noout -in <file.pem>

pkcs12

get information

openssl pkcs12 -info -in <keystore.p12>

import private key and certificate

openssl pkcs12 -export \
	-in <cert.pem> \
	-inkey <private.key> \
	-out <keystore.p12>

import cerfiticate

openssl pkcs12 -export \
	-in <cert.pem> \
	-nokeys \
	-out <keystore.p12>

jks

get information

keytool -list -keystore <keystore.jks>
keytool -list -keystore <keystore.p12> -storetype pkcs12

can't import a private key

import cerfiticate

keytool -keystore <keystore.jks> -import -file <cert.pem>

convert a pkcs12 to jks

keytool -importkeystore -noprompt \
  -destkeystore <keystore.jks> \
  -deststorepass <pass> \
  -srckeystore <keystore.p12> -srcstoretype PKCS12 \
  -srcstorepass <pass>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment