3
$\begingroup$

We would like to encode ECDSA Public Key specifically keys generated using the ed25519 for storage .

What is the best and less error prone method , for now we think about using Hex strings or Base64 are there other encoding schemes that can be used ?

$\endgroup$
3
$\begingroup$

Sure, there are many ways. For instance, if you need to enter key manually, you may even prefer to split text representation into groups of 4 or more characters.

But I'd suggest you choose between SSH2 (RFC 4716) and OpenSSH format. Both use Base64 for key representation. Both have an advantage that they are supported by standard tools like ssh-keygen.

If you have multiple keys and want to more reliably distinguish them, I'd suggest SSH2 (RFC 4716), because it provides slightly better possibilities to comment.

$\endgroup$
2
$\begingroup$

There are a lot of different ways you could encode, but unless you are really sensitive to the length of the encoding, in my experience just going with Base64 is a good idea. Support for Base64 is pretty ubiquitous. However, there are different variants of Base64 (URL-safe vs. standard), which complicates things if you are exchanging the encoded keys with someone else. Make sure you specify your choice (like URL-safe base64 without padding - RFC7515).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.