Inheritance: DerStringBase
 public override Asn1Object GetConvertedValue(DerObjectIdentifier oid, string value)
 {
     var result = base.GetConvertedValue(oid, value);
     if (result is DerUtf8String)
     {
         result = new DerPrintableString(value);
     }
     return result;
 }
Example #2
0
        protected override bool Asn1Equals(Asn1Object asn1Object)
        {
            DerPrintableString derPrintableString = asn1Object as DerPrintableString;

            if (derPrintableString == null)
            {
                return(false);
            }
            return(str.Equals(derPrintableString.str));
        }
        public static DerPrintableString GetInstance(Asn1TaggedObject obj, bool isExplicit)
        {
            Asn1Object @object = obj.GetObject();

            if (isExplicit || @object is DerPrintableString)
            {
                return(DerPrintableString.GetInstance(@object));
            }
            return(new DerPrintableString(Asn1OctetString.GetInstance(@object).GetOctets()));
        }
        protected override bool Asn1Equals(Asn1Object asn1Object)
        {
            DerPrintableString str = asn1Object as DerPrintableString;

            if (str == null)
            {
                return(false);
            }
            return(this.str.Equals(str.str));
        }
 public DerPrintableString(string str, bool validate)
 {
     if (str == null)
     {
         throw new ArgumentNullException("str");
     }
     if (validate && !DerPrintableString.IsPrintableString(str))
     {
         throw new ArgumentException("string contains illegal characters", "str");
     }
     this.str = str;
 }
        protected override bool Asn1Equals(
            Asn1Object obj)
        {
            DerPrintableString other = obj as DerPrintableString;

            if (other == null)
            {
                return(false);
            }

            return(this.str.Equals(other.str));
        }
        protected override bool Asn1Equals(Asn1Object asn1Object)
        {
            DerPrintableString derPrintableString = asn1Object as DerPrintableString;

            return(derPrintableString != null && this.str.Equals(derPrintableString.str));
        }