简体   繁体   中英

Import .pem public and private keys to JKS keystore

I have public and private keys in separate .pem files that I would need to get into a JKS keystore somehow.

Tried using the -import command in KeyTool for this, which gives an "not an X.509 certificate" error.

I'm guessing the solution has to do with OpenSSL, but I'm not entirely sure what to do with it.

Would really appreciate any help with this, since I'm completely clueless with everything crypto-related.

Thanks in advance, --Rolf

KeyTool expects the objects in DER format. PEM is Base64-encoded DER, with a header and a footer. KeyTool cannot parse PEM.

However, OpenSSL can convert PEM objects to DER. Eg, for an X.509 certificate, the -outform DER command-line flag instructs OpenSSL to use DER as its output format.

This page apparently contains some more detailed explanations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM