예제 #1
0
        /// <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));
        }
예제 #2
0
        /// <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));
        }
예제 #3
0
 /// <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));
 }