Class Asn1.Reader

java.lang.Object
com.codename1.backend.security.pki.Asn1.Reader
Enclosing class:
Asn1

public static final class Asn1.Reader extends Object
Reads one level of a DER structure. Every read checks the tag and that the element ends inside its parent.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Reader(byte[] data)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    A BIT STRING's bytes; it must have no unused bits.
    boolean
     
    void
    Fails unless every byte has been read.
    boolean
     
    oid()
     
    open(int tag)
    A reader over the content of the next element, which must carry tag.
    openOptional(int tag)
    Like open(int), or null and nothing read when the next tag is another.
    int
    The tag of the next element, or -1 at the end.
    byte[]
    raw(int tag)
    The next element whole, header included, which must carry tag.
    byte[]
    The next element whole, whatever its tag.
    byte[]
    read(int tag)
    The next element's content, which must carry tag.
    void
    Skips the next element, whatever it is.
    int
    A small non-negative INTEGER.
    Any of the string types a certificate name uses, decoded.
    long
    A time, UTCTime or GeneralizedTime, as milliseconds since the epoch.
    byte[]
    An INTEGER as its unsigned magnitude, leading zeros removed.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • hasMore

      public boolean hasMore()
    • peek

      public int peek()
      The tag of the next element, or -1 at the end.
    • finish

      public void finish() throws IOException
      Fails unless every byte has been read.
      Throws:
      IOException
    • read

      public byte[] read(int tag) throws IOException
      The next element's content, which must carry tag.
      Throws:
      IOException
    • raw

      public byte[] raw(int tag) throws IOException
      The next element whole, header included, which must carry tag.
      Throws:
      IOException
    • open

      public Asn1.Reader open(int tag) throws IOException
      A reader over the content of the next element, which must carry tag.
      Throws:
      IOException
    • openOptional

      public Asn1.Reader openOptional(int tag) throws IOException
      Like open(int), or null and nothing read when the next tag is another.
      Throws:
      IOException
    • skip

      public void skip() throws IOException
      Skips the next element, whatever it is.
      Throws:
      IOException
    • rawAny

      public byte[] rawAny() throws IOException
      The next element whole, whatever its tag.
      Throws:
      IOException
    • oid

      public String oid() throws IOException
      Throws:
      IOException
    • unsignedInteger

      public byte[] unsignedInteger() throws IOException
      An INTEGER as its unsigned magnitude, leading zeros removed.
      Throws:
      IOException
    • smallInteger

      public int smallInteger() throws IOException
      A small non-negative INTEGER.
      Throws:
      IOException
    • bool

      public boolean bool() throws IOException
      Throws:
      IOException
    • bits

      public byte[] bits() throws IOException
      A BIT STRING's bytes; it must have no unused bits.
      Throws:
      IOException
    • time

      public long time() throws IOException
      A time, UTCTime or GeneralizedTime, as milliseconds since the epoch.
      Throws:
      IOException
    • string

      public String string() throws IOException
      Any of the string types a certificate name uses, decoded.
      Throws:
      IOException