Ejemplo n.º 1
0
        public static string GetKey(CertificateAttribute attribute)
        {
            switch (attribute)
            {
            case CertificateAttribute.CommonName: return("CN");

            case CertificateAttribute.CountryName: return("C");

            case CertificateAttribute.GivenName: return("G");

            case CertificateAttribute.Locality: return("L");

            case CertificateAttribute.Organization: return("O");

            case CertificateAttribute.OrganizationalUnit: return("OU");

            case CertificateAttribute.StateOrProvinceName: return("ST");

            case CertificateAttribute.Surname: return("SN");

            default: return("<UNKNOWN>");
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Add an attribute to the certificate;
 /// </summary>
 /// <param name="attribute"></param>
 protected void AddAttribute(CertificateAttribute attribute)
 {
     if (SelfSignature == null)
       {
     this.attributes.Add(attribute);
       }
       else
       {
     throw new InvalidOperationException("Cannot add attribute after self signature.");
       }
 }
Ejemplo n.º 3
0
 public static bool VerifyAttribute(string str, CertificateAttribute key, string target, StringComparison comp)
 {
     return(VerifyAttribute(str, GetKey(key), target, comp));
 }
Ejemplo n.º 4
0
 public static bool VerifyAttribute(string str, CertificateAttribute key, string target)
 {
     return(VerifyAttribute(str, GetKey(key), target));
 }
Ejemplo n.º 5
0
 public static string GetAttribute(string str, CertificateAttribute key, string fallback = null)
 {
     return(GetAttribute(str, GetKey(key), fallback));
 }