Class APDU
Class implementing support for command and response APDUs
Defined in: apdu.js.
Constructor Attributes | Constructor Name and Description |
---|---|
APDU(command, cla, ins, p1, p2, data, Ne)
Create an APDU
This constructor supports the signatures
|
Method Attributes | Method Name and Description |
---|---|
fromByteString(bs)
Create an APDU object from the encoded form (Called internally)
|
|
getCData()
Gets the command data
|
|
Gets the command data as a list of TLV objects
|
|
getCLA()
Gets the class byte
|
|
Get encoded command APDU
|
|
getINS()
Gets the instruction byte
|
|
getNe()
Gets the number of expected bytes
|
|
getP1()
Gets the P1 byte
|
|
getP2()
Gets the P2 byte
|
|
getRData()
Get the response data
|
|
Get encoded response APDU
|
|
Return the secure channel, if any
|
|
getSW()
Get the status word
|
|
hasCData()
Check if APDU has command data
|
|
hasLe()
Check if APDU has Le field
|
|
hasRData()
Check if APDU has response data
|
|
Test if a secure channel is defined for this APDU
|
|
Test if command is send using secure messaging
|
|
Test if command chaining is indicated
|
|
isISO()
Test if command is an ISO command
|
|
Test if command is send using secure messaging
|
|
setCData(cdata)
Set the command data
|
|
setRData(data)
Sets the response data field for the response APDU
|
|
setSecureChannel(secureChannel)
Set secure channel object to be used in wrap and unwrap methods
|
|
setSW(sw)
Sets the status word for the response ADPU
|
|
<static> |
APDU.test()
Simple unit test
|
toString()
Return a human readable form of this object
|
|
unwrap()
Unwrap APDU using secure channel
|
|
wrap()
Wrap APDU using secure channel
|
Class Detail
APDU(command, cla, ins, p1, p2, data, Ne)
Create an APDU
This constructor supports the signatures
- APDU(ByteString command)
- APDU(Number cla, Number ins, Number p1, Number p2)
- APDU(Number cla, Number ins, Number p1, Number p2, data)
- APDU(Number cla, Number ins, Number p1, Number p2, data, Ne)
- Parameters:
- {ByteString} command
- the command APDU
- {Number} cla
- the class byte
- {Number} ins
- the instruction byte
- {Number} p1
- the first parameter
- {Number} p2
- the second parameter
- {ByteString} data
- the data field (optional)
- {Number} Ne
- the number of expected bytes (optional)
Method Detail
fromByteString(bs)
Create an APDU object from the encoded form (Called internally)
- Parameters:
- {ByteString} bs
{ByteString}
getCData()
Gets the command data
- Returns:
- the command data, if any else undefined
{TLVList}
getCDataAsTLVList()
Gets the command data as a list of TLV objects
- Returns:
- the command data as TLV list, if any else undefined
{Number}
getCLA()
Gets the class byte
- Returns:
- the class byte
{ByteString}
getCommandAPDU()
Get encoded command APDU
- Returns:
- the encoded command APDU
{Number}
getINS()
Gets the instruction byte
- Returns:
- the instruction byte
{Number}
getNe()
Gets the number of expected bytes
- Returns:
- the number of expected bytes or undefined
{Number}
getP1()
Gets the P1 byte
- Returns:
- the P1 byte
{Number}
getP2()
Gets the P2 byte
- Returns:
- the P2 byte
{ByteString}
getRData()
Get the response data
- Returns:
- the response data
{ByteString}
getResponseAPDU()
Get encoded response APDU
- Returns:
- the encoded response APDU
{SecureChannel}
getSecureChannel()
Return the secure channel, if any
- Returns:
- the secure channel
{Number}
getSW()
Get the status word
- Returns:
- the status word
{boolean}
hasCData()
Check if APDU has command data
- Returns:
- true if command APDU has data field
{boolean}
hasLe()
Check if APDU has Le field
- Returns:
- true if command APDU has Le field
{boolean}
hasRData()
Check if APDU has response data
- Returns:
- true if response APDU has data field
{boolean}
hasSecureChannel()
Test if a secure channel is defined for this APDU
- Returns:
- true, if secure channel is set
{boolean}
isAuthenticatedHeader()
Test if command is send using secure messaging
- Returns:
- true if secure messaging is using an authenticated header
{boolean}
isChained()
Test if command chaining is indicated
- Returns:
- true if chaining bit is set
{boolean}
isISO()
Test if command is an ISO command
- Returns:
- true if command has ISO class byte
{boolean}
isSecureMessaging()
Test if command is send using secure messaging
- Returns:
- true if secure messaging is indicated in CLA byte
setCData(cdata)
Set the command data
- Parameters:
- {ByteString} cdata
- the command data
setRData(data)
Sets the response data field for the response APDU
- Parameters:
- {ByteString} data
- the response data field
setSecureChannel(secureChannel)
Set secure channel object to be used in wrap and unwrap methods
- Parameters:
- {SecureChannel} secureChannel
- the channel
setSW(sw)
Sets the status word for the response ADPU
- Parameters:
- {Number} sw
- the status word
<static>
APDU.test()
Simple unit test
toString()
Return a human readable form of this object
unwrap()
Unwrap APDU using secure channel
wrap()
Wrap APDU using secure channel