Beispiel #1
0
        protected virtual void SendCertificateMessage(Certificate certificate)
        {
            if (certificate == null)
            {
                certificate = Certificate.EmptyChain;
            }

            if (certificate.IsEmpty)
            {
                TlsContext context = Context;
                if (!context.IsServer)
                {
                    ProtocolVersion serverVersion = Context.ServerVersion;
                    if (serverVersion.IsSsl)
                    {
                        string errorMessage = serverVersion.ToString() + " client didn't provide credentials";
                        RaiseWarning(AlertDescription.no_certificate, errorMessage);
                        return;
                    }
                }
            }

            HandshakeMessage message = new HandshakeMessage(HandshakeType.certificate);

            certificate.Encode(message);

            message.WriteToRecordStream(this);
        }
Beispiel #2
0
        protected virtual void SendCertificateMessage(Certificate certificate)
        {
            if (certificate == null)
            {
                certificate = Certificate.EmptyChain;
            }
            if (certificate.IsEmpty)
            {
                TlsContext context = Context;
                if (!context.IsServer)
                {
                    ProtocolVersion serverVersion = Context.ServerVersion;
                    if (serverVersion.IsSsl)
                    {
                        string message = serverVersion.ToString() + " client didn't provide credentials";
                        RaiseWarning(41, message);
                        return;
                    }
                }
            }
            HandshakeMessage handshakeMessage = new HandshakeMessage(11);

            certificate.Encode((Stream)(object)handshakeMessage);
            handshakeMessage.WriteToRecordStream(this);
        }
        protected virtual void SendCertificateMessage(Certificate certificate)
        {
            if (certificate == null)
            {
                certificate = Certificate.EmptyChain;
            }
            if (certificate.IsEmpty && !this.Context.IsServer)
            {
                ProtocolVersion serverVersion = this.Context.ServerVersion;
                if (serverVersion.IsSsl)
                {
                    string message = serverVersion.ToString() + " client didn't provide credentials";
                    this.RaiseWarning(0x29, message);
                    return;
                }
            }
            HandshakeMessage output = new HandshakeMessage(11);

            certificate.Encode(output);
            output.WriteToRecordStream(this);
        }