ranban282
ranban282

Reputation: 187

Storing only private key in keystore, and reading it using java

I want to store a private key in a java keystore. My file looks like

-----BEGIN PRIVATE KEY-----
actual key
-----END PRIVATE KEY-----

All examples I get by googling involve storing a certificate as well. I do not have a certificate and I do not need it.

How do I store only a private key on a linux machine via the command line? (There seem to be some examples in java, but a sysadmin would be doing adding it in all machines where the application will be deployed, so a command line method is needed)

I need to read the private key from a java application, I hope that something similar to

  final Key key = (PrivateKey) keystore.getKey(alias, password.toCharArray());

will work, but haven't been able to test it as I haven't been able to store a private key in the first place.

I would need to read that key from my java application

Upvotes: 1

Views: 693

Answers (0)

Related Questions