示例#1
0
 public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
 {
     if (Value != null)
     {
         outs.Write(Value);
     }
 }
 public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
 {
     if (Value != null)
     {
         outs.Write(Value);
     }
 }
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            int num;

            if (((Value.Length < 2) || (Value[0] > 2)) || ((Value[0] != 2) && (Value[1] > 0x27)))
            {
                throw ExceptionUtility.CryptographicException(Resources.Asn1InvalidObjectIdException);
            }

            var len = 1;

            for (num = 2; num < Value.Length; num++)
            {
                len += Asn1RunTime.GetIdentBytesCount(Value[num]);
            }

            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            outs.EncodeLength(len);
            var ident = (Value[0] * 40) + Value[1];

            outs.EncodeIdentifier(ident);

            for (num = 2; num < Value.Length; num++)
            {
                outs.EncodeIdentifier(Value[num]);
            }
        }
示例#4
0
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            if (((OidValue.Items.Length < 2) || (OidValue.Items[0] > 2)) || ((OidValue.Items[0] != 2) && (OidValue.Items[1] > 0x27)))
            {
                throw ExceptionUtility.CryptographicException(Resources.Asn1InvalidObjectIdException);
            }

            var len = 1;

            for (var i = 2; i < OidValue.Items.Length; i++)
            {
                len += Asn1RunTime.GetIdentBytesCount(OidValue.Items[i]);
            }

            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            outs.EncodeLength(len);
            var ident = (OidValue.Items[0] * 40) + OidValue.Items[1];

            outs.EncodeIdentifier(ident);

            for (var i = 2; i < OidValue.Items.Length; i++)
            {
                outs.EncodeIdentifier(OidValue.Items[i]);
            }
        }
示例#5
0
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            outs.EncodeIntValue(Value, true);
        }
示例#6
0
		public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
		{
			if (explicitTagging)
			{
				outs.EncodeTag(Tag);
			}

			outs.EncodeLength(0);
		}
示例#7
0
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            outs.EncodeIntValue(Value, true);
        }
示例#8
0
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            outs.EncodeLength(0);
        }
示例#9
0
 public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
 {
     foreach (Asn1OpenType type in Value)
     {
         if (type != null)
         {
             type.Encode(outs, false);
         }
     }
 }
示例#10
0
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            outs.EncodeLength(1);
            outs.WriteByte(Value ? -1 : 0);
        }
示例#11
0
 public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
 {
     foreach (Asn1OpenType type in Value)
     {
         if (type != null)
         {
             type.Encode(outs, false);
         }
     }
 }
示例#12
0
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            outs.EncodeLength(1);
            outs.WriteByte(Value ? -1 : 0);
        }
示例#13
0
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            var buffer = new Asn1BerEncodeBuffer();
            var len    = EncodeValue(buffer, _value, true);

            outs.EncodeLength(len);
            outs.Write(buffer.MsgCopy);
        }
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            try
            {
                var bytes = Encoding.UTF8.GetBytes(Value);

                if (explicitTagging)
                {
                    outs.EncodeTag(Tag);
                }

                outs.EncodeLength(bytes.Length);
                outs.Write(bytes);
            }
            catch (IOException exception)
            {
                Console.Out.WriteLine("This JVM does not support UTF-8 encoding");
                Asn1Util.WriteStackTrace(exception, Console.Error);
            }
        }
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            try
            {
                var bytes = Encoding.UTF8.GetBytes(Value);

                if (explicitTagging)
                {
                    outs.EncodeTag(Tag);
                }

                outs.EncodeLength(bytes.Length);
                outs.Write(bytes);
            }
            catch (IOException exception)
            {
                Console.Out.WriteLine("This JVM does not support UTF-8 encoding");
                Asn1Util.WriteStackTrace(exception, Console.Error);
            }
        }
示例#16
0
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            var len = 0;

            foreach (var i in OidValue.Items)
            {
                len += Asn1RunTime.GetIdentBytesCount(i);
            }

            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            outs.EncodeLength(len);

            foreach (var i in OidValue.Items)
            {
                outs.EncodeIdentifier(i);
            }
        }
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            int num;
            var len = 0;

            for (num = 0; num < Value.Length; num++)
            {
                len += Asn1RunTime.GetIdentBytesCount(Value[num]);
            }

            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            outs.EncodeLength(len);

            for (num = 0; num < Value.Length; num++)
            {
                outs.EncodeIdentifier(Value[num]);
            }
        }
示例#18
0
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            int num;
            var len = 0;

            for (num = 0; num < Value.Length; num++)
            {
                len += Asn1RunTime.GetIdentBytesCount(Value[num]);
            }

            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            outs.EncodeLength(len);

            for (num = 0; num < Value.Length; num++)
            {
                outs.EncodeIdentifier(Value[num]);
            }
        }
		public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
		{
			outs.EncodeCharString(Value, explicitTagging, Tag);
		}
示例#20
0
 public virtual void Encode(Asn1BerOutputStream outs, bool explicitTagging)
 {
 }
示例#21
0
 public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
 {
     Encode(outs, explicitTagging, Tag);
 }
示例#22
0
 public virtual void Encode(Asn1BerOutputStream outs, bool explicitTagging)
 {
 }
 public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
 {
     outs.EncodeUnivString(_value, explicitTagging, Tag);
 }
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            var buffer = new Asn1BerEncodeBuffer();
            var len = EncodeValue(buffer, _value, true);

            outs.EncodeLength(len);
            outs.Write(buffer.MsgCopy);
        }
示例#25
0
 public virtual void Encode(Asn1BerOutputStream outs, bool explicitTagging, Asn1Tag tag)
 {
     SafeParseString();
     outs.EncodeCharString(Value, explicitTagging, tag);
 }
 public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
 {
     Encode(outs, explicitTagging, Tag);
 }
示例#27
0
 public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
 {
     base.Encode(outs, false);
 }
示例#28
0
 public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
 {
     outs.EncodeCharString(base.Value, explicitTagging, Tag);
 }
示例#29
0
 public virtual void Encode(Asn1BerOutputStream outs, bool explicitTagging, Asn1Tag tag)
 {
     SafeParseString();
     outs.EncodeCharString(Value, explicitTagging, tag);
 }
示例#30
0
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            if (Value == 0.0)
            {
                outs.EncodeLength(0);
            }
            else if (Value == double.NegativeInfinity)
            {
                outs.EncodeIntValue(MinusInfinity, true);
            }
            else if (Value == double.PositiveInfinity)
            {
                outs.EncodeIntValue(PlusInfinity, true);
            }
            else
            {
                var len  = 1;
                var num2 = BitConverter.DoubleToInt64Bits(Value);
                var num3 = ((num2 >> RealIso6093Mask) == 0L) ? 1 : -1;
                var num4 = ((int)((num2 >> 0x34) & 0x7ffL)) - 0x433;
                var w    = (num4 == 0) ? ((num2 & 0xfffffffffffffL) << 1) : ((num2 & 0xfffffffffffffL) | 0x10000000000000L);

                if (w != 0L)
                {
                    var bits = TrailingZerosCnt(w);
                    w     = Asn1Util.UrShift(w, bits);
                    num4 += bits;
                    len  += Asn1Util.GetUlongBytesCount(w);
                }
                else
                {
                    len++;
                }

                var num7 = RealBinary;

                if (num3 == -1)
                {
                    num7 |= PlusInfinity;
                }

                var bytesCount = Asn1Util.GetBytesCount(num4);
                len += bytesCount;

                switch (bytesCount)
                {
                case RealExplen2:
                    break;

                case RealExplen3:
                    num7 |= 1;
                    break;

                case RealExplenLong:
                    num7 |= 2;
                    break;

                default:
                    num7 |= 3;
                    len++;
                    break;
                }

                outs.EncodeLength(len);
                outs.WriteByte((byte)num7);

                if ((num7 & 3) == 3)
                {
                    outs.EncodeIntValue(bytesCount, false);
                }

                outs.EncodeIntValue(num4, false);
                outs.EncodeIntValue(w, false);
            }
        }
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            int num;

            if (((Value.Length < 2) || (Value[0] > 2)) || ((Value[0] != 2) && (Value[1] > 0x27)))
            {
                throw ExceptionUtility.CryptographicException(Resources.Asn1InvalidObjectIdException);
            }

            var len = 1;

            for (num = 2; num < Value.Length; num++)
            {
                len += Asn1RunTime.GetIdentBytesCount(Value[num]);
            }

            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            outs.EncodeLength(len);
            var ident = (Value[0] * 40) + Value[1];
            outs.EncodeIdentifier(ident);

            for (num = 2; num < Value.Length; num++)
            {
                outs.EncodeIdentifier(Value[num]);
            }
        }
示例#32
0
        public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
        {
            if (explicitTagging)
            {
                outs.EncodeTag(Tag);
            }

            if (Value == 0.0)
            {
                outs.EncodeLength(0);
            }
            else if (Value == double.NegativeInfinity)
            {
                outs.EncodeIntValue(MinusInfinity, true);
            }
            else if (Value == double.PositiveInfinity)
            {
                outs.EncodeIntValue(PlusInfinity, true);
            }
            else
            {
                var len = 1;
                var num2 = BitConverter.DoubleToInt64Bits(Value);
                var num3 = ((num2 >> RealIso6093Mask) == 0L) ? 1 : -1;
                var num4 = ((int)((num2 >> 0x34) & 0x7ffL)) - 0x433;
                var w = (num4 == 0) ? ((num2 & 0xfffffffffffffL) << 1) : ((num2 & 0xfffffffffffffL) | 0x10000000000000L);

                if (w != 0L)
                {
                    var bits = TrailingZerosCnt(w);
                    w = Asn1Util.UrShift(w, bits);
                    num4 += bits;
                    len += Asn1Util.GetUlongBytesCount(w);
                }
                else
                {
                    len++;
                }

                var num7 = RealBinary;

                if (num3 == -1)
                {
                    num7 |= PlusInfinity;
                }

                var bytesCount = Asn1Util.GetBytesCount(num4);
                len += bytesCount;

                switch (bytesCount)
                {
                    case RealExplen2:
                        break;

                    case RealExplen3:
                        num7 |= 1;
                        break;

                    case RealExplenLong:
                        num7 |= 2;
                        break;

                    default:
                        num7 |= 3;
                        len++;
                        break;
                }

                outs.EncodeLength(len);
                outs.WriteByte((byte)num7);

                if ((num7 & 3) == 3)
                {
                    outs.EncodeIntValue(bytesCount, false);
                }

                outs.EncodeIntValue(num4, false);
                outs.EncodeIntValue(w, false);
            }
        }
示例#33
0
 public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
 {
     outs.EncodeBitString(Value, NumBits, explicitTagging, Tag);
 }
示例#34
0
		public override void Encode(Asn1BerOutputStream outs, bool explicitTagging)
		{
			base.Encode(outs, false);
		}