ssl - How to create a certificate chain using keytool? -
i want create certificate chain in java follows:
ca.mycompany.com |--asia.mycompany.com |--india.mycompany.com
where ca.mycompany.com root certificate (self signed).
i know possible openssl. possible to achieve keytool?
if not, can achieve mozilla nss library?
there example in keytool documentation shows how this:
keytool -genkeypair -keystore root.jks -alias root -ext bc:c keytool -genkeypair -keystore ca.jks -alias ca -ext bc:c keytool -genkeypair -keystore server.jks -alias server keytool -keystore root.jks -alias root -exportcert -rfc > root.pem keytool -storepass <storepass> -keystore ca.jks -certreq -alias ca | keytool -storepass <storepass> -keystore root.jks -gencert -alias root -ext bc=0 -rfc > ca.pem keytool -keystore ca.jks -importcert -alias ca -file ca.pem keytool -storepass <storepass> -keystore server.jks -certreq -alias server | keytool -storepass <storepass> -keystore ca.jks -gencert -alias ca -ext ku:c=dig,keyencipherment -rfc > server.pem cat root.pem ca.pem server.pem | keytool -keystore server.jks -importcert -alias server
you can generate certificate chains pretty keystore explorer:
- create new key pair, implies creating self-signed certificate (the root ca).
- right click on root ca certificate , select "sign new key pair", creates sub ca certificate , key pair.
- right click on sub ca certificate , select "sign new key pair" again.
the resulting chain:
Comments
Post a Comment