Exemplo n.º 1
0
        public Oid(string oid)
        {
            // If we were passed the friendly name, retrieve the value String.
            this.Value = OidLookup.ToOid(oid, OidGroup.All, fallBackToAllGroups: false) ?? oid;

            _group = OidGroup.All;
        }
Exemplo n.º 2
0
        public static Oid FromOidValue(string oidValue, OidGroup group)
        {
            ArgumentNullException.ThrowIfNull(oidValue);

            string?friendlyName = OidLookup.ToFriendlyName(oidValue, group, fallBackToAllGroups: false);

            if (friendlyName == null)
            {
                throw new CryptographicException(SR.Cryptography_Oid_InvalidValue);
            }

            return(new Oid(oidValue, friendlyName, group));
        }
Exemplo n.º 3
0
        public Oid(String oid)
        {
            // If we were passed the friendly name, retrieve the value String.
            String oidValue = OidLookup.ToOid(oid, OidGroup.All, fallBackToAllGroups: false);

            if (oidValue == null)
            {
                oidValue = oid;
            }
            this.Value = oidValue;

            _group = OidGroup.All;
        }
Exemplo n.º 4
0
        public static Oid FromFriendlyName(string friendlyName, OidGroup group)
        {
            if (friendlyName == null)
            {
                throw new ArgumentNullException(nameof(friendlyName));
            }

            string?oidValue = OidLookup.ToOid(friendlyName, group, fallBackToAllGroups: false);

            if (oidValue == null)
            {
                throw new CryptographicException(SR.Cryptography_Oid_InvalidName);
            }

            return(new Oid(oidValue, friendlyName, group));
        }
Exemplo n.º 5
0
 // Indexer using an OID friendly name or value.
 public Oid?this[string oid]
 {
     get
     {
         // If we were passed the friendly name, retrieve the value String.
         string?oidValue = OidLookup.ToOid(oid, OidGroup.All, fallBackToAllGroups: false) ?? oid;
         for (int i = 0; i < _count; i++)
         {
             Oid entry = _oids[i];
             if (entry.Value == oidValue)
             {
                 return(entry);
             }
         }
         return(null);
     }
 }
Exemplo n.º 6
0
 // Indexer using an OID friendly name or value.
 public Oid this[String oid]
 {
     get
     {
         // If we were passed the friendly name, retrieve the value String.
         String oidValue = OidLookup.ToOid(oid, OidGroup.All, fallBackToAllGroups: false);
         if (oidValue == null)
         {
             oidValue = oid;
         }
         foreach (Oid entry in _list)
         {
             if (entry.Value == oidValue)
             {
                 return(entry);
             }
         }
         return(null);
     }
 }