public string[] GetRoleAuthorityAsString() { if (roleAuthority == null) { return(new string[0]); } GeneralName[] names = roleAuthority.GetNames(); string[] array = new string[names.Length]; for (int i = 0; i < names.Length; i++) { Asn1Encodable name = names[i].Name; if (name is IAsn1String) { array[i] = ((IAsn1String)name).GetString(); } else { array[i] = ((object)name).ToString(); } } return(array); }
/** * Gets the role authority as a <code>string[]</code> object. * @return the role authority of this RoleSyntax represented as a * <code>string[]</code> array. */ public string[] GetRoleAuthorityAsString() { if (roleAuthority == null) { return(new string[0]); } GeneralName[] names = roleAuthority.GetNames(); string[] namesString = new string[names.Length]; for (int i = 0; i < names.Length; i++) { Asn1Encodable asn1Value = names[i].Name; if (asn1Value is IAsn1String) { namesString[i] = ((IAsn1String)asn1Value).GetString(); } else { namesString[i] = asn1Value.ToString(); } } return(namesString); }
private bool MatchesDN( X509Name subject, GeneralNames targets) { GeneralName[] names = targets.GetNames(); for (int i = 0; i != names.Length; i++) { GeneralName gn = names[i]; if (gn.TagNo == GeneralName.DirectoryName) { try { if (X509Name.GetInstance(gn.Name).Equivalent(subject)) { return true; } } catch (Exception) { } } } return false; }
private X509Name[] GetPrincipals( GeneralNames names) { object[] p = this.GetNames(names.GetNames()); int count = 0; for (int i = 0; i != p.Length; i++) { if (p[i] is X509Name) { ++count; } } X509Name[] result = new X509Name[count]; int pos = 0; for (int i = 0; i != p.Length; i++) { if (p[i] is X509Name) { result[pos++] = (X509Name)p[i]; } } return result; }
private X509Name[] GetPrincipals( GeneralNames names) { object[] p = this.GetNames(names.GetNames()); ArrayList l = new ArrayList(p.Length); for (int i = 0; i != p.Length; i++) { if (p[i] is X509Name) { l.Add(p[i]); } } return (X509Name[]) l.ToArray(typeof(X509Name)); }