コード例 #1
0
 protected virtual void HandleCertificate(TlsCertificate message)
 {
     if (CertificateManager.CheckClientCertificate(Config, message.Certificates))
     {
         PendingCrypto.ClientCertificates = message.Certificates;
     }
 }
コード例 #2
0
        protected virtual void HandleCertificate(TlsCertificate message)
        {
            if (message.Certificates == null || message.Certificates.Count < 1)
            {
                if (Context.SettingsProvider.RequireClientCertificate)
                {
                    throw new TlsException(AlertDescription.CertificateUnknown);
                }
                return;
            }

            var certificate       = message.Certificates [0];
            var exchangeAlgorithm = PendingCrypto.Cipher.ExchangeAlgorithmType;

            if (!CertificateManager.VerifyClientCertificate(Context, certificate, exchangeAlgorithm))
            {
                throw new TlsException(AlertDescription.UnsupportedCertificate);
            }

            CertificateManager.CheckClientCertificate(Context, message.Certificates);

            PendingCrypto.ClientCertificates = message.Certificates;
        }