How can I convert RSAPublicKey into something readable (public key sharing reasons) and then convert it back to RSAPublicKey?
A:
The easiest way to share the key between Java programs is to generate the key in keytool and share the keystore file.
ZZ Coder
2010-05-31 04:15:12
+3
A:
The getEncoded()
method gets you a byte array, which you can then convert to a string in hexadecimal representation (or, if you want to get cleverer about it, have a set 256 words you can use to represent each byte!) Similar idea on the way back. Once you convert it back to a byte array there should be a constructor you can pass it to.
Evgeny
2010-05-31 04:15:18
(I wouldn't have called a sequence of `2048 / 8` random words "clever" ...)
Stephen C
2010-05-31 04:59:55
Yeah, it's not *too* readable, but if the words are easy to pronounce it may still be easier to read them over the phone than hexadcimal numbers. :)
Evgeny
2010-05-31 08:41:41
Is there any standard format for sharing public keys, for example, in what format are PGP public keys shared?
dede
2010-05-31 14:45:35