public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { var length = _value.Length; for (var i = length - 1; i >= 0; i--) { var num3 = _value[i]; for (var j = 0; j < 4; j++) { var num = num3 % 0x100; num3 /= 0x100; buffer.Copy((byte)num); } } length *= 4; if (explicitTagging) { length += buffer.EncodeTagAndLength(Tag, length); } return(length); }
public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { var length = (NumBits + 7) / 8; var num2 = NumBits % 8; if (num2 != 0) { num2 = 8 - num2; Value[length - 1] = (byte)(Value[length - 1] & ((byte)~((1 << num2) - 1))); } if (length != 0) { buffer.Copy(Value, 0, length); } buffer.Copy((byte)num2); length++; if (explicitTagging) { length += buffer.EncodeTagAndLength(Tag, length); } return(length); }
public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { if (Value == null) { return(_length); } return(base.Encode(buffer, false)); }
public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { var num = 0; for (var i = Value.Count - 1; i >= 0; i--) { var type = (Asn1OpenType)Value[i]; num += type.Encode(buffer, false); } return(num); }
protected virtual int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging, Asn1Tag tag) { var length = Value.Length; buffer.Copy(Value); if (explicitTagging) { length += buffer.EncodeTagAndLength(tag, length); } return(length); }
public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { var len = 0; var bytes = Encoding.UTF8.GetBytes(Value); len = bytes.Length; buffer.Copy(bytes); if (explicitTagging) { len += buffer.EncodeTagAndLength(Tag, len); } return(len); }
protected override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging, Asn1Tag tag) { SafeParseString(); var flag = buffer is Asn1DerEncodeBuffer; if (DerRules != flag) { DerRules = flag; if (!CompileString()) { throw new FormatException("Asn1TimeStringCouldNotBeGenerated"); } } return(base.Encode(buffer, explicitTagging, tag)); }
public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { if (Value == null) { Value = new byte[0]; } var length = Value.Length; if (length != 0) { buffer.Copy(Value); } if (explicitTagging) { length += buffer.EncodeTagAndLength(Tag, length); } return(length); }
public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { if (((Value.Length < 2) || (Value[0] > 2)) || ((Value[0] != 2) && (Value[1] > 0x27))) { throw new Exception("Asn1InvalidObjectIdException"); } var len = 0; for (var i = Value.Length - 1; i >= 1; i--) { len += buffer.EncodeIdentifier((i == 1) ? ((Value[0] * 40) + Value[1]) : Value[i]); } if (explicitTagging) { len += buffer.EncodeTagAndLength(Tag, len); } return(len); }
public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { var length = Value.Length; for (var i = length - 1; i >= 0; --i) { var num3 = Value[i]; var num = num3 % 0x100; var num2 = num3 / 0x100; buffer.Copy((byte)num); buffer.Copy((byte)num2); } length *= 2; if (explicitTagging) { length += buffer.EncodeTagAndLength(Tag, length); } return(length); }
public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { return(Encode(buffer, explicitTagging, Tag)); }
public virtual int Encode(Asn1BerEncodeBuffer buffer) { return(Encode(buffer, true)); }
public virtual int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { return(0); }
public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { var len = 0; if (double.IsNegativeInfinity(Value)) { len = buffer.EncodeIntValue(MinusInfinity); } else if (double.IsPositiveInfinity(Value)) { len = buffer.EncodeIntValue(PlusInfinity); } else if (Value != 0.0) { 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 += buffer.EncodeIntValue(w); var num7 = buffer.EncodeIntValue(num4); len += num7; var num8 = RealBinary; if (num3 == -1) { num8 |= PlusInfinity; } switch (num7) { case RealExplen2: break; case RealExplen3: num8 |= 1; break; case RealExplenLong: num8 |= 2; break; default: num8 |= 3; len += buffer.EncodeIntValue(num7); break; } buffer.Copy((byte)num8); len++; } if (explicitTagging) { len += buffer.EncodeTagAndLength(Tag, len); } return(len); }