Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need .crt,.key files out of jks. #7

Closed
Pa1sathvik opened this issue Mar 25, 2021 · 2 comments
Closed

Need .crt,.key files out of jks. #7

Pa1sathvik opened this issue Mar 25, 2021 · 2 comments

Comments

@Pa1sathvik
Copy link

Hi,

How to create .crt, .key files from jks file using jks-js?

@lenchv
Copy link
Owner

lenchv commented Mar 25, 2021

Hi @Pa1sathvik !

Using these instructions:

const keyStore = jks.toPem(fs.readFileSync('keystore.jks'), 'password');

you'll get the object similiar to this:

{
    <alias>: {
         cert: /* content of crt file */,
         key: /* content of key file */,
         ca: /* for truststore there maybe content of certificate authority */
    }
}

so to extract pem certificates you have to know password for your jks and alias, where the certs stored. Then you can write them to the file, if you need it.

Please, let me know if it helps

@Pa1sathvik
Copy link
Author

Thanks @lenchv it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants