public class BerEncoder extends Object implements AsnEncoder
| Constructor and Description | 
|---|
BerEncoder()
Default constructor for the BER Encoder. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
int | 
buildHeader(byte[] buf,
           int startOffset,
           byte asnType,
           int asnLength)
The buildHeader() method is used to encode an ASN.1 header into the
 specified byte buffer. 
 | 
int | 
buildInteger32(byte[] buf,
              int startOffset,
              byte asnType,
              int asnInt32)
The buildInteger32() method is used to encode an ASN.1 32-bit signed
 integer into the specified byte buffer. 
 | 
int | 
buildLength(byte[] buf,
           int startOffset,
           int asnLength)
The buildLength() method is used to encode an ASN.1 length into the
 specified byte buffer. 
 | 
int | 
buildNull(byte[] buf,
         int startOffset,
         byte asnType)
The buildNull() method is used to encode an ASN.1 NULL value into the
 specified byte buffer. 
 | 
int | 
buildObjectId(byte[] buf,
             int startOffset,
             byte asnType,
             int[] oids)
The buildObjectId() method is used to encode an ASN.1 object id value
 into the specified byte buffer. 
 | 
int | 
buildString(byte[] buf,
           int startOffset,
           byte asnType,
           byte[] opaque)
The buildString() method is used to encode an ASN.1 string value into the
 specified byte buffer. 
 | 
int | 
buildUInteger32(byte[] buf,
               int startOffset,
               byte asnType,
               long asnUInt32)
The buildUInteger32() method is used to encode an ASN.1 32-bit unsigned
 integer into the specified byte buffer. 
 | 
int | 
buildUInteger64(byte[] buf,
               int startOffset,
               byte asnType,
               BigInteger asnUInt64)
The buildUInteger64() method is used to encode an ASN.1 64-bit unsigned
 integer into the specified byte buffer. 
 | 
protected static int | 
byteToInt(byte b)
Converts a primitive byte to a primitive long using "unsigned" logic. 
 | 
protected static long | 
byteToLong(byte b)
Converts a primitive byte to a primitive long. 
 | 
protected static void | 
copy(byte[] src,
    int srcOff,
    byte[] dest,
    int destOff,
    int bytesToCopy)
Used to copy data from one buffer to another. 
 | 
protected static void | 
copy(int[] src,
    int srcOff,
    int[] dest,
    int destOff,
    int intsToCopy)
Used to copy data from one buffer to another. 
 | 
protected static boolean | 
isConstructor(byte b)
Used to determine if the ASN.1 type is a constructor. 
 | 
protected static boolean | 
isExtensionId(byte b)
Used to test if the ASN.1 type is an extension. 
 | 
Object[] | 
parseHeader(byte[] buf,
           int startOffset)
The parseHeader() method is used to decode an ASN.1 header from the
 specified buffer. 
 | 
Object[] | 
parseInteger32(byte[] buf,
              int startOffset)
The parseInteger32() method is used to decode an ASN.1 32-bit signed
 integer from the specified buffer. 
 | 
Object[] | 
parseLength(byte[] buf,
           int startOffset)
The parseLength() method is used to decode an ASN.1 length from the
 specified buffer. 
 | 
Object[] | 
parseNull(byte[] buf,
         int startOffset)
The parseNull() method is used to decode an ASN.1 Null value from the
 specified buffer. 
 | 
Object[] | 
parseObjectId(byte[] buf,
             int startOffset)
The parseObjectId() method is used to decode an ASN.1 Object Identifer
 from the specified buffer. 
 | 
Object[] | 
parseString(byte[] buf,
           int startOffset)
The parseString() method is used to decode an ASN.1 opaque string from
 the specified buffer. 
 | 
Object[] | 
parseUInteger32(byte[] buf,
               int startOffset)
The parseUInteger32() method is used to decode an ASN.1 32-bit unsigned
 integer from the specified buffer. 
 | 
Object[] | 
parseUInteger64(byte[] buf,
               int startOffset)
The parseUInteger64() method is used to decode an ASN.1 64-bit unsigned
 integer from the specified buffer. 
 | 
protected static void | 
rotate(byte[] buf,
      int begin,
      int pivot,
      int end)
Rotates a give buffer area marked by begin, pivot, and end. 
 | 
protected static int byteToInt(byte b)
b - The 8-bit value to convertprotected static long byteToLong(byte b)
b - The 8-bit value to convertprotected static boolean isConstructor(byte b)
b - The ASN.1 typeprotected static boolean isExtensionId(byte b)
b - The ASN.1 type.protected static void copy(byte[] src,
                           int srcOff,
                           byte[] dest,
                           int destOff,
                           int bytesToCopy)
                    throws ArrayIndexOutOfBoundsException
src - The source buffersrcOff - The offset of the first byte in the source bufferdest - The destination bufferdestOff - The offset of the first byte in the destination bufferbytesToCopy - The number of bytes to copyArrayIndexOutOfBoundsException - Thrown if there is insufficent space in either array to
                copy the data.protected static void copy(int[] src,
                           int srcOff,
                           int[] dest,
                           int destOff,
                           int intsToCopy)
                    throws ArrayIndexOutOfBoundsException
src - The source buffersrcOff - The offset of the first integer in the source bufferdest - The destination bufferdestOff - The offset of the first integer in the destination bufferintsToCopy - The number of integer elements to copyArrayIndexOutOfBoundsException - Thrown if there is insufficent space in either array to
                copy the data.protected static void rotate(byte[] buf,
                             int begin,
                             int pivot,
                             int end)
                      throws ArrayIndexOutOfBoundsException
buf - The buffer containing the data to rotatebegin - The start of the rotationpivot - The pivot point for the rotationend - The end of the rotational bufferArrayIndexOutOfBoundsException - Thrown if an access exception occurspublic int buildLength(byte[] buf,
                       int startOffset,
                       int asnLength)
                throws AsnEncodingException
buildLength in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the method
            should start writing the encoded data.asnLength - The length to be encoded.AsnEncodingException - Thrown if an error occurs encoding the datatype.public Object[] parseLength(byte[] buf, int startOffset) throws AsnDecodingException
parseLength in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the bufferAsnDecodingException - Thrown if an error occurs decoding the buffer.public int buildHeader(byte[] buf,
                       int startOffset,
                       byte asnType,
                       int asnLength)
                throws AsnEncodingException
buildHeader in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the method
            should start writing the encoded data.asnType - The ASN.1 type to place in the bufferasnLength - The length to be encoded.AsnEncodingException - Thrown if an error occurs encoding the datatype.public Object[] parseHeader(byte[] buf, int startOffset) throws AsnDecodingException
parseHeader in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the bufferAsnDecodingException - Thrown if an error occurs decoding the buffer.public int buildInteger32(byte[] buf,
                          int startOffset,
                          byte asnType,
                          int asnInt32)
                   throws AsnEncodingException
buildInteger32 in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the method
            should start writing the encoded data.asnType - The ASN.1 type to place in the bufferasnInt32 - The 32-bit signed integer to encode.AsnEncodingException - Thrown if an error occurs encoding the datatype.public Object[] parseInteger32(byte[] buf, int startOffset) throws AsnDecodingException
parseInteger32 in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the bufferAsnDecodingException - Thrown if an error occurs decoding the buffer.public int buildUInteger32(byte[] buf,
                           int startOffset,
                           byte asnType,
                           long asnUInt32)
                    throws AsnEncodingException
buildUInteger32 in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the method
            should start writing the encoded data.asnType - The ASN.1 type to place in the bufferasnUInt32 - The 32-bit unsigned integer to encode.AsnEncodingException - Thrown if an error occurs encoding the datatype.public Object[] parseUInteger32(byte[] buf, int startOffset) throws AsnDecodingException
parseUInteger32 in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the bufferAsnDecodingException - Thrown if an error occurs decoding the buffer.public int buildUInteger64(byte[] buf,
                           int startOffset,
                           byte asnType,
                           BigInteger asnUInt64)
                    throws AsnEncodingException
buildUInteger64 in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the method
            should start writing the encoded data.asnType - The ASN.1 type to place in the bufferasnUInt64 - The 64-bit unsigned integer to encode.AsnEncodingException - Thrown if an error occurs encoding the datatype.public Object[] parseUInteger64(byte[] buf, int startOffset) throws AsnDecodingException
parseUInteger64 in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the bufferAsnDecodingException - Thrown if an error occurs decoding the buffer.public int buildNull(byte[] buf,
                     int startOffset,
                     byte asnType)
              throws AsnEncodingException
buildNull in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the method
            should start writing the encoded data.asnType - The ASN.1 type to place in the bufferAsnEncodingException - Thrown if an error occurs encoding the datatype.public Object[] parseNull(byte[] buf, int startOffset) throws AsnDecodingException
parseNull in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the bufferAsnDecodingException - Thrown if an error occurs decoding the buffer.public int buildString(byte[] buf,
                       int startOffset,
                       byte asnType,
                       byte[] opaque)
                throws AsnEncodingException
buildString in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the method
            should start writing the encoded data.asnType - The ASN.1 type to place in the bufferopaque - An array of bytes to encode into the string.AsnEncodingException - Thrown if an error occurs encoding the datatype.public Object[] parseString(byte[] buf, int startOffset) throws AsnDecodingException
parseString in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the bufferAsnDecodingException - Thrown if an error occurs decoding the buffer.public int buildObjectId(byte[] buf,
                         int startOffset,
                         byte asnType,
                         int[] oids)
                  throws AsnEncodingException
buildObjectId in interface AsnEncoderbuf - The output buffer of encoded bytes.startOffset - The offset from the start of the buffer where the method
            should start writing the encoded data.asnType - The ASN.1 type to place in the bufferoids - An array of integers to encode.AsnEncodingException - Thrown if an error occurs encoding the datatype.public Object[] parseObjectId(byte[] buf, int startOffset) throws AsnDecodingException
parseObjectId in interface AsnEncoderbuf - The input bufferstartOffset - The offset to start decoding in the bufferAsnDecodingException - Thrown if an error occurs decoding the buffer.Copyright © 2020. All rights reserved.