Reputation: 805
How can I convert RSAPublicKey into something readable (public key sharing reasons) and then convert it back to RSAPublicKey?
Upvotes: 1
Views: 874
Reputation: 61971
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.
Upvotes: 3
Reputation: 75456
The easiest way to share the key between Java programs is to generate the key in keytool and share the keystore file.
Upvotes: 0