JSS 3.1.1

org.mozilla.jss.asn1
Class INTEGER

java.lang.Object
  |
  +--java.lang.Number
        |
        +--java.math.BigInteger
              |
              +--org.mozilla.jss.asn1.INTEGER
All Implemented Interfaces:
ASN1Value, java.lang.Comparable, java.io.Serializable
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

Inner Class Summary
static class INTEGER.Template
           
 
Field Summary
private  byte[] encodedContents
           
static Form FORM
           
static Tag TAG
           
private static INTEGER.Template templateInstance
           
 
Fields inherited from class java.math.BigInteger
bitCount, bitLength, bitsPerDigit, bnExpModThreshTable, digitsPerInt, digitsPerLong, firstNonzeroByteNum, firstNonzeroIntNum, intRadix, LONG_MASK, longRadix, lowestSetBit, mag, magnitude, MAX_CONSTANT, negConst, ONE, posConst, serialVersionUID, signum, SMALL_PRIME_PRODUCT, trailingZeroTable, TWO, ZERO, zeros
 
Constructor Summary
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)
           
 
Method Summary
private static boolean arraysEqual(byte[] bytes, int[] ints)
           
 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()
           
private  byte[] getEncodedContents()
           
private  ASN1Header getHeader(Tag t)
           
 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, add, addOne, and, andNot, bitCnt, bitCount, bitLen, bitLength, bitLength, clearBit, compareTo, compareTo, destructiveMulAdd, divide, divideAndRemainder, doubleValue, equals, firstNonzeroIntNum, flipBit, floatValue, gcd, getInt, getLowestSetBit, hashCode, intArrayCmp, intArrayCmpToLen, intLength, intValue, isProbablePrime, jacobiSymbol, javaIncrement, largePrime, leftShift, longValue, lucasLehmerSequence, magSerializedForm, makePositive, makePositive, max, min, mod, mod2, modInverse, modPow, modPow2, montReduce, mulAdd, multiply, multiplyToLen, negate, not, oddModPow, or, parseInt, passesLucasLehmer, passesMillerRabin, pow, primeToCertainty, primitiveLeftShift, primitiveRightShift, probablePrime, randomBits, readObject, remainder, setBit, shiftLeft, shiftRight, signBit, signInt, signum, smallPrime, square, squareToLen, stripLeadingZeroBytes, stripLeadingZeroInts, subN, subtract, subtract, testBit, toByteArray, toString, toString, trailingZeroCnt, trustedStripLeadingZeroInts, valueOf, valueOf, writeReplace, xor
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

encodedContents

private byte[] encodedContents

TAG

public static final Tag TAG

FORM

public static final Form FORM

templateInstance

private static final INTEGER.Template templateInstance
Constructor Detail

INTEGER

public INTEGER(java.lang.String s)
        throws java.lang.NumberFormatException

INTEGER

public INTEGER(java.lang.String s,
               int r)
        throws java.lang.NumberFormatException

INTEGER

public INTEGER(byte[] bval)
        throws java.lang.NumberFormatException

INTEGER

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

INTEGER

public INTEGER(int numBits,
               java.util.Random rnd)
        throws java.lang.NumberFormatException

INTEGER

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

INTEGER

public INTEGER(long val)
Method Detail

getEncodedContents

private byte[] getEncodedContents()

getHeader

private ASN1Header getHeader(Tag t)

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

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

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

getContentLength

public long getContentLength()

encode

public byte[] encode()
              throws java.io.IOException

getTemplate

public static ASN1Template getTemplate()

main

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

arraysEqual

private static boolean arraysEqual(byte[] bytes,
                                   int[] ints)

JSS 3.1.1