Log the running time of ECDH shared secret derivation.

This commit is contained in:
akwizgran
2014-03-22 17:06:00 +00:00
parent c028728c19
commit 2f9ef8fcaf

View File

@@ -234,9 +234,14 @@ class CryptoComponentImpl implements CryptoComponent {
throw new IllegalArgumentException();
ECPrivateKeyParameters ecPriv = ((Sec1PrivateKey) priv).getKey();
ECPublicKeyParameters ecPub = ((Sec1PublicKey) pub).getKey();
long now = System.currentTimeMillis();
ECDHCBasicAgreement agreement = new ECDHCBasicAgreement();
agreement.init(ecPriv);
return agreement.calculateAgreement(ecPub).toByteArray();
byte[] secret = agreement.calculateAgreement(ecPub).toByteArray();
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO))
LOG.info("Deriving shared secret took " + duration + " ms");
return secret;
}
public byte[] deriveGroupSalt(byte[] secret) {