use of com.intel.mtwilson.util.crypto.CryptographyException in project OpenAttestation by OpenAttestation.
the class X509Util method decodeDerPublicKey.
/**
* @deprecated use decodeDerPublicKey in RsaUtil instead
* @param publicKeyBytes
* @return
* @throws CryptographyException
*/
public static PublicKey decodeDerPublicKey(byte[] publicKeyBytes) throws CryptographyException {
try {
// throws NoSuchAlgorithmException
KeyFactory factory = KeyFactory.getInstance("RSA");
// throws InvalidKeySpecException
PublicKey publicKey = factory.generatePublic(new X509EncodedKeySpec(publicKeyBytes));
return publicKey;
} catch (Exception e) {
throw new CryptographyException(e);
}
}
Aggregations