KeyAgreement ka = null;
ka = KeyAgreement.getInstance("ECDH", curve.kaProvider);
ka.init(key.getPrivate());
ka.doPhase(pubkey, true);
return ka.generateSecret();
} catch (InvalidKeyException e) {
Logger.error(this, "InvalidKeyException : "+e.getMessage(),e);
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
Logger.error(this, "NoSuchAlgorithmException : "+e.getMessage(),e);