Class INTEGER

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<java.math.BigInteger>, ASN1Value
    Direct Known Subclasses:
    ENUMERATED

    public class INTEGER
    extends java.math.BigInteger
    implements ASN1Value
    The ASN.1 type INTEGER. This class extends BigInteger.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  INTEGER.Template  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Form FORM  
      static Tag TAG  
      • Fields inherited from class java.math.BigInteger

        ONE, TEN, TWO, ZERO
    • Constructor Summary

      Constructors 
      Constructor Description
      INTEGER​(byte[] bval)  
      INTEGER​(int sign, byte[] mag)  
      INTEGER​(int bitLength, int certainty, java.util.Random rnd)  
      INTEGER​(int numBits, java.util.Random rnd)  
      INTEGER​(long val)  
      INTEGER​(java.lang.String s)  
      INTEGER​(java.lang.String s, int r)  
      INTEGER​(java.math.BigInteger bi)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] encode()  
      void encode​(java.io.OutputStream outStream)
      Write this value's DER encoding to an output stream using its own base tag.
      void encode​(Tag implicitTag, java.io.OutputStream outStream)
      Write this value's DER encoding to an output stream using an implicit tag.
      long getContentLength()  
      Tag getTag()
      Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
      static ASN1Template getTemplate()  
      static void main​(java.lang.String[] args)
      Tests the DER encoding and decoding of the INTEGER class.
      • Methods inherited from class java.math.BigInteger

        abs, add, and, andNot, bitCount, bitLength, byteValueExact, clearBit, compareTo, divide, divideAndRemainder, doubleValue, equals, flipBit, floatValue, gcd, getLowestSetBit, hashCode, intValue, intValueExact, isProbablePrime, longValue, longValueExact, max, min, mod, modInverse, modPow, multiply, negate, nextProbablePrime, not, or, pow, probablePrime, remainder, setBit, shiftLeft, shiftRight, shortValueExact, signum, sqrt, sqrtAndRemainder, subtract, testBit, toByteArray, toString, toString, valueOf, xor
      • Methods inherited from class java.lang.Number

        byteValue, shortValue
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • TAG

        public static final Tag TAG
      • FORM

        public static final Form FORM
    • Constructor Detail

      • INTEGER

        public INTEGER​(java.lang.String s)
                throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • INTEGER

        public INTEGER​(java.lang.String s,
                       int r)
                throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • INTEGER

        public INTEGER​(byte[] bval)
                throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • INTEGER

        public INTEGER​(int sign,
                       byte[] mag)
                throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • INTEGER

        public INTEGER​(int numBits,
                       java.util.Random rnd)
                throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • INTEGER

        public INTEGER​(int bitLength,
                       int certainty,
                       java.util.Random rnd)
      • INTEGER

        public INTEGER​(long val)
      • INTEGER

        public INTEGER​(java.math.BigInteger bi)
    • Method Detail

      • getTag

        public Tag getTag()
        Description copied from interface: ASN1Value
        Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
        Specified by:
        getTag in interface ASN1Value
        Returns:
        Base tag.
      • encode

        public void encode​(java.io.OutputStream outStream)
                    throws java.io.IOException
        Description copied from interface: ASN1Value
        Write this value's DER encoding to an output stream using its own base tag.
        Specified by:
        encode in interface ASN1Value
        Parameters:
        outStream - Output stream.
        Throws:
        java.io.IOException - If an error occurred.
      • encode

        public void encode​(Tag implicitTag,
                           java.io.OutputStream outStream)
                    throws java.io.IOException
        Description copied from interface: ASN1Value
        Write this value's DER encoding to an output stream using an implicit tag.
        Specified by:
        encode in interface ASN1Value
        Parameters:
        implicitTag - Implicit tag.
        outStream - Output stream.
        Throws:
        java.io.IOException - If an error occurred.
      • getContentLength

        public long getContentLength()
      • encode

        public byte[] encode()
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • main

        public static void main​(java.lang.String[] args)
        Tests the DER encoding and decoding of the INTEGER class.
        Parameters:
        args - Arguments.