com.ibutton.cib
Class CibReturnPacket

java.lang.Object
  |
  +--com.ibutton.cib.CibReturnPacket

public class CibReturnPacket
extends java.lang.Object

Class that encapsulates the return packet from a Crypto iButton.


Field Summary
static int CMD_OK
           
static int CSB_OK
           
static int ERR_BAD_comMON_PIN
           
static int ERR_BAD_GROUP_CRC
           
static int ERR_BAD_GROUP_ID
           
static int ERR_BAD_GROUP_PIN
           
static int ERR_BAD_MODULUS_SIZE
           
static int ERR_BAD_NAME_LENGTH
           
static int ERR_BAD_OBJECT_ATTR
           
static int ERR_BAD_OBJECT_ID
           
static int ERR_BAD_OBJECT_TYPE
           
static int ERR_BAD_PACKET_LEN
           
static int ERR_BAD_PIN_LENGTH
           
static int ERR_BAD_SIZE
           
static int ERR_CIB_LOCKED
           
static int ERR_CIB_NOT_LOCKED
           
static int ERR_EXP_NOT_REL_PRIME
           
static int ERR_EXP_SIZE
           
static int ERR_GROUP_LOCKED
           
static int ERR_GROUP_NOT_FOUND
           
static int ERR_INSUFFICIENT_RAM
           
static int ERR_KAT_FAILURE
           
static int ERR_KEY_CONSISTENCY
           
static int ERR_KEY_GEN_DISABLED
           
static int ERR_MAX_GROUPS
           
static int ERR_MAX_OBJECTS
           
static int ERR_NO_KEY_GENERATION
           
static int ERR_NOT_SCRIPT_ID
           
static int ERR_OBJECT_LOCKED
           
static int ERR_OBJECT_PRIVATE
           
static int ERR_OPEN_GROUP
           
static int ERR_RNG_ERR_STATE
           
static int ERR_RNG_LONG_RUNS_TEST
           
static int ERR_RNG_MONOBIT_TEST
           
static int ERR_RNG_POKER_TEST
           
static int ERR_RNG_RUNS_TEST
           
static int ERR_ROM_CRC
           
 
Constructor Summary
CibReturnPacket(int[] rawData)
          Construct an instance with the given data.
CibReturnPacket(int csb, int groupID, int[] data)
          Construct an instance with the given data.
 
Method Summary
 int getCSB()
          Get the command status byte.
 int getGroupID()
          Get the group ID of the return packet.
 byte[] getReturnBytes()
          Get the return data as a byte array.
 char[] getReturnChars()
          Get the return data as a char array.
 char[] getReturnChars(int start, int count)
          Get the count bytes of return data as a char array beginning at the specified offset.
 int getReturnInteger()
          Get the first byte of the body as an integer.
 int getReturnInteger(int index)
          Get a byte of the return data as an integer.
 int[] getReturnInts()
          Get the return data as an integer array.
 int getReturnShort()
          Get the first byte of the body as a short.
 int getReturnShort(int index)
          Get a byte of the return data as an short.
 java.lang.String getReturnString()
          Get the return data in String format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CSB_OK

public static final int CSB_OK

CMD_OK

public static final int CMD_OK

ERR_BAD_comMON_PIN

public static final int ERR_BAD_comMON_PIN

ERR_BAD_GROUP_PIN

public static final int ERR_BAD_GROUP_PIN

ERR_BAD_PIN_LENGTH

public static final int ERR_BAD_PIN_LENGTH

ERR_BAD_NAME_LENGTH

public static final int ERR_BAD_NAME_LENGTH

ERR_INSUFFICIENT_RAM

public static final int ERR_INSUFFICIENT_RAM

ERR_CIB_LOCKED

public static final int ERR_CIB_LOCKED

ERR_CIB_NOT_LOCKED

public static final int ERR_CIB_NOT_LOCKED

ERR_GROUP_LOCKED

public static final int ERR_GROUP_LOCKED

ERR_BAD_OBJECT_TYPE

public static final int ERR_BAD_OBJECT_TYPE

ERR_BAD_OBJECT_ATTR

public static final int ERR_BAD_OBJECT_ATTR

ERR_BAD_SIZE

public static final int ERR_BAD_SIZE

ERR_BAD_GROUP_ID

public static final int ERR_BAD_GROUP_ID

ERR_BAD_OBJECT_ID

public static final int ERR_BAD_OBJECT_ID

ERR_OBJECT_LOCKED

public static final int ERR_OBJECT_LOCKED

ERR_OBJECT_PRIVATE

public static final int ERR_OBJECT_PRIVATE

ERR_MAX_GROUPS

public static final int ERR_MAX_GROUPS

ERR_MAX_OBJECTS

public static final int ERR_MAX_OBJECTS

ERR_NOT_SCRIPT_ID

public static final int ERR_NOT_SCRIPT_ID

ERR_OPEN_GROUP

public static final int ERR_OPEN_GROUP

ERR_BAD_GROUP_CRC

public static final int ERR_BAD_GROUP_CRC

ERR_BAD_PACKET_LEN

public static final int ERR_BAD_PACKET_LEN

ERR_GROUP_NOT_FOUND

public static final int ERR_GROUP_NOT_FOUND

ERR_NO_KEY_GENERATION

public static final int ERR_NO_KEY_GENERATION

ERR_BAD_MODULUS_SIZE

public static final int ERR_BAD_MODULUS_SIZE

ERR_KEY_GEN_DISABLED

public static final int ERR_KEY_GEN_DISABLED

ERR_EXP_NOT_REL_PRIME

public static final int ERR_EXP_NOT_REL_PRIME

ERR_EXP_SIZE

public static final int ERR_EXP_SIZE

ERR_RNG_MONOBIT_TEST

public static final int ERR_RNG_MONOBIT_TEST

ERR_RNG_POKER_TEST

public static final int ERR_RNG_POKER_TEST

ERR_RNG_RUNS_TEST

public static final int ERR_RNG_RUNS_TEST

ERR_RNG_LONG_RUNS_TEST

public static final int ERR_RNG_LONG_RUNS_TEST

ERR_RNG_ERR_STATE

public static final int ERR_RNG_ERR_STATE

ERR_KAT_FAILURE

public static final int ERR_KAT_FAILURE

ERR_ROM_CRC

public static final int ERR_ROM_CRC

ERR_KEY_CONSISTENCY

public static final int ERR_KEY_CONSISTENCY
Constructor Detail

CibReturnPacket

public CibReturnPacket(int[] rawData)
Construct an instance with the given data.
Parameters:
rawData - - the data of the return packet.

CibReturnPacket

public CibReturnPacket(int csb,
                       int groupID,
                       int[] data)
Construct an instance with the given data.
Parameters:
csb - - Command Status Byte.
groupID - - the group number the command was performed on.
data - - the body of the received data.
Method Detail

getCSB

public int getCSB()
Get the command status byte.
Returns:
the CSB.

getGroupID

public int getGroupID()
Get the group ID of the return packet.
Returns:
the group ID.

getReturnString

public java.lang.String getReturnString()
Get the return data in String format.
Returns:
a String representation of the return body.

getReturnInteger

public int getReturnInteger(int index)
Get a byte of the return data as an integer.
Parameters:
index - - the index into the body of the return data.
Returns:
int the integer requested.

getReturnInteger

public int getReturnInteger()
Get the first byte of the body as an integer.
Returns:
the 0 byte of the body.

getReturnShort

public int getReturnShort(int index)
Get a byte of the return data as an short.
Parameters:
index - - the index into the body of the return data.
Returns:
the short requested.

getReturnShort

public int getReturnShort()
Get the first byte of the body as a short.
Returns:
the 0 byte of the body.

getReturnBytes

public byte[] getReturnBytes()
Get the return data as a byte array.
Returns:
the data returned by the Crypto iButton.

getReturnChars

public char[] getReturnChars()
Get the return data as a char array.
Returns:
the data returned by the Crypto iButton.

getReturnChars

public char[] getReturnChars(int start,
                             int count)
Get the count bytes of return data as a char array beginning at the specified offset.
Parameters:
start - - the offset into the data array.
count - - the number of bytes to read.
Returns:
an array of chars from the iButton.

getReturnInts

public int[] getReturnInts()
Get the return data as an integer array.
Returns:
the return data from the Crypto iButton.