I am trying to convert PublicKey to String but I don't know how to do it properly. Following code doesn't give me correct key, so how convert it?
byte[] publicKeyBytes = userKeys.getPublic().getEncoded();
String pKstring = new String(publicKeyBytes);
I find out solution, below code is correct:
byte[] publicKeyBytes = Base64.encode(userKeys.getPublic().getEncoded(),0);
String pubKey = new String(publicKeyBytes);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With