/// <summary> /// Creates a new instance of the default implementation of the Elliptic Curve Diffie-Hellman Algorithm /// (ECDH) using the specified ECParameters as the key. /// </summary> /// <param name="parameters">The parameters representing the key to use.</param> /// <returns>A new instance of the default implementation of this class.</returns> public static ECDiffieHellman Create(ECParameters parameters) { ECDiffieHellman ecdh = Create(); if (ecdh != null) { try { ecdh.ImportParameters(parameters); } catch { ecdh.Dispose(); throw; } } return(ecdh); }
/// <summary> /// Creates a new instance of the default implementation of the Elliptic Curve Diffie-Hellman Algorithm /// (ECDH) with a newly generated key over the specified curve. /// </summary> /// <param name="curve">The curve to use for key generation.</param> /// <returns>A new instance of the default implementation of this class.</returns> public static ECDiffieHellman Create(ECCurve curve) { ECDiffieHellman ecdh = Create(); if (ecdh != null) { try { ecdh.GenerateKey(curve); } catch { ecdh.Dispose(); throw; } } return(ecdh); }