I have a bse64encoded string Public key from external source (Android Store) and I need to use it to verify signed content. How can I convert the string into an instance of
you can try this solution:
add this dependency:
org.bouncycastle
bcpkix-jdk15on
1.61
and use this method:
private Key parsePublicKey(String publicKey) throws IOException {
PEMParser pemParser = new PEMParser(new StringReader(publicKey));
JcaPEMKeyConverter converter = new JcaPEMKeyConverter();
SubjectPublicKeyInfo publicKeyInfo = SubjectPublicKeyInfo.getInstance(pemParser.readObject());
return converter.getPublicKey(publicKeyInfo);
}