/// <summary> /// BER Encode an Asn1Boolean directly into the specified output stream. /// </summary> /// <param name="b">The Asn1Boolean object to encode</param> /// <param name="stream">The stream.</param> public void Encode(Asn1Boolean b, Stream stream) { // Encode the id Encode(b.GetIdentifier(), stream); // Encode the length stream.WriteByte(0x01); // Encode the boolean content stream.WriteByte((byte)(b.BooleanValue() ? 0xff : 0x00)); }
/// <summary> /// BER Encode an Asn1Boolean directly into the specified output stream. /// </summary> /// <param name="b">The Asn1Boolean object to encode</param> /// <param name="stream">The stream.</param> public virtual void Encode(Asn1Boolean b, Stream stream) { /* Encode the id */ Encode(b.GetIdentifier(), stream); /* Encode the length */ stream.WriteByte(0x01); /* Encode the boolean content*/ stream.WriteByte((byte)(b.BooleanValue() ? (sbyte)Identity(0xff) : (sbyte)0x00)); }
/// <summary> /// BER Encode an Asn1Boolean directly into the specified output stream. /// </summary> /// <param name="b">The Asn1Boolean object to encode.</param> /// <param name="stream">The stream.</param> public static void Encode(Asn1Boolean b, Stream stream) { Encode(b.GetIdentifier(), stream); stream.WriteByte(0x01); stream.WriteByte((byte)(b.BooleanValue() ? 0xff : 0x00)); }