Example #1
0
        public AsymmetricCipherKeyPair GenerateEphemeralKey(TEllipticCurve curve)
        {
            ECDomainParameters ecParams         = EllipticCurveFactory.GetEllipticCurveParameters(curve);
            ECKeyPairGenerator keyPairGenerator = new ECKeyPairGenerator();
            SecureRandom       random           = new SecureRandom();

            keyPairGenerator.Init(new ECKeyGenerationParameters(ecParams, random));
            return(keyPairGenerator.GenerateKeyPair());
        }
        public void GenerateEphemeralKey()
        {
            EllipticCurveParameters = EllipticCurveFactory.GetEllipticCurveParameters(Curve);
            ECKeyPairGenerator keyPairGenerator = new ECKeyPairGenerator();
            SecureRandom       random           = new SecureRandom();

            keyPairGenerator.Init(new ECKeyGenerationParameters(EllipticCurveParameters, random));
            AsymmetricCipherKeyPair keys = keyPairGenerator.GenerateKeyPair();

            PrivateKey = (ECPrivateKeyParameters)keys.Private;
            PublicKey  = (ECPublicKeyParameters)keys.Public;
        }
Example #3
0
        public void GenerateEphemeralKey()
        {
            this.EllipticCurveParameters = EllipticCurveFactory.GetEllipticCurveParameters(this.Curve);
            var keyPairGenerator = new ECKeyPairGenerator();
            var random           = new SecureRandom();

            keyPairGenerator.Init(new ECKeyGenerationParameters(this.EllipticCurveParameters, random));
            var keys = keyPairGenerator.GenerateKeyPair();

            this.PrivateKey = (ECPrivateKeyParameters)keys.Private;
            this.PublicKey  = (ECPublicKeyParameters)keys.Public;
        }