in main/src/main/java/org/apache/james/jdkim/tagvalue/PublicKeyRecordImpl.java [178:195]
public PublicKey getPublicKey() {
try {
String p = getValue("p").toString();
byte[] key = Base64.decodeBase64(p.getBytes());
KeyFactory keyFactory;
keyFactory = KeyFactory.getInstance(getValue("k").toString());
X509EncodedKeySpec pubSpec = new X509EncodedKeySpec(key);
RSAPublicKey rsaKey;
rsaKey = (RSAPublicKey) keyFactory.generatePublic(pubSpec);
return rsaKey;
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("Unknown algorithm: "
+ e.getMessage());
} catch (InvalidKeySpecException e) {
throw new IllegalStateException("Invalid key spec: "
+ e.getMessage());
}
}