Last active
November 17, 2020 18:06
-
-
Save azmankudus/56260a903069644d4efe2931121bb53d to your computer and use it in GitHub Desktop.
Create Self Sign Certificate (EC/RSA) using Java Keytool
This file contains 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
keytool -genkeypair -alias keypair01 -keyalg rsa -keysize 4096 -validity 36500 -keystore local_host.p12 -storetype pkcs12 -storepass password -dname "C=MY, ST=Kuala Lumpur, L=Kuala Lumpur, O=Local Host, OU=IT, CN=local.host" -ext "eku=serverAuth" -ext "ku=digitalSignature,keyEncipherment" -ext "san=dns:local.host" | |
keytool -genkeypair -alias keypair02 -keyalg ec -keysize 521 -validity 36500 -keystore local_host.p12 -storetype pkcs12 -storepass password -dname "C=MY, ST=Kuala Lumpur, L=Kuala Lumpur, O=Local Host, OU=IT, CN=local.host" -ext "eku=serverAuth" -ext "ku=digitalSignature,keyEncipherment" -ext "san=dns:local.host" | |
keytool -importkeystore -srckeystore local_host.p12 -srcstorepass password -srcalias keypair01 -destkeystore local_host-keypair01.p12 -deststoretype pkcs12 -deststorepass password -destalias keypair01 -noprompt | |
openssl pkcs12 -in local_host-keypair01.p12 -out local_host-keypair01.key -nocerts | |
openssl pkcs12 -in local_host-keypair01.p12 -out local_host-keypair01.crt -nokeys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment