protected override void ProcessAsSsl3()
        {
            AsymmetricAlgorithm asymmetricAlgorithm = null;
            ClientContext       clientContext       = (ClientContext)base.Context;

            asymmetricAlgorithm = clientContext.SslStream.RaisePrivateKeySelection(clientContext.ClientSettings.ClientCertificate, clientContext.ClientSettings.TargetHost);
            if (asymmetricAlgorithm == null)
            {
                throw new TlsException(AlertDescription.UserCancelled, "Client certificate Private Key unavailable.");
            }
            SslHandshakeHash sslHandshakeHash = new SslHandshakeHash(clientContext.MasterSecret);

            sslHandshakeHash.TransformFinalBlock(clientContext.HandshakeMessages.ToArray(), 0, (int)clientContext.HandshakeMessages.Length);
            byte[] array = null;
            if (!(asymmetricAlgorithm is RSACryptoServiceProvider))
            {
                try
                {
                    array = sslHandshakeHash.CreateSignature((RSA)asymmetricAlgorithm);
                }
                catch (NotImplementedException)
                {
                }
            }
            if (array == null)
            {
                RSA clientCertRSA = this.getClientCertRSA((RSA)asymmetricAlgorithm);
                array = sslHandshakeHash.CreateSignature(clientCertRSA);
            }
            base.Write((short)array.Length);
            this.Write(array, 0, array.Length);
        }
        protected override void ProcessAsSsl3()
        {
            AsymmetricAlgorithm privKey = null;
            ClientContext       context = (ClientContext)this.Context;

            privKey = context.SslStream.RaisePrivateKeySelection(
                context.ClientSettings.ClientCertificate,
                context.ClientSettings.TargetHost);

            if (privKey == null)
            {
                throw new TlsException(AlertDescription.UserCancelled, "Client certificate Private Key unavailable.");
            }
            else
            {
                SslHandshakeHash hash = new SslHandshakeHash(context.MasterSecret);
                hash.TransformFinalBlock(
                    context.HandshakeMessages.ToArray(),
                    0,
                    (int)context.HandshakeMessages.Length);

                // CreateSignature uses ((RSA)privKey).DecryptValue which is not implemented
                // in RSACryptoServiceProvider. Other implementations likely implement DecryptValue
                // so we will try the CreateSignature method.
                byte[] signature = null;
#if !MOONLIGHT
                if (!(privKey is RSACryptoServiceProvider))
#endif
                {
                    try
                    {
                        signature = hash.CreateSignature((RSA)privKey);
                    }
                    catch (NotImplementedException)
                    { }
                }
                // If DecryptValue is not implemented, then try to export the private
                // key and let the RSAManaged class do the DecryptValue
                if (signature == null)
                {
                    // RSAManaged of the selected ClientCertificate
                    // (at this moment the first one)
                    RSA rsa = this.getClientCertRSA((RSA)privKey);

                    // Write message
                    signature = hash.CreateSignature(rsa);
                }
                this.Write((short)signature.Length);
                this.Write(signature, 0, signature.Length);
            }
        }
		protected override void ProcessAsSsl3()
		{
			AsymmetricAlgorithm privKey = null;
			ClientContext		context = (ClientContext)this.Context;
			
			privKey = context.SslStream.RaisePrivateKeySelection(
				context.ClientSettings.ClientCertificate,
				context.ClientSettings.TargetHost);

			if (privKey == null)
			{
				throw new TlsException(AlertDescription.UserCancelled, "Client certificate Private Key unavailable.");
			}
			else
			{
				SslHandshakeHash hash = new SslHandshakeHash(context.MasterSecret);			
				hash.TransformFinalBlock(
					context.HandshakeMessages.ToArray(), 
					0, 
					(int)context.HandshakeMessages.Length);

				// RSAManaged of the selected ClientCertificate 
				// (at this moment the first one)
				RSA rsa = this.getClientCertRSA((RSA)privKey);

				// Write message
				byte[] signature = hash.CreateSignature(rsa);
				this.Write((short)signature.Length);
				this.Write(signature, 0, signature.Length);
			}
		}
		protected override void ProcessAsSsl3()
		{
			AsymmetricAlgorithm privKey = null;
			ClientContext		context = (ClientContext)this.Context;
			
			privKey = context.SslStream.RaisePrivateKeySelection(
				context.ClientSettings.ClientCertificate,
				context.ClientSettings.TargetHost);

			if (privKey == null)
			{
				throw new TlsException(AlertDescription.UserCancelled, "Client certificate Private Key unavailable.");
			}
			else
			{
				SslHandshakeHash hash = new SslHandshakeHash(context.MasterSecret);			
				hash.TransformFinalBlock(
					context.HandshakeMessages.ToArray(), 
					0, 
					(int)context.HandshakeMessages.Length);

				// CreateSignature uses ((RSA)privKey).DecryptValue which is not implemented
				// in RSACryptoServiceProvider. Other implementations likely implement DecryptValue
				// so we will try the CreateSignature method.
				byte[] signature = null;
				if (!(privKey is RSACryptoServiceProvider))
				{
					try
					{
						signature = hash.CreateSignature((RSA)privKey);
					}
					catch (NotImplementedException)
					{ }
				}
				// If DecryptValue is not implemented, then try to export the private
				// key and let the RSAManaged class do the DecryptValue
				if (signature == null)
				{
					// RSAManaged of the selected ClientCertificate 
					// (at this moment the first one)
					RSA rsa = this.getClientCertRSA((RSA)privKey);

					// Write message
					signature = hash.CreateSignature(rsa);
				}
				this.Write((short)signature.Length);
				this.Write(signature, 0, signature.Length);
			}
		}