Пример #1
0
        private bool CheckSSLPeerNameMatching(X509Certificate peerCertificate)
        {
            MQPeerNameMatching matching = new MQPeerNameMatching(this.env, this.owningConnection, this.sslPeerName, true);
            string             subject  = peerCertificate.Subject;
            MQPeerNameMatching name     = new MQPeerNameMatching(this.env, this.owningConnection, subject, false);

            if (!matching.IsMatchingPeerName(name))
            {
                new MQException(2, 0x95e);
                return(false);
            }
            return(true);
        }
Пример #2
0
        public bool IsMatchingPeerName(MQPeerNameMatching name)
        {
            uint method = 0x63f;

            this.TrEntry(method);
            bool flag = true;

            if ((this.CN != null) && !this.Wequals(this.CN, name.CN))
            {
                flag = false;
                base.TrText(method, "CN Matching = false");
            }
            if ((this.T != null) && !this.Wequals(this.T, name.T))
            {
                flag = false;
                base.TrText(method, "T Matching = false");
            }
            if ((this.O != null) && !this.Wequals(this.O, name.O))
            {
                flag = false;
                base.TrText(method, "O Matching = false");
            }
            if ((this.L != null) && !this.Wequals(this.L, name.L))
            {
                flag = false;
                base.TrText(method, "L Matching = false");
            }
            if ((this.ST != null) && !this.Wequals(this.ST, name.ST))
            {
                flag = false;
                base.TrText(method, "ST Matching = false");
            }
            if ((this.C != null) && !this.Wequals(this.C, name.C))
            {
                flag = false;
                base.TrText(method, "C Matching = false");
            }
            if ((this.SERIALNUMBER != null) && !this.Wequals(this.SERIALNUMBER, name.SERIALNUMBER))
            {
                flag = false;
            }
            if ((this.MAIL != null) && !this.Wequals(this.MAIL, name.MAIL))
            {
                flag = false;
            }
            if ((this.E != null) && !this.Wequals(this.E, name.E))
            {
                flag = false;
            }
            if ((this.UID != null) && !this.Wequals(this.UID, name.UID))
            {
                flag = false;
            }
            if ((this.STREET != null) && !this.Wequals(this.STREET, name.STREET))
            {
                flag = false;
            }
            if ((this.PC != null) && !this.Wequals(this.PC, name.PC))
            {
                flag = false;
            }
            if ((this.UNSTRUCTUREDNAME != null) && !this.Wequals(this.UNSTRUCTUREDNAME, name.UNSTRUCTUREDNAME))
            {
                flag = false;
            }
            if ((this.UNSTRUCTUREDADDRESS != null) && !this.Wequals(this.UNSTRUCTUREDADDRESS, name.UNSTRUCTUREDADDRESS))
            {
                flag = false;
            }
            if ((this.DNQ != null) && !this.Wequals(this.DNQ, name.DNQ))
            {
                flag = false;
            }
            if (this.OU.Count > name.OU.Count)
            {
                flag = false;
                base.TrText(method, "OU Matching = false");
            }
            else
            {
                for (int i = 0; i < this.OU.Count; i++)
                {
                    if (!this.Wequals(this.OU[i], name.OU[i]))
                    {
                        flag = false;
                        base.TrText(method, "OU Matching = false");
                    }
                }
            }
            if (this.DC.Count > name.DC.Count)
            {
                flag = false;
            }
            else
            {
                for (int j = 0; j < this.DC.Count; j++)
                {
                    if (!this.Wequals(this.DC[j], name.DC[j]))
                    {
                        flag = false;
                        base.TrText(method, "DC Matching = false");
                    }
                }
            }
            base.TrText(method, "Return value = " + flag);
            base.TrExit(method);
            return(flag);
        }