示例#1
0
        public virtual void EncodeCharString(string data, bool explicitTagging, Asn1Tag tag)
        {
            if (explicitTagging)
            {
                EncodeTag(tag);
            }

            if (data == null)
            {
                EncodeLength(0);
            }
            else
            {
                EncodeLength(data.Length);
                var buffer = Asn1Util.ToByteArray(data);
                OutputStream.Write(buffer, 0, buffer.Length);
            }
        }
        public override void EncodeCharString(string value, bool explicitTagging, Asn1Tag tag)
        {
            if ((value == null) || (value.Length <= 0x3e8))
            {
                base.EncodeCharString(value, explicitTagging, tag);
            }
            else
            {
                var data = Asn1Util.ToByteArray(value);

                if (explicitTagging)
                {
                    EncodeTag(tag.Class, 0x20, tag.IdCode);
                }

                EncodeOctetString(data, false, tag);
            }
        }