本文整理汇总了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);
}
示例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);
}
}
}
}
示例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);
}
示例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;
}
示例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;
}