How to use keytool on mac?
Situation
Renewed site’s certificate so I want to apply a new certificate to a service.
Before applying it, I need to verify a new certificate using keytool
command.
But there was a problem.
There is no Java on my PC. Uh-oh 😕 (Keytool is provided by Java so Java should be installed first.)
Then let’s install Java first.
Installing Java on mac os
- Visit Java site (https://www.java.com/download/)
- Download it
- Install it
- Successfully installed!
$ java -version
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
Ok, so Java is successfully installed. Let’s use keytool command to verify a new certificate.
Using Keytool
$ keytool -v -printcert -file (file)
Then you can check cert info.
Owner: CN=*.blabla.com
Issuer: CN=Sectigo RSA Domain Validation Secure Server CA, O=Sectigo Limited, L=Salford, ST=Greater Manchester, C=GB
Serial number: 1234567890
Start date: Thu Jul 01 09:00:00 KST 2021 End date: Mon Aug 01 08:59:59 KST 2022
...
🍰