private static PublicKey generatePublicKey(String encodedPublicKey){
  try {
    byte[] decodedKey=Base64.decode(encodedPublicKey);
    KeyFactory keyFactory=KeyFactory.getInstance(KEY_FACTORY_ALGORITHM);
    return keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey));
  }
 catch (  Exception e) {
    throw new IllegalArgumentException(e);
  }
}

private static PublicKey generatePublicKey ( String encodedPublicKey ) { try { byte [ ] decodedKey = Base64 . decode ( encodedPublicKey ) ; KeyFactory keyFactory = KeyFactory . getInstance ( KEY_FACTORY_ALGORITHM ) ; return keyFactory . generatePublic ( new X509EncodedKeySpec ( decodedKey ) ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( e ) ; } }
generates a publickey instance from a string containing the base64 - encoded public key .
