public EllipticCurveKeyExchange (TlsContext context)
		{
			curveType = ECCurveType.named_curve;
			namedCurve = context.Configuration.UserSettings.NamedCurve ?? NamedCurve.secp256k1;
			domainParameters = NamedCurveHelper.GetECParameters (namedCurve);

			GenerateKeyPair (context, domainParameters, out serverQ, out serverD);
			publicBytes = ExternalizeKey (serverQ);

			Signature = new SignatureTls12 (context.Session.ServerSignatureAlgorithm);
			using (var buffer = CreateParameterBuffer (context.HandshakeParameters))
				Signature.Create (buffer, context.Configuration.PrivateKey);
		}
Example #2
0
        public EllipticCurveKeyExchange(TlsContext context)
        {
            curveType        = ECCurveType.named_curve;
            namedCurve       = context.Configuration.UserSettings.NamedCurve ?? NamedCurve.secp256k1;
            domainParameters = NamedCurveHelper.GetECParameters(namedCurve);

            GenerateKeyPair(context, domainParameters, out serverQ, out serverD);
            publicBytes = ExternalizeKey(serverQ);

            Signature = new SignatureTls12(context.Session.ServerSignatureAlgorithm);
            using (var buffer = CreateParameterBuffer(context.HandshakeParameters))
                Signature.Create(buffer, context.Configuration.PrivateKey);
        }