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);
		}
Exemple #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);
        }
		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);
			}
		}
Exemple #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);
            }
        }
Exemple #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);
			}
		}
Exemple #8
0
		public abstract void HandleClient (TlsContext context, KeyExchange clientExchange);