/** * return an array of OIDs contained in the attribute type of each RDN in structure order. * * @return an array, possibly zero length, of DerObjectIdentifiers objects. */ public DerObjectIdentifier[] GetAttributeTypes() { int count = 0; for (int i = 0; i != rdns.Length; i++) { Rdn rdn = rdns[i]; count += rdn.Count; } DerObjectIdentifier[] res = new DerObjectIdentifier[count]; count = 0; for (int i = 0; i != rdns.Length; i++) { Rdn rdn = rdns[i]; if (rdn.IsMultiValued) { AttributeTypeAndValue[] attr = rdn.GetTypesAndValues(); for (int j = 0; j != attr.Length; j++) { res[count++] = attr[j].Type; } } else if (rdn.Count != 0) { res[count++] = rdn.First.Type; } } return(res); }
/** * return an array of RDNs containing the attribute type given by OID in structure order. * * @param attributeType the type OID we are looking for. * @return an array, possibly zero length, of RDN objects. */ public Rdn[] GetRdns(DerObjectIdentifier attributeType) { Rdn[] res = new Rdn[rdns.Length]; int count = 0; for (int i = 0; i != rdns.Length; i++) { Rdn rdn = rdns[i]; if (rdn.IsMultiValued) { AttributeTypeAndValue[] attr = rdn.GetTypesAndValues(); for (int j = 0; j != attr.Length; j++) { if (attr[j].Type.Equals(attributeType)) { res[count++] = rdn; break; } } } else { if (rdn.First.Type.Equals(attributeType)) { res[count++] = rdn; } } } Rdn[] tmp = new Rdn[count]; Array.Copy(res, 0, tmp, 0, tmp.Length); return(tmp); }