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

How to import/export keys from/to a file #30

Open
maxidorius opened this issue Jan 22, 2017 · 6 comments
Open

How to import/export keys from/to a file #30

maxidorius opened this issue Jan 22, 2017 · 6 comments
Labels

Comments

@maxidorius
Copy link

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!

@str4d str4d added the question label Apr 1, 2017
@om26er
Copy link

om26er commented Dec 12, 2017

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.

@maxidorius
Copy link
Author

maxidorius commented Dec 13, 2017

For anyone interested how to do this, here is how I've done it, only storing the seed in a file.

@maxidorius
Copy link
Author

@om26er Are you sure this is the right project? SSH key tend to be RSA, not ed25519

@om26er
Copy link

om26er commented Dec 13, 2017

@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

@eschoenawa
Copy link

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?

@str4d
Copy link
Owner

str4d commented Jan 12, 2020

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.

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

No branches or pull requests

4 participants