How to import/export keys from/to a file
Most likely I am missing something obvious, not having a lot of experience with cryptographic APIs - apologizes if that is the case.
I am trying to general a pub/priv pair of keys and I would like to export those to a file so I can re-use them next time my application start. How can it be done here? Should I export the seed of the private key and recreate the object later? Are there factory methods/classes somewhere that allow such operation?
If someone could provide a sample code, that would be the best. Thanks!
ping! I am currently looking at a way to extract the private key from openssh private key file, which has proven to be quite a challenge in java. Any pointers there would be very helpful.
For anyone interested how to do this, here is how I've done it, only storing the seed in a file.
@om26er Are you sure this is the right project? SSH key tend to be RSA, not ed25519
@om26er Are you sure this is the right project? SSH key tend to be RSA, not ed25519
OPENSSH keys can also be ed25519. I figured what I was looking for, took me a while but here https://gist.github.com/om26er/494b2b34bd605ec081b9d7057cc4aa2f
Sadly this issue is still open and doesn't have a solution for me. I want to be able to work with an Arduino and my app. The Arduino Cryptography Library works with the raw keys (the java equivalent would be PublicKey.getEncoded()). Now I want to use one of these raw keys to create an EdDSAPublicKey (storing the seed like @maxidorius isn't an option, as the Arduino-library doesn't supply the seed). Any ideas on how I can achieve this?
I recommend using my newer library https://github.com/cryptography-cafe/ed25519-elisabeth for non-JCA usage. It's still in beta, so now would be a good time to test it and give feedback.