Class DERInputBuffer

java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
com.github.toolarium.security.pki.impl.rsa.der.DERInputBuffer
All Implemented Interfaces:
Closeable, AutoCloseable, Cloneable

public class DERInputBuffer extends ByteArrayInputStream implements Cloneable
DER input buffer ... this is the main abstraction in the DER library which actively works with the "untyped byte stream" abstraction. It does so with impunity, since it's not intended to be exposed to anyone who could violate the "typed value stream" DER model and hence corrupt the input stream of DER values.
  • Constructor Details

    • DERInputBuffer

      public DERInputBuffer(byte[] buf)
      Constructor for DerInputBuffer
      Parameters:
      buf - the buffer
  • Method Details

    • dup

      Duplicate
      Returns:
      the buffer
      Throws:
      IllegalArgumentException - In case of invalid argument
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
      See Also:
    • hashCode

      public int hashCode()
      Returns a hashcode for this DerInputBuffer.
      Overrides:
      hashCode in class Object
      Returns:
      a hashcode for this DerInputBuffer.
    • truncate

      public void truncate(int len) throws IOException
      Truncate
      Parameters:
      len - the length
      Throws:
      IOException - In case of missing data
    • getUnsigned

      public BigInt getUnsigned(int l) throws IOException
      Returns the unsigned integer which takes up the specified number of bytes in this buffer.
      Parameters:
      l - the length
      Returns:
      the integer
      Throws:
      IOException - In case of missing data
    • getBitString

      public byte[] getBitString()
      Returns the bit string which takes up the rest of this buffer. This bit string must be byte-aligned.
      Returns:
      the byte array
    • getUnalignedBitString

      public BitArray getUnalignedBitString()
      Returns the bit string which takes up the rest of this buffer. The bit string need not be byte-aligned.
      Returns:
      the bit array