當前位置: 首頁>>代碼示例>>C#>>正文


C# DerObjectIdentifier.Equals方法代碼示例

本文整理匯總了C#中Org.BouncyCastle.Asn1.DerObjectIdentifier.Equals方法的典型用法代碼示例。如果您正苦於以下問題:C# DerObjectIdentifier.Equals方法的具體用法?C# DerObjectIdentifier.Equals怎麽用?C# DerObjectIdentifier.Equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Org.BouncyCastle.Asn1.DerObjectIdentifier的用法示例。


在下文中一共展示了DerObjectIdentifier.Equals方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LookupMnemonicByOID

 private static String LookupMnemonicByOID(DerObjectIdentifier oid)
 {
     if (oid.Equals(X509ObjectIdentifiers.Organization)) { return "O"; }
     if (oid.Equals(X509ObjectIdentifiers.OrganizationalUnitName)) { return "OU"; }
     if (oid.Equals(X509ObjectIdentifiers.CommonName)) { return "CN"; }
     if (oid.Equals(X509ObjectIdentifiers.CountryName)) { return "C"; }
     if (oid.Equals(X509ObjectIdentifiers.StateOrProvinceName)) { return "ST"; }
     if (oid.Equals(X509ObjectIdentifiers.LocalityName)) { return "L"; }
     if (oid.Equals(X509ObjectIdentifiers.IdSha1)) { return "SHA1"; }
     if (oid.Equals(NistObjectIdentifiers.IdSha224)) { return "SHA224"; }
     if (oid.Equals(NistObjectIdentifiers.IdSha256)) { return "SHA256"; }
     if (oid.Equals(NistObjectIdentifiers.IdSha384)) { return "SHA384"; }
     if (oid.Equals(NistObjectIdentifiers.IdSha512)) { return "SHA512"; }
     if (oid.Equals(PKCS1_SHA256_WITH_RSA_OID)) { return "SHA256withRSA"; }
     if (oid.Equals(PKCS1_SHA384_WITH_RSA_OID)) { return "SHA384withRSA"; }
     if (oid.Equals(PKCS1_SHA512_WITH_RSA_OID)) { return "SHA512withRSA"; }
     if (oid.Equals(PKCS1_SHA224_WITH_RSA_OID)) { return "SHA224withRSA"; }
     throw new ArgumentException("Unknown OID " + oid);
 }
開發者ID:hernandazevedo,項目名稱:JMRTD,代碼行數:19,代碼來源:SODFile.cs

示例2: DoGetCapabilitiesForOid

        private void DoGetCapabilitiesForOid(DerObjectIdentifier capability, IList list)
        {
            if (capability == null)
            {
                foreach (object o in capabilities)
                {
                    SmimeCapability cap = SmimeCapability.GetInstance(o);

                    list.Add(cap);
                }
            }
            else
            {
                foreach (object o in capabilities)
                {
                    SmimeCapability cap = SmimeCapability.GetInstance(o);

                    if (capability.Equals(cap.CapabilityID))
                    {
                        list.Add(cap);
                    }
                }
            }
        }
開發者ID:sanyaade-iot,項目名稱:Schmoose-BouncyCastle,代碼行數:24,代碼來源:SMIMECapabilities.cs

示例3: CalculateVersion

        // RFC3852, section 5.1:
        // IF ((certificates is present) AND
        //    (any certificates with a type of other are present)) OR
        //    ((crls is present) AND
        //    (any crls with a type of other are present))
        // THEN version MUST be 5
        // ELSE
        //    IF (certificates is present) AND
        //       (any version 2 attribute certificates are present)
        //    THEN version MUST be 4
        //    ELSE
        //       IF ((certificates is present) AND
        //          (any version 1 attribute certificates are present)) OR
        //          (any SignerInfo structures are version 3) OR
        //          (encapContentInfo eContentType is other than id-data)
        //       THEN version MUST be 3
        //       ELSE version MUST be 1
        //
        private DerInteger CalculateVersion(
			DerObjectIdentifier	contentOid,
			Asn1Set				certs,
			Asn1Set				crls,
			Asn1Set				signerInfs)
        {
            bool otherCert = false;
            bool otherCrl = false;
            bool attrCertV1Found = false;
            bool attrCertV2Found = false;

            if (certs != null)
            {
                foreach (object obj in certs)
                {
                    if (obj is Asn1TaggedObject)
                    {
                        Asn1TaggedObject tagged = (Asn1TaggedObject)obj;

                        if (tagged.TagNo == 1)
                        {
                            attrCertV1Found = true;
                        }
                        else if (tagged.TagNo == 2)
                        {
                            attrCertV2Found = true;
                        }
                        else if (tagged.TagNo == 3)
                        {
                            otherCert = true;
                            break;
                        }
                    }
                }
            }

            if (otherCert)
            {
                return new DerInteger(5);
            }

            if (crls != null)
            {
                foreach (object obj in crls)
                {
                    if (obj is Asn1TaggedObject)
                    {
                        otherCrl = true;
                        break;
                    }
                }
            }

            if (otherCrl)
            {
                return new DerInteger(5);
            }

            if (attrCertV2Found)
            {
                return new DerInteger(4);
            }

            if (attrCertV1Found)
            {
                return new DerInteger(3);
            }

            if (contentOid.Equals(CmsObjectIdentifiers.Data)
                && !CheckForVersion3(signerInfs))
            {
                return new DerInteger(1);
            }

            return new DerInteger(3);
        }
開發者ID:hjgode,項目名稱:iTextSharpCF,代碼行數:94,代碼來源:SignedData.cs

示例4: GetAccessDescriptionUrlForOid

 private static String GetAccessDescriptionUrlForOid(DerObjectIdentifier oid, AccessDescription[] authorityInformationAccessArray)
 {
     foreach (AccessDescription authorityInformationAcces in authorityInformationAccessArray)
     {
         if (oid.Equals(authorityInformationAcces.AccessMethod))
         {
             var name = authorityInformationAcces.AccessLocation;
             return ((DerIA5String)name.Name).GetString();
         }
     }
     return null;
 }
開發者ID:kiniry-supervision,項目名稱:OpenNemID,代碼行數:12,代碼來源:X509CertificatePropertyExtrator.cs

示例5: GetCapabilities

		/**
         * returns an ArrayList with 0 or more objects of all the capabilities
         * matching the passed in capability Oid. If the Oid passed is null the
         * entire set is returned.
         */
        public ArrayList GetCapabilities(
            DerObjectIdentifier capability)
        {
            ArrayList list = new ArrayList();

			if (capability == null)
            {
				foreach (object o in capabilities)
				{
                    SmimeCapability cap = SmimeCapability.GetInstance(o);

					list.Add(cap);
                }
            }
            else
            {
				foreach (object o in capabilities)
				{
                    SmimeCapability cap = SmimeCapability.GetInstance(o);

					if (capability.Equals(cap.CapabilityID))
                    {
                        list.Add(cap);
                    }
                }
            }

			return list;
        }
開發者ID:nicecai,項目名稱:iTextSharp-4.1.6,代碼行數:34,代碼來源:SMIMECapabilities.cs


注:本文中的Org.BouncyCastle.Asn1.DerObjectIdentifier.Equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。