use of javax.crypto.KeyAgreement in project cxf by apache.
the class JweUtils method generateKeyZ.
private static byte[] generateKeyZ(ECPrivateKey privateKey, ECPublicKey publicKey) {
try {
KeyAgreement ka = KeyAgreement.getInstance("ECDH");
ka.init(privateKey);
ka.doPhase(publicKey, true);
return ka.generateSecret();
} catch (Exception ex) {
LOG.warning("Derived key calculation problem");
throw new JweException(JweException.Error.KEY_ENCRYPTION_FAILURE);
}
}
Aggregations