summary refs log tree commit diff
path: root/crypto/src/asn1/Asn1BitStringParser.cs
blob: 76af06d7392c86396057b3c55cf3fb2fa38ff32a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.IO;

namespace Org.BouncyCastle.Asn1
{
    public interface Asn1BitStringParser
        : IAsn1Convertible
    {
        /// <summary>Return a <see cref="Stream"/> representing the contents of the BIT STRING. The final byte, if any,
        /// may include pad bits. See <see cref="PadBits"/>.</summary>
        /// <returns>A <see cref="Stream"/> with its source as the BIT STRING content.</returns>
        /// <exception cref="IOException"/>
        Stream GetBitStream();

        /// <summary>Return a <see cref="Stream"/> representing the contents of the BIT STRING, where the content is
        /// expected to be octet-aligned (this will be automatically checked during parsing).</summary>
        /// <returns>A <see cref="Stream"/> with its source as the BIT STRING content.</returns>
        /// <exception cref="IOException"/>
        Stream GetOctetStream();

        /// <summary>Return the number of pad bits, if any, in the final byte, if any, read from
        /// <see cref="GetBitStream"/>.</summary>
        /// <remarks>
        /// This number is in the range zero to seven. That number of the least significant bits of the final byte, if
        /// any, are not part of the contents and should be ignored. NOTE: Must be called AFTER the stream has been
        /// fully processed. (Does not need to be called if <see cref="GetOctetStream"/> was used instead of
        /// <see cref="GetBitStream"/>.
        /// </remarks>
        /// <returns>The number of pad bits. In the range zero to seven.</returns>
        int PadBits { get; }
    }
}