Inheritance: AsymmetricAlgorithm
Example #1
0
        /// <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);
        }
Example #2
0
        /// <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);
        }
Example #3
0
 /// <summary>Initializes a new instance of the <see cref="ECDiffieHellman"/> class.</summary>
 /// <param name="platformAlgorithm">The .NET algorithm backing this instance.</param>
 internal ECDiffieHellman(Platform.ECDiffieHellman platformAlgorithm)
 {
     Requires.NotNull(platformAlgorithm, nameof(platformAlgorithm));
     this.platformAlgorithm = platformAlgorithm;
 }
Example #4
0
 internal ECDiffieHellmanWrapper(ECDiffieHellman wrapped)
 {
     Debug.Assert(wrapped != null);
     _wrapped = wrapped;
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ECDiffieHellman"/> class.
 /// </summary>
 /// <param name="platformAlgorithm">The .NET algorithm backing this instance.</param>
 internal ECDiffieHellman(Platform.ECDiffieHellman platformAlgorithm)
 {
     Requires.NotNull(platformAlgorithm, nameof(platformAlgorithm));
     this.platformAlgorithm = platformAlgorithm;
 }