Open a console/command prompt (in admin mode if on windows), ‘cd’ to your JDK’s bin directory (if you do not have the JDK’s bin setup in your PATH) and run following command:
NOTE – Following command was named -export in previous releases. This old name is still supported in this release and will be supported in future releases, but for clarify the new name, -exportcert, is preferred going forward.
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 -export -alias test-key -keystore test-keystore -rfc -file test-key.cer | |
Enter keystore password: test-keystore-pwd | |
Certificate stored in file <test-key.cer> |
Once you run above command, it will create a new file (if not already exists) at following location:
Windows : %JAVA_HOME%\bin\test-key.cer
Linux/Mac/Solaris : $Java_HOME/bin/test-key.cer
When you open the certificate file in notepad or any other plain text editor, it will look like:
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
-----BEGIN CERTIFICATE----- | |
MIICdTCCAd6gAwIBAgIEUcr9TjANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJVUzESMBAGA1UE | |
CBMJZmRzLXN0YXRlMREwDwYDVQQHEwhmZHMtY2l0eTEVMBMGA1UEChMMZmRzLW9yZy1uYW1lMRQw | |
EgYDVQQLEwtmZHMtb3UtbmFtZTEcMBoGA1UEAxMTZmRzLWZpcnN0LWxhc3QtbmFtZTAeFw0xMzA2 | |
MjYxNDQwMTRaFw0xMzA5MjQxNDQwMTRaMH8xCzAJBgNVBAYTAlVTMRIwEAYDVQQIEwlmZHMtc3Rh | |
dGUxETAPBgNVBAcTCGZkcy1jaXR5MRUwEwYDVQQKEwxmZHMtb3JnLW5hbWUxFDASBgNVBAsTC2Zk | |
cy1vdS1uYW1lMRwwGgYDVQQDExNmZHMtZmlyc3QtbGFzdC1uYW1lMIGfMA0GCSqGSIb3DQEBAQUA | |
A4GNADCBiQKBgQC6bH7uhzE8IF7t7655XvrXb4u/SpqWfU9amlxMUafFV5xJXYcHUJWIz6+61ZMV | |
8oYlmoXRz6twPt848UOyeVX7bcA7wq6nXyiDLLl+2SyW9LlCnGoiYmVksv7yF9DB8FsQHPI0cWFl | |
9hi1LTlN07xmSZnwZ+1WD48tLACJ6Wyp8wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAG2vC1VJ8hMH | |
v464YYN9XhI4oPYLB9lVweT+Ir3ctTE0cpoArqR3zUDYUJO40wEuanT4oOOA/ogTpjpc9KCN0+Z+ | |
rNJnFTqbRZS/nAuVApPDcFv3JaKjsrKYEc1X4lCINywdBU28w4GEgCB/rstisMf/M4ybIvWPtrc2 | |
2dk2KfMf | |
-----END CERTIFICATE----- |
No comments:
Post a Comment