public static byte[] GetObsoleteSharedSecret(AsymmetricCipherKeyPair localKeyWithPrivate, byte[] remotePublicKeyDerEncoded)
{
var remotePublicKey = PublicKeyFactory.CreateKey(remotePublicKeyDerEncoded);
var agreement = new ECDHBasicAgreement();
agreement.Init(localKeyWithPrivate.Private);
return agreement.CalculateAgreement(remotePublicKey).ToByteArray();
}