Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to export public key from .jks file using Keytool?

Tags:

keytool

wso2

Right now I'm just trying to change my hostname in WSO2 by following this guide: https://docs.wso2.com/display/IS550/Changing+the+hostname

I've come to Step 4 after generating a .jks file called newkeystore.jks and in this step it should export the public key when I run this in command line:

keytool -export -alias certalias -keystore newkeystore.jks -file <public key name>.pem

I've tried this and I receive the error "The system cannot find the specified file."

My system environment variables are set so I can use keytool properly. I can see that the .jks file is generated and it is not empty. I'm not sure what the problem here is.

like image 343
SaltySea Avatar asked Jul 26 '18 21:07

SaltySea


People also ask

Does JKS file contains public key?

jks which contains, a 2048 bit Private/Public key pair aliased “sample” created using the RSA cryptographic algorithm and a self-signed certificate (SHA256withRSA) with a validity period of 365 days.

How do I decrypt a JKS file?

For JKS, we can use the Java keytool utility, which comes inbuilt with the JDK, and for PKCS12, we can use the openssl utility.


1 Answers

To me-in-the-past,

Don't waste your time following that absolute trash guide. WSO2 documentation is poorly written with little effort to show how much they care about their customers. It is better to learn more about WSO2 from outside sources than WSO2 itself. So what you need to do here is, while following the guide, for your command line:

keytool -export -alias newcert -keystore newkeystore.jks -file [insert any name here for your public key].pem

This should work! :) Here's to answering questions with answers and not answering with questions!

like image 182
SaltySea Avatar answered Oct 26 '22 22:10

SaltySea