opencard.opt.database
Class DataObject

java.lang.Object
  extended by opencard.opt.database.DataObject
All Implemented Interfaces:
DatabaseCardService.Constants

public class DataObject
extends java.lang.Object
implements DatabaseCardService.Constants


Field Summary
static char INHIBITOR
           
static char SEPARATOR
           
 
Fields inherited from interface opencard.opt.database.DatabaseCardService.Constants
BEGIN, COMMIT, CREATE_DICTIONARY, CREATE_TABLE, CREATE_USER, CREATE_VIEW, DECLARE_CURSOR, DELETE, DELETE_USER, DROP_TABLE, DROP_VIEW, EQUAL_TO, FETCH, FETCH_NEXT, GRANT, GREATER_THAN, GREATER_THAN_OR_EQUAL_TO, INSERT, LESS_THAN, LESS_THAN_OR_EQUAL_TO, NEXT, NOT_EQUAL_TO, OPEN, PRESENT_USER, PRIV_ALL, PRIV_DELETE, PRIV_INSERT, PRIV_SELECT, PRIV_UPDATE, REVOKE, ROLLBACK, SCQL_OPERATION, SW1_CHECK_ERROR, SW1_COMMAND_NOT_ALLOWED, SW1_EXEC_ERROR, SW1_INSTRUCTION_CODE_NOT_SUPPORTED, SW1_OK, SW1_OK_WITH_RETURN, SW1_WARNING, SW1_WRONG_LENGTH, SW1_WRONG_PARAM, SW2_CHECK_ERROR, SW2_COMMAND_NOT_ALLOWED, SW2_EXEC_ERROR, SW2_INCORRECT_PARAM, SW2_INSTRUCTION_CODE_NOT_SUPPORTED, SW2_MEM_FAILURE, SW2_OBJECT_ALREADY_EXISTS, SW2_OBJECT_NOT_FOUND, SW2_OK, SW2_OPERATION_NOT_SUPPORTED, SW2_REQUIRED_OPERATION, SW2_SECURITY, SW2_WARNING, SW2_WRONG_PARAM, TAG_CH_CERTIFICATE_1, TAG_CH_CERTIFICATE_2, TAG_CH_NAME_1, TAG_CH_NAME_2, TRANSACTION_OPERATION, UPDATE, USER_OPERATION
 
Constructor Summary
DataObject()
           
 
Method Summary
static byte[] bodyAPDU(byte[] b)
          Builds the body of the APDU command from a byte array.
static byte[] bodyAPDU(java.lang.String c)
          Builds the body of the APDU command from a String.
protected static byte charToHex(char c)
          Transforms a char into its hexadecimal value.
protected static java.lang.String[] dictionaryResponseToString(char systemTableType, ResponseAPDU resp)
           
static byte[] headerAPDU(byte CLA, byte INS, byte P1, byte P2)
          Builds the header of the APDU command.
static byte[] headerAPDU(byte CLA, byte INS, byte P1, byte P2, byte lc_size)
          Builds the header of the APDU command.
protected static char hexToChar(byte b)
          Transforms a hexadecimal value into its char value.
protected static void isDictionaryIdentifier(java.lang.String s)
           
protected static void isIdentifier(java.lang.String s)
           
protected static boolean isOperator(char c)
          Test if the character passed as parameter is an operator of comparison or not.
protected static byte operator(java.lang.String condition)
          This method converts a string value of an operator into its byte value.
protected static byte parsePrivilege(java.lang.String priv)
          This method parses a String describing the privileges and builds a corresponding byte value.
protected static java.lang.String[] parseString(java.lang.String s)
          Allows to parse a string composed of severals parameters into an array of Strings.
protected static java.lang.String[] responseToString(ResponseAPDU resp)
          Converts a response APDU sent back by the smartcard into a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INHIBITOR

public static final char INHIBITOR
See Also:
Constant Field Values

SEPARATOR

public static final char SEPARATOR
See Also:
Constant Field Values
Constructor Detail

DataObject

public DataObject()
Method Detail

isIdentifier

protected static void isIdentifier(java.lang.String s)
                            throws opencard.opt.database.WrongIdentifierSyntaxException
Throws:
opencard.opt.database.WrongIdentifierSyntaxException

isDictionaryIdentifier

protected static void isDictionaryIdentifier(java.lang.String s)
                                      throws opencard.opt.database.WrongIdentifierSyntaxException
Throws:
opencard.opt.database.WrongIdentifierSyntaxException

isOperator

protected static boolean isOperator(char c)
Test if the character passed as parameter is an operator of comparison or not. Returns True if the character is an operator and False otherwise.

Parameters:
c - The character to be tested.
Returns:
True or False.

parsePrivilege

protected static byte parsePrivilege(java.lang.String priv)
This method parses a String describing the privileges and builds a corresponding byte value.
Privileges must be as follow :

Parameters:
priv - The list of privileges, each privilege is separated from the next one by a coma.
Returns:
the byte value of the privileges.

operator

protected static byte operator(java.lang.String condition)
This method converts a string value of an operator into its byte value.

Parameters:
condition - The operator to determine the value, coded on 1 or 2 characters.
Returns:
The byte value which represents the operator.

dictionaryResponseToString

protected static java.lang.String[] dictionaryResponseToString(char systemTableType,
                                                               ResponseAPDU resp)

responseToString

protected static java.lang.String[] responseToString(ResponseAPDU resp)
Converts a response APDU sent back by the smartcard into a string.

Parameters:
resp - The response APDU to get the string value of.
Returns:
The array of strings that contains the parsed resp parameter.

parseString

protected static java.lang.String[] parseString(java.lang.String s)
Allows to parse a string composed of severals parameters into an array of Strings.

Parameters:
s - The String to be parsed.
Returns:
an array which contains the list of the parameters which composed the string s.

charToHex

protected static byte charToHex(char c)
Transforms a char into its hexadecimal value.

Parameters:
c - The character to transform into its hexadecimal value.
Returns:
The Hexadecimal value of the character.

hexToChar

protected static char hexToChar(byte b)
Transforms a hexadecimal value into its char value.

Parameters:
c - The hexadecimal value to transform into its character value.
Returns:
The computed character.

bodyAPDU

public static byte[] bodyAPDU(java.lang.String c)
Builds the body of the APDU command from a String.

Parameters:
c - The string used to build the ADPU command.
Returns:
An array of bytes which represents the body of the APDU command.

bodyAPDU

public static byte[] bodyAPDU(byte[] b)
Builds the body of the APDU command from a byte array.
It is similar to the method using a String.

Parameters:
b - The byte array used to build the ADPU command.
Returns:
An array of bytes which represents the body of the APDU command.

headerAPDU

public static byte[] headerAPDU(byte CLA,
                                byte INS,
                                byte P1,
                                byte P2)
Builds the header of the APDU command.

Parameters:
CLA - Represents the CLA byte value of the APDU command.
INS - Represents the INS byte value of the APDU command.
P1 - Represents the P1 byte value of the APDU command.
P2 - Represents the P2 byte value of the APDU command.
Returns:
An array of bytes which represents the header of the APDU command.
See Also:
(byte, byte, byte, byte, byte)

headerAPDU

public static byte[] headerAPDU(byte CLA,
                                byte INS,
                                byte P1,
                                byte P2,
                                byte lc_size)
Builds the header of the APDU command.

Parameters:
CLA - Represents the CLA byte value of the APDU command.
INS - Represents the INS byte value of the APDU command.
P1 - Represents the P1 byte value of the APDU command.
P2 - Represents the P2 byte value of the APDU command.
le_size - Represents the Le byte value of the APDU command, i.e. the expected length of returned data.
Returns:
An array of bytes which represents the header of the APDU command.
See Also:
(byte, byte, byte, byte)