private bool checkServerIdentity(Mono.Security.X509.X509Certificate cert)
        {
            string targetHost = this.Context.ClientSettings.TargetHost;

            Mono.Security.X509.X509Extension extension = cert.Extensions["2.5.29.17"];
            if (extension != null)
            {
                SubjectAltNameExtension altNameExtension = new SubjectAltNameExtension(extension);
                foreach (string dnsName in altNameExtension.DNSNames)
                {
                    if (TlsServerCertificate.Match(targetHost, dnsName))
                    {
                        return(true);
                    }
                }
                foreach (string ipAddress in altNameExtension.IPAddresses)
                {
                    if (ipAddress == targetHost)
                    {
                        return(true);
                    }
                }
            }
            return(this.checkDomainName(cert.SubjectName));
        }
        private bool checkCertificateUsage(Mono.Security.X509.X509Certificate cert)
        {
            ClientContext context = (ClientContext)this.Context;

            if (cert.Version < 3)
            {
                return(true);
            }
            KeyUsages usage = KeyUsages.none;

            switch (context.Negotiating.Cipher.ExchangeAlgorithmType)
            {
            case ExchangeAlgorithmType.DiffieHellman:
                usage = KeyUsages.keyAgreement;
                break;

            case ExchangeAlgorithmType.Fortezza:
                return(false);

            case ExchangeAlgorithmType.RsaKeyX:
                usage = KeyUsages.keyEncipherment;
                break;

            case ExchangeAlgorithmType.RsaSign:
                usage = KeyUsages.digitalSignature;
                break;
            }
            KeyUsageExtension         keyUsageExtension1 = (KeyUsageExtension)null;
            ExtendedKeyUsageExtension keyUsageExtension2 = (ExtendedKeyUsageExtension)null;

            Mono.Security.X509.X509Extension extension1 = cert.Extensions["2.5.29.15"];
            if (extension1 != null)
            {
                keyUsageExtension1 = new KeyUsageExtension(extension1);
            }
            Mono.Security.X509.X509Extension extension2 = cert.Extensions["2.5.29.37"];
            if (extension2 != null)
            {
                keyUsageExtension2 = new ExtendedKeyUsageExtension(extension2);
            }
            if (keyUsageExtension1 != null && keyUsageExtension2 != null)
            {
                if (!keyUsageExtension1.Support(usage))
                {
                    return(false);
                }
                return(keyUsageExtension2.KeyPurpose.Contains((object)"1.3.6.1.5.5.7.3.1") || keyUsageExtension2.KeyPurpose.Contains((object)"2.16.840.1.113730.4.1"));
            }
            if (keyUsageExtension1 != null)
            {
                return(keyUsageExtension1.Support(usage));
            }
            if (keyUsageExtension2 != null)
            {
                return(keyUsageExtension2.KeyPurpose.Contains((object)"1.3.6.1.5.5.7.3.1") || keyUsageExtension2.KeyPurpose.Contains((object)"2.16.840.1.113730.4.1"));
            }
            Mono.Security.X509.X509Extension extension3 = cert.Extensions["2.16.840.1.113730.1.1"];
            return(extension3 == null || new NetscapeCertTypeExtension(extension3).Support(NetscapeCertTypeExtension.CertTypes.SslServer));
        }
示例#3
0
 public Void Mono.Security.X509.Extensions.BasicConstraintsExtension::.ctor(Mono.Security.X509.X509Extension)
 Void Mono.Security.X509.Extensions.BasicConstraintsExtension::Decode()
示例#4
0
 //ctor:
 public X509Extension(Mono.Security.X509.X509Extension extension)
 {
 }
示例#5
0
 public Void Mono.Security.X509.X509Extension::.ctor(Mono.Security.X509.X509Extension)
 Void Mono.Security.X509.X509Extension::Decode()
 //ctor:
 public CRLDistributionPointsExtension(Mono.Security.X509.X509Extension extension)
 {
 }
示例#7
0
 //ctor:
 public KeyAttributesExtension(Mono.Security.X509.X509Extension extension)
 {
 }
示例#8
0
 //ctor:
 public BasicConstraintsExtension(Mono.Security.X509.X509Extension extension)
 {
 }
 public bool Contains(Mono.Security.X509.X509Extension extension)
 {
     throw new NotImplementedException();
 }
示例#10
0
 //ctor:
 public NetscapeCertTypeExtension(Mono.Security.X509.X509Extension extension)
 {
 }
示例#11
0
 //ctor:
 public CertificatePoliciesExtension(Mono.Security.X509.X509Extension extension)
 {
 }
 //ctor:
 public SubjectKeyIdentifierExtension(Mono.Security.X509.X509Extension extension)
 {
 }
示例#13
0
 //ctor:
 public PrivateKeyUsagePeriodExtension(Mono.Security.X509.X509Extension extension)
 {
 }
示例#14
0
 //ctor:
 public SubjectAltNameExtension(Mono.Security.X509.X509Extension extension)
 {
 }
示例#15
0
 //ctor: 
 public KeyUsageExtension (Mono.Security.X509.X509Extension extension) {}
 public void Remove(Mono.Security.X509.X509Extension extension)
 {
 }
 public int Add(Mono.Security.X509.X509Extension extension)
 {
     throw new NotImplementedException();
 }
示例#18
0
 //ctor:
 public AuthorityKeyIdentifierExtension(Mono.Security.X509.X509Extension extension)
 {
 }
 public Void Mono.Security.X509.Extensions.SubjectKeyIdentifierExtension::.ctor(Mono.Security.X509.X509Extension)
 Void Mono.Security.X509.Extensions.SubjectKeyIdentifierExtension::Decode()