Package com.sun.javacard.apduio
Class Apdu
- java.lang.Object
-
- com.sun.javacard.apduio.Apdu
-
public class Apdu extends java.lang.Object
This class represent a pair of C-APDU and R-APDU. It is used internally by several components of the Java Card development kit.
-
-
Field Summary
Fields Modifier and Type Field Description static int
APDU_TYPE_MASK
Mask to extract APDU type information: either ISO ecoding or not.static int
CASE_1
The value which indicates this Apdu is an ISO 7816-3 Case 1 apdustatic int
CASE_2E
The value which indicates this Apdu is an ISO 7816-3 Case 2 Extended apdustatic int
CASE_2S
The value which indicates this Apdu is an ISO 7816-3 Case 2 Short apdustatic int
CASE_3E
The value which indicates this Apdu is an ISO 7816-3 Case 3 Extended apdustatic int
CASE_3S
The value which indicates this Apdu is an ISO 7816-3 Case 3 Short apdustatic int
CASE_4E
The value which indicates this Apdu is an ISO 7816-3 Case 4 Extended apdustatic int
CASE_4S
The value which indicates this Apdu is an ISO 7816-3 Case 4 Short apdustatic int
CLA
The offset in the command array to the ISO 7816-3 CLA octet.byte[]
command
Internal representation of the C-APDU headerstatic int
COMMAND_ARRAY_SIZE
Size of the command arraybyte[]
dataIn
Data part of the C-APDUbyte[]
dataOut
Data part of the R-APDUboolean
formatOP
Descriptive Output Flagstatic int
INS
The offset in the command array to the ISO 7816-3 INS octet.boolean
isExtended
Extended APDU flagint
Lc
Value of Lcint
Le
Value of Lestatic int
LOGICAL_CHN_MASK
Mask to extract channel information out of the CLA byte.static int
P1
The offset in the command array to the ISO 7816-3 P1 octet.static int
P2
The offset in the command array to the ISO 7816-3 P2 octet.static int
P3
The offset in the command array to the ISO 7816-3 P3 octet.static java.util.Hashtable<java.lang.Object,java.lang.String>
STATUS_CODES
byte[]
sw1sw2
Status as byte array
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCase()
Return the ISO 7816-3 Case of this Apdubyte
getChannelInfo()
Determines the channel numberbyte[]
getCommand()
Get internal representation of the header of the C-APDU The header is just CLA, INS, P1, P2byte[]
getCommandApduBytes()
returns the command APDU as a byte array.byte[]
getDataIn()
Get the data part of the C-APDUbyte[]
getDataOut()
Get the data part of the R-APDUint
getLc()
Get Lcint
getLe()
Get Lebyte[]
getResponseApduBytes()
returns the response APDU as a byte array.int
getStatus()
Get status (SW bytes) as integerbyte[]
getSw1Sw2()
Get status bytesbyte
makeISOInterIndustryCLA(byte CLAByte)
void
setDataIn(byte[] dataIn)
Set the data of the C-APDUvoid
setDataIn(byte[] dataIn, int length)
Set the data of the C-APDUvoid
setDataOut(byte[] dataOut)
Set the data part of the R-APDUvoid
setDataOut(byte[] dataOut, int length)
Set the data part of the R-APDUvoid
setLc(int Lc)
Set the value of Lcvoid
setLe(int Le)
Set Lejava.lang.String
toString()
Generate a string representation of this Apdu in the ApduTool output format.
-
-
-
Field Detail
-
COMMAND_ARRAY_SIZE
public static final int COMMAND_ARRAY_SIZE
Size of the command array- See Also:
- Constant Field Values
-
CLA
public static final int CLA
The offset in the command array to the ISO 7816-3 CLA octet.- See Also:
- Constant Field Values
-
INS
public static final int INS
The offset in the command array to the ISO 7816-3 INS octet.- See Also:
- Constant Field Values
-
P1
public static final int P1
The offset in the command array to the ISO 7816-3 P1 octet.- See Also:
- Constant Field Values
-
P2
public static final int P2
The offset in the command array to the ISO 7816-3 P2 octet.- See Also:
- Constant Field Values
-
P3
public static final int P3
The offset in the command array to the ISO 7816-3 P3 octet.- See Also:
- Constant Field Values
-
CASE_1
public static final int CASE_1
The value which indicates this Apdu is an ISO 7816-3 Case 1 apdu- See Also:
- Constant Field Values
-
CASE_2S
public static final int CASE_2S
The value which indicates this Apdu is an ISO 7816-3 Case 2 Short apdu- See Also:
- Constant Field Values
-
CASE_3S
public static final int CASE_3S
The value which indicates this Apdu is an ISO 7816-3 Case 3 Short apdu- See Also:
- Constant Field Values
-
CASE_4S
public static final int CASE_4S
The value which indicates this Apdu is an ISO 7816-3 Case 4 Short apdu- See Also:
- Constant Field Values
-
CASE_2E
public static final int CASE_2E
The value which indicates this Apdu is an ISO 7816-3 Case 2 Extended apdu- See Also:
- Constant Field Values
-
CASE_3E
public static final int CASE_3E
The value which indicates this Apdu is an ISO 7816-3 Case 3 Extended apdu- See Also:
- Constant Field Values
-
CASE_4E
public static final int CASE_4E
The value which indicates this Apdu is an ISO 7816-3 Case 4 Extended apdu- See Also:
- Constant Field Values
-
LOGICAL_CHN_MASK
public static final int LOGICAL_CHN_MASK
Mask to extract channel information out of the CLA byte.- See Also:
- Constant Field Values
-
APDU_TYPE_MASK
public static final int APDU_TYPE_MASK
Mask to extract APDU type information: either ISO ecoding or not.- See Also:
- Constant Field Values
-
command
public byte[] command
Internal representation of the C-APDU header
-
Lc
public int Lc
Value of Lc
-
dataIn
public byte[] dataIn
Data part of the C-APDU
-
Le
public int Le
Value of Le
-
dataOut
public byte[] dataOut
Data part of the R-APDU
-
sw1sw2
public byte[] sw1sw2
Status as byte array
-
isExtended
public boolean isExtended
Extended APDU flag
-
formatOP
public boolean formatOP
Descriptive Output Flag
-
STATUS_CODES
public static final java.util.Hashtable<java.lang.Object,java.lang.String> STATUS_CODES
-
-
Method Detail
-
getCommand
public byte[] getCommand()
Get internal representation of the header of the C-APDU The header is just CLA, INS, P1, P2- Returns:
- The header of the C-APDU
-
getDataIn
public byte[] getDataIn()
Get the data part of the C-APDU- Returns:
- The data
-
setDataIn
public void setDataIn(byte[] dataIn)
Set the data of the C-APDU- Parameters:
dataIn
- The data
-
setLc
public void setLc(int Lc)
Set the value of Lc- Parameters:
Lc
- value of the Lc
-
setDataIn
public void setDataIn(byte[] dataIn, int length)
Set the data of the C-APDU- Parameters:
dataIn
- The datalength
- the data length
-
getLc
public int getLc()
Get Lc- Returns:
- The Lc
-
setDataOut
public void setDataOut(byte[] dataOut)
Set the data part of the R-APDU- Parameters:
dataOut
- The data
-
setLe
public void setLe(int Le)
Set Le- Parameters:
Le
- value of Le
-
setDataOut
public void setDataOut(byte[] dataOut, int length)
Set the data part of the R-APDU- Parameters:
dataOut
- The datalength
- The data length
-
getLe
public int getLe()
Get Le- Returns:
- The Le
-
getDataOut
public byte[] getDataOut()
Get the data part of the R-APDU- Returns:
- The data part of the R-APDU
-
getSw1Sw2
public byte[] getSw1Sw2()
Get status bytes- Returns:
- The status bytes
-
getStatus
public int getStatus()
Get status (SW bytes) as integer- Returns:
- The status
-
getCase
public int getCase()
Return the ISO 7816-3 Case of this Apdu- Returns:
- An int value indicating the ISO case.
-
getChannelInfo
public byte getChannelInfo()
Determines the channel number- Returns:
- The channel number
-
makeISOInterIndustryCLA
public byte makeISOInterIndustryCLA(byte CLAByte)
-
getCommandApduBytes
public byte[] getCommandApduBytes()
returns the command APDU as a byte array.- Returns:
- The command APDU
-
getResponseApduBytes
public byte[] getResponseApduBytes()
returns the response APDU as a byte array.- Returns:
- The response APDU
-
toString
public java.lang.String toString()
Generate a string representation of this Apdu in the ApduTool output format.- Overrides:
toString
in classjava.lang.Object
- Returns:
- String representation of this Apdu
-
-