public override void HandleClient(TlsContext ctx, KeyExchange clientExchange)
        {
            var serverDh = (DiffieHellmanKeyExchange)clientExchange;

            using (var X = new SecureBuffer(dh.DecryptKeyExchange(serverDh.Y))) {
                ComputeMasterSecret(ctx, X);
            }
        }
		public override void HandleClient (TlsContext context, KeyExchange clientExchange)
		{
			var clientKey = ((EllipticCurveKeyExchange)clientExchange).clientKey;

			clientQ = domainParameters.Curve.DecodePoint (clientKey);

			var agreement = CalculateAgreement (clientQ, serverD);
			using (var preMaster = new SecureBuffer (agreement.ToByteArrayUnsigned ()))
				ComputeMasterSecret (context, preMaster);
		}
Esempio n. 3
0
        public override void HandleClient(TlsContext context, KeyExchange clientExchange)
        {
            var clientKey = ((EllipticCurveKeyExchange)clientExchange).clientKey;

            clientQ = domainParameters.Curve.DecodePoint(clientKey);

            var agreement = CalculateAgreement(clientQ, serverD);

            using (var preMaster = new SecureBuffer(agreement.ToByteArrayUnsigned()))
                ComputeMasterSecret(context, preMaster);
        }
Esempio n. 4
0
		public override void HandleClient (TlsContext ctx, KeyExchange clientExchange)
		{
			// Read client premaster secret
			var encryptedPreMaster = ((RSAKeyExchange)clientExchange).encryptedPreMasterSecret;

			if (!ctx.Configuration.HasCredentials)
				throw new TlsException (AlertDescription.BadCertificate, "Server certificate Private Key unavailable.");

			// Decrypt premaster secret
			var deformatter = new RSAPKCS1KeyExchangeDeformatter (ctx.Configuration.PrivateKey);

			using (var preMasterSecret = new SecureBuffer (deformatter.DecryptKeyExchange (encryptedPreMaster))) {
				// Create master secret
				ComputeMasterSecret (ctx, preMasterSecret);
			}
		}
Esempio n. 5
0
        public override void HandleClient(TlsContext ctx, KeyExchange serverExchange)
        {
            // Read client premaster secret
            var encryptedPreMaster = ((RSAKeyExchange)serverExchange).encryptedPreMasterSecret;

            if (!ctx.Configuration.HasCredentials)
            {
                throw new TlsException(AlertDescription.BadCertificate, "Server certificate Private Key unavailable.");
            }

            // Decrypt premaster secret
            var deformatter = new RSAPKCS1KeyExchangeDeformatter(ctx.Configuration.PrivateKey);

            using (var preMasterSecret = new SecureBuffer(deformatter.DecryptKeyExchange(encryptedPreMaster))) {
                // Create master secret
                ComputeMasterSecret(ctx, preMasterSecret);
            }
        }
Esempio n. 6
0
 public abstract void HandleClient(TlsContext context, KeyExchange serverExchange);
		public override void HandleClient (TlsContext ctx, KeyExchange clientExchange)
		{
			var serverDh = (DiffieHellmanKeyExchange)clientExchange;
			using (var X = new SecureBuffer (dh.DecryptKeyExchange (serverDh.Y))) {
				ComputeMasterSecret (ctx, X);
			}
		}
Esempio n. 8
0
		public abstract void HandleClient (TlsContext context, KeyExchange clientExchange);