Class Index | File Index

Classes


Class APDU

Class implementing support for command and response APDUs
Defined in: APDU.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
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)
Method Summary
Method Attributes Method Name and Description
 
Create an APDU object from the encoded form (Called internally)
 
Gets the command data
 
Gets the command data as a list of TLV objects
 
Gets the class byte
 
Get encoded command APDU
 
Gets the instruction byte
 
Gets the number of expected bytes
 
Gets the P1 byte
 
Gets the P2 byte
 
Get the response data
 
Get encoded response APDU
 
Return the secure channel, if any
 
Get the status word
 
Check if APDU has command data
 
Check if APDU has Le field
 
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
 
Test if command uses extended length
 
Test if command is an ISO command
 
Test if command is send using secure messaging
 
setCData(cdata)
Set the command data
 
setCLA(cla)
Sets the class byte, e.g.
 
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
 
Return a human readable form of this object
 
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} isExtendedLength()
Test if command uses extended length
Returns:
true if APDU uses extended length

{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

setCLA(cla)
Sets the class byte, e.g. after a transformation
Parameters:
cla

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

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Feb 16 2024 18:38:11 GMT+0100 (CET)