6.2.8 Class ProactiveResponseHandler

3GPP51.013Release 17Test specification for Subscriber Identity Module (SIM) Application Programming Interface (API) for Java CardTS

6.2.8.1 Method copyAdditionalInformation

Test Area Reference: API_2_PRH_CPAI_BSS

6.2.8.1.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public short copyAdditionalInformation(byte[] dstBuffer,

short dstOffset,

short dstLength)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.8.1.1.1 Normal execution

  • CRRN1: The copyAdditionalInformation() method shall copy a part of the additional information field from Result TLV element in dstBuffer, using dstOffset and dstLength.
  • CRRN2: dstBuffer shall only be modified from dstOffset to (dstOffset + dstLength – 1) (included).
  • CRRN3: The method returns (dstOffset + dstLength).
  • CRRN4: If a Result TLV element is available, it becomes the TLV selected after a call to the method.
  • CRRN5: The method shall copy from the first Result TLV.

6.2.8.1.1.2 Parameter errors

  • CRRP1: A NullPointerException shall be thrown if dstBuffer is null.
  • CRRP2: An ArrayIndexOutOfBoundsException shall be thrown if dstOffset or dstLength or both would cause access outside array bounds.

6.2.8.1.1.3 Context errors

  • CRRC1: A ToolkitException.UNAVAILABLE_ELEMENT shall be thrown in case of unavailable Result TLV element.
  • CRRC2: A ToolkitException.OUT_OF_TLV_BOUNDARIES shall be thrown if dstLength is greater than the value field of the available TLV.

6.2.8.1.2 Test Suite files

Test Script: API_2_PRH_CPAI_BSS_1.scr

Test Applet: API_2_PRH_CPAI_BSS_1.java

Load Script: API_2_PRH_CPAI_BSS_1.ldr

Cleanup Script: API_2_PRH_CPAI_BSS_1.clr

Parameter File: API_2_PRH_CPAI_BSS_1.par

6.2.8.1.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Build and send a DISPLAY TEXT command

qualifier = 0

dcs = 4

buffer = "Text"

DISPLAY TEXT Proactive command

Terminal Response with 11 additional bytes

Result TLV = 03 0C 01 01 23 45 67 89 AB CD EF 01 23 45

NULL as parameter to dstBuffer

dstBuffer = NULL

NullPointerException is thrown

2

dstOffset > dstBuffer.length

dstBuffer.length = 10

dstOffset = 11

dstLength = 0

ArrayIndexOutOfBoundsException is thrown

3

dstOffset < 0

dstBuffer.length = 10

dstOffset = -1

dstLength = 1

ArrayIndexOutOfBoundsException is thrown

4

dstLength > dstBuffer.length

dstBuffer.length = 10

dstOffset = 0

dstLength = 11

ArrayIndexOutOfBoundsException is thrown

5

dstOffset + dstLength > dstBuffer.length

dstBuffer.length = 10

dstOffset = 6

dstLength = 5

ArrayIndexOutOfBoundsException is thrown

6

dstLength < 0

dstBuffer.length = 10

dstOffset = 6

dstLength = -1

ArrayIndexOutOfBoundsException is thrown

7

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with 5 additional bytes

Result TLV = 03 06 01 01 23 45 67 89

Successful call, dstBuffer is the whole buffer

dstBuffer.length = 5

dstOffset = 0

dstLength = 5

result of copyAdditionalInformation() is 05h.

8

Compare dstBuffer using arrayCompare()

src = {01, 23, 45, 67, 89}

srcOffset = 00

dest = dstBuffer

destOffset = 0

length = 5

result of arrayCompare() is 00h.

9

Call the getValueLength() method

Result is 06h.

10

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with 6 additional bytes

Result TLV = 03 07 01 AB CD EF FE DC BA

Successful call, dstBuffer is part of a buffer

dstBuffer.length = 7

dstOffset = 2

dstLength = 5

result of copyAdditionalInformation() is 07h.

11

Compare dstBuffer using arrayCompare()

src = {AB, CD, EF, FE, DC}

srcOffset = 00

dest = dstBuffer

destOffset = 2

length = 5

result of arrayCompare() is 00h.

12

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with 7 additional bytes

Result TLV = 03 08 01 FE DC BA 98 76 54 32

Successful call, dstBuffer is part of a buffer

dstBuffer.length = 7

dstOffset = 0

dstLength = 5

result of copyAdditionalInformation() is 05h.

13

Compare dstBuffer using arrayCompare()

src = {FE, DC, BA, 98, 76}

srcOffset = 00

dest = dstBuffer

destOffset = 0

length = 5

result of arrayCompare() is 00h.

14

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with 8 additional bytes

Result TLV = 03 09 01 00 11 22 33 44 55 66 77

Successful call, dstBuffer is the whole buffer

dstBuffer.length = 9

dstOffset = 2

dstLength = 5

result of copyAdditionalInformation() is 07h.

15

Compare dstBuffer using arrayCompare()

src = {00, 11, 22, 33, 44}

srcOffset = 00

dest = dstBuffer

destOffset = 2

length = 5

result of arrayCompare() is 00h.

16

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with F2h additional bytes

Result TLV = 03 81 F3 01 00 01 02 03…

Successful call to the method

dstBuffer.length = F2h

dstOffset = 0

dstLength = F2h

result of copyAdditionalInformation() is F2h.

17

Compare dstBuffer using arrayCompare()

src = {00, 01, 02, 03, 04…}

srcOffset = 00

dest = dstBuffer

destOffset = 0

length = F2h

result of arrayCompare() is 00h.

18

Call the getValueLength() method

Result is F3h.

19

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with 5 additional bytes

Result TLV = 03 06 01 00 11 22 33 44

dstLength > data available

dstBuffer.length = 6

dstOffset = 0

dstLength = 6

OUT_OF_TLV_BOUNDARIES ToolkitException is thrown

20

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with 5 additional bytes

Result TLV = 03 06 01 00 11 22 33 44

Initialise dstBuffer

dstBuffer = {00h, 01h, 02h, 03h…}

Call the copyAdditionalInformation() method

dstBuffer.length = 20

dstOffset = 5

dstLength = 5

Compare dstBuffer using arrayCompare()

src = {

00h, 01h, 02h, 03h, 04h,

00h, 11h, 22h, 33h, 44h,

0Ah, 0Bh, 0Ch, 0Dh, 0Eh,

0Fh, 10h, 11h, 12h, 13h}

srcOffset = 0

dest = dstBuffer

destOffset = 0

length = 20

result of arrayCompare() is 00h

21

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with 2 Result TLV elements

1st Result TLV = 03 06 01 01 23 45 67 89

2nd Result TLV = 03 01 00

Successful call to copyAdditionalInformation()

dstBuffer.length = 5

dstOffset = 0

dstLength = 5

result of copyAdditionalInformation() is 05h.

22

Compare dstBuffer using arrayCompare()

src = {01, 23, 45, 67, 89}

srcOffset = 00

dest = dstBuffer

destOffset = 0

length = 5

result of arrayCompare() is 00h.

23

Call the getValueLength() method

Result is 06h.

24

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response without Result Simple TLV

ToolkitException.UNAVAILABLE_ELEMENT is thrown by send()

ProactiveResponseHandler, getTheHandler call copyAdditionalInformation()

ToolkitException.UNAVAILABLE_ELEMENT is thrown

6.2.8.1.4 Test Coverage

CRR number

Test case number

N1

8, 11, 13, 15, 17, 20, 22

N2

20

N3

7, 10, 12, 14, 16, 21

N4

9, 18, 23

N5

21, 22, 23

P1

1

P2

2, 3, 4, 5, 6

C1

24

C2

19

6.2.8.2 Method copyTextString

Test Area Reference: API_2_PRH_CPTS_BS

6.2.8.2.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public short copyTextString(byte[] dstBuffer,

short dstOffset)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.8.2.1.1 Normal execution

  • CRRN1: The copyTextString() method copies the text string value from the first Text String TLV element, using dstBuffer and dstOffset.
  • CRRN2: If a Text String TLV element is available, it becomes the TLV selected.
  • CRRN3: The method returns (dstOffset + length of copied value).

6.2.8.2.1.2 Parameter errors

  • CRRP1: A NullPointerException shall be thrown if dstBuffer is null.
  • CRRP2: A ArrayIndexOutOfBoundsException shall be thrown if dstOffset or dstOffset + (length of the TextString to be copied, without the Data Coding Scheme included), as specified for the returned value, would cause access outside array bounds.

6.2.8.2.1.3 Context errors

  • CRRC1: A ToolkitException.UNAVAILABLE_ELEMENT shall be thrown in case of unavailable Text String TLV element.

6.2.8.2.2 Test Suite files

Test Script: API_2_PRH_CPTS_BS_1.scr

Test Applet: API_2_PRH_CPTS_BS_1.java

Load Script: API_2_PRH_CPTS_BS_1.ldr

Cleanup Script: API_2_PRH_CPTS_BS_1.clr

Parameter File: API_2_PRH_CPTS_BS_1.par

6.2.8.2.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Build and send a GET INPUT command

qualifier = 00h

dcs = 04h

buffer = ‘Text’

minRespLength = 00h

maxRespLength = FFh

GET INPUT Proactive command

Terminal Response

Text String TLV = 0D 02 04 41

ProactiveResponseHandler.getTheHandler() ; call the copyTextString() method with a null dstBuffer

dstBuffer = null

dstOffset = 0

NullPointerException is thrown

2

Build and send a GET INPUT command

GET INPUT Proactive command

Proactive

Terminal Response

Text String TLV = 0D 04 04 "ABC"

dstOffset + text length > dstBuffer.length

dstBuffer.length = 04h

dstOffset = 02h

ArrayIndexOutOfBoundsException is thrown

3

dstOffset < 0

dstBuffer.length = 04h

dstOffset = -1

ArrayIndexOutOfBoundsException is thrown

4

Build and send a DISPLAY TEXT command

qualifier = 00h

dcs = 04h

buffer = ‘Text’

DISPLAY TEXT

Proactive command

Terminal Response without Text String TLV

ProactiveResponseHandler.getTheHandler() ; call the copyTextString() method

UNAVAILABLE_ELEMENT ToolkitException is thrown

5

Build and send a GET INPUT command

GET INPUT Proactive command

Proactive

Terminal Response with a null Text String TLV

Text String TLV = 0D 00

Initialise dstBuffer

dstBuffer = {F00h, F01h, F02h, F03h}

Call the copyTextString() method

dstBuffer.length = 04h

dstOffset = 02h

Result of copyTextString() is 02h

6

Compare dstBuffer using arrayCompare()

src = {0F0h, 0F1h, 0F2h, 0F3h}

srcOffset = 00h

dest = dstBuffer

destOffset = 00h

length = 04h

Result of arrayCompare() is 00h

7

Build and send a GET INPUT command

GET INPUT Proactive command

Proactive

Terminal Response with text length = 01h

Text String TLV = 0D 02 04 41

Initialise dstBuffer

dstBuffer = {00h, 01h, 02h, 03h}

Call the copyTextString() method

dstBuffer.length = 04h

dstOffset = 00h

Result of copyTextString() is 01h

8

Compare dstBuffer using arrayCompare()

src = {41h, 01h, 02h, 03h}

srcOffset = 00h

dest = dstBuffer

destOffset = 00h

length = 04h

Result of arrayCompare() is 00h

9

Build and send a GET INPUT command

GET INPUT Proactive command

Proactive

Terminal Response with text length = 02h

Text String TLV = 0D 03 04 42 43

Initialise dstBuffer

dstBuffer = {00h, 01h, 02h, 03h}

Call the copyTextString() method

dstBuffer.length = 04h

dstOffset = 02h

Result of copyTextString() is 04h

10

Compare dstBuffer using arrayCompare()

src = {00h, 01h, 42h, 43h}

srcOffset = 00h

dest = dstBuffer

destOffset = 00h

length = 04h

Result of arrayCompare() is 00h

11

Call the getValueLength() method

Result is 03h

12

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = 7Eh

Text String TLV = 0D 7F 04 01 02 … 7E

Initialise dstBuffer

dstBuffer = {00h, 00h … 00h}

Call the copyTextString() method

dstBuffer.length = 7Eh

dstOffset = 00h

Result of copyTextString() is 7Eh

13

Compare dstBuffer using arrayCompare()

src = {01h, …, 7Eh}

srcOffset = 00h

dest = dstBuffer

destOffset = 00h

length = 7Eh

Result of arrayCompare() is 00h

14

Call the getValueLength() method

Result is 7Fh

15

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = 7Fh

Text String TLV = 0D 81 80 04 01 02 …7F

Initialise dstBuffer

dstBuffer = {00h, 01h … FFh}

Call the copyTextString() method

dstBuffer.length = FFh

dstOffset = 10h

Result of copyTextString() is 8Fh

16

Compare dstBuffer using arrayCompare()

src = {00h, 01h,… 0Fh,

01h, …7Fh, 8Fh, … FFh}

srcOffset = 00h

dest = dstBuffer

destOffset = 00h

length = FFh

Result of arrayCompare() is 00h

17

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = EFh

Text String TLV = 0D 81 F0 04 01 02 … EF

Initialise dstBuffer

dstBuffer = {00h, 00h … 00h}

Call the copyTextString() method

dstBuffer.length = FFh

dstOffset = 00h

Result of copyTextString() is EFh

18

Compare dstBuffer using arrayCompare()

src = {01h, …EFh, 00h … 00h }

srcOffset = 00h

dest = dstBuffer

destOffset = 00h

length = FFh

Result of arrayCompare() is 00h

19

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with two Text String TLV

1st Text String TLV = 0D 03 04 42 43

2nd Text String TLV = 0D 02 04 44

Initialise dstBuffer

dstBuffer = {00h, 01h, 02h, 03h}

Call the copyTextString() method

dstBuffer.length = 04h

dstOffset = 02h

Result of copyTextString() is 04h

20

Compare dstBuffer using arrayCompare()

src = {00h, 01h, 42h, 43h}

srcOffset = 00h

dest = dstBuffer

destOffset = 00h

length = 04h

Result of arrayCompare() is 00h

21

Call the getValueLength() method

Result is 03h

6.2.8.2.4 Test Coverage

CRR number

Test case number

N1

6, 8, 10, 13, 16, 18, 20

N2

11, 14, 21

N3

5, 7, 9, 12, 15, 17, 19

P1

1

P2

2, 3

C1

4

6.2.8.3 Method getAdditionalInformationLength

Test Area Reference: API_2_PRH_GTIL

6.2.8.3.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public short getAdditionalInformationLength()

throws ToolkitException

6.2.8.3.1.1 Normal execution

  • CRRN1: This method returns the length of the additional information field from the first Result TLV in the ProactiveResponseHandler.
  • CRRN2: After a successful execution of the method, the Result TLV becomes the selected TLV of the ProactiveResponseHandler.

6.2.8.3.1.2 Parameter errors

No requirements.

6.2.8.3.1.3 Context errors

  • CRRC1: A ToolkitException.UNAVAILABLE_ELEMENT shall be thrown in case of unavailable Result TLV element.

6.2.8.3.2 Test Suite files

Test Script: API_2_PRH_GTIL_1.scr

Test Applet: API_2_PRH_GTIL_1.java

Load Script: API_2_PRH_GTIL_1.ldr

Cleanup Script: API_2_PRH_GTIL_1.clr

Parameter File: API_2_PRH_GTIL_1.par

6.2.8.3.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Build and send a DISPLAY TEXT command

qualifier = 00h

dcs = 04h

buffer = ‘Text’

DISPLAY TEXT Proactive command

Terminal Response without additional information

ProactiveResponseHandler.getTheHandler() ; call the getAdditionalInformationLength() method

Result is 00h

2

Call the getValueLength() method

Result is 01h

3

Build and send a DISPLAY TEXT command

DISPLAY TEXT ProactiveProactive command

Terminal Response with 1 additional byte

Result TLV = 03 02 02 55

ProactiveResponseHandler.getTheHandler() ; call the getAdditionalInformationLength() method

Result is 01h

4

Call the getValueLength() method

Result is 02h

5

Build and send a DISPLAY TEXT command

DISPLAY TEXT ProactiveProactive command

Terminal Response with 7Eh additional bytes

Result TLV = 03 7F 02 55 55 55 …

ProactiveResponseHandler.getTheHandler() ; call the getAdditionalInformationLength() method

Result is 7Eh

6

Call the getValueLength() method

Result is 7Fh

7

Build and send a DISPLAY TEXT command

DISPLAY TEXT

Proactive command

Terminal Response with 7Fh additional bytes

Result TLV = 03 81 80 02 55 55 55 …

ProactiveResponseHandler.getTheHandler() ; call the getAdditionalInformationLength() method

Result is 7Fh

8

Call the getValueLength() method

Result is 80h

9

Build and send a DISPLAY TEXT command

DISPLAY TEXT

Proactive command

Terminal Response with 80h additional bytes

Result TLV = 03 81 81 02 55 55 55 …

ProactiveResponseHandler.getTheHandler() ; call the getAdditionalInformationLength() method

Result is 80h

10

Call the getValueLength() method

Result is 81h

11

Build and send a DISPLAY TEXT command

DISPLAY TEXT

Proactive command

Terminal Response with F2h additional bytes

Result TLV = 03 81 F3 02 55 55 55 …

ProactiveResponseHandler.getTheHandler() ; call the getAdditionalInformationLength() method

Result is F2h

12

Call the getValueLength() method

Result is F3h

13

Build and send a DISPLAY TEXT command

DISPLAY TEXT

Proactive command

Terminal Response with 2 Result TLV

1st Result TLV = 03 03 02 01 23

2nd Result TLV = 03 01 00

ProactiveResponseHandler.getTheHandler() ; call the getAdditionalInformationLength() method

Result is 02h

14

Call the getValueLength() method

Result is 03h

15

Build and send a DISPLAY TEXT command

DISPLAY TEXT

Proactive command

Terminal Response without Result Simple TLV

ToolkitException.UNAVAILABLE_ELEMENT is thrown by send()

Get ProactiveResponseHandler

Call the getAdditionalInformationLength() method

ToolkitException.UNAVAILABLE_ELEMENT is thrown by getAdditionalInformationLength ()

6.2.8.3.4 Test Coverage

CRR number

Test case number

N1

1, 3, 5, 7, 9, 11, 13

N2

2, 4, 6, 8, 10, 12, 14

C1

15

6.2.8.4 Method getGeneralResult

Test Area Reference: API_2_PRH_GTGR

6.2.8.4.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public byte getGeneralResult()

throws ToolkitException

6.2.8.4.1.1 Normal execution

  • CRRN1: This method returns the general result of a proactive command.
  • CRRN2: After a successful execution of the method, the Result TLV becomes the selected TLV of the ProactiveResponseHandler.

6.2.8.4.1.2 Parameter errors

No requirements.

6.2.8.4.1.3 Context errors

  • CRRC1: A ToolkitException.UNAVAILABLE_ELEMENT shall be thrown in case of unavailable Result TLV element.
  • CRRC2: A ToolkitException.OUT_OF_TLV_BOUNDARIES shall be thrown if the general result byte is missing in the Result Simple TLV.

6.2.8.4.2 Test Suite files

Test Script: API_2_PRH_GTGR_1.scr

Test Applet: API_2_PRH_GTGR_1.java

Load Script: API_2_PRH_GTGR_1.ldr

Cleanup Script: API_2_PRH_GTGR_1.clr

Parameter File: API_2_PRH_GTGR_1.par

6.2.8.4.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Build and send a DISPLAY TEXT command

qualifier = 00h

dcs = 04h

buffer = ‘Text’

DISPLAY TEXT Proactive command

Terminal Response with General Result = 00 (command performed successfully)

ProactiveResponseHandler.getTheHandler()

Call the getGeneralResult() method

Result of getGeneralResult() is 00h

2

Call the getValueLength() method

Result is 01h

3

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with General Result = 01, without Additional information on result (command performed with partial comprehension)

ProactiveResponseHandler.getTheHandler()

Call the getGeneralResult() method

Result of getGeneralResult() is 01h

4

Call the getValueLength() method

Result is 01h

5

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with General Result = 01, with Additional information on result

Result TLV = 03 02 01 55 (command performed with partial comprehension)

ProactiveResponseHandler.getTheHandler()

Call the getGeneralResult() method

Result of getGeneralResult() is 01h

6

Call the getValueLength() method

Result is 02h

7

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with General Result = 02

Result TLV = 03 04 02 65 43 21 (Missing information)

ProactiveResponseHandler.getTheHandler()

Call the getGeneralResult() method

Result of getGeneralResult() is 02h

8

Call the getValueLength() method

Result is 04h

9

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with 7Fh additional bytes

Result TLV = 03 81 80 02 55 55 55 …

ProactiveResponseHandler.getTheHandler() ; call the getGeneralResult() method

Result is 02h

10

Call the getValueLength() method

Result is 80h

11

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with 2 Result TLV

1st Result TLV = 03 02 02 12

2nd Result TLV = 03 03 03 34 56

ProactiveResponseHandler.getTheHandler() ; call the getGeneralResult() method

Result is 02h

12

Call the getValueLength() method

Result is 02h

13

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response without Result Simple TLV

ProactiveResponseHandler.getTheHandler() ; call the getGeneralResult() method

UNAVAILABLE_ELEMENT ToolkitException is thrown

14

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response without General Result Byte in Result Simple TLV

ProactiveResponseHandler.getTheHandler() ; call the getGeneralResult() method

Result TLV = 03 00

OUT_OF_TLV_BOUNDARIES ToolkitException is thrown

6.2.8.4.4 Test Coverage

CRR number

Test case number

N1

1, 3, 5, 7, 9, 11

N2

2, 4, 6, 8, 10, 12

C1

13

C2

14

6.2.8.5 Method getItemIdentifier

Test Area Reference: API_2_PRH_GTII

6.2.8.5.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public byte getItemIdentifier()

throws ToolkitException

6.2.8.5.1.1 Normal execution

  • CRRN1: The method returns the item identifier byte value from the first Item Identifier TLV element.
  • CRRN2: If an Item Identifier TLV element is available, it becomes the TLV selected.

6.2.8.5.1.2 Parameter errors

No requirements.

6.2.8.5.1.3 Context errors

  • CRRC1: A ToolkitException.UNAVAILABLE_ELEMENT shall be thrown in case of unavailable Item Identifier TLV element.
  • CRRC2: A ToolkitException.OUT_OF_TLV_BOUNDARIES shall be thrown if the item identifier byte is missing in the Item Identifier Simple TLV.

6.2.8.5.2 Test Suite files

Test Script: API_2_PRH_GTII_1.scr

Test Applet: API_2_PRH_GTII_1.java

Load Script: API_2_PRH_GTII_1.ldr

Cleanup Script: API_2_PRH_GTII_1.clr

Parameter File: API_2_PRH_GTII_1.par

6.2.8.5.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response (no Item Identifier TLV available)

Call to getItemIdentifier() with unavailable Item Identifier TLV

UNAVAILABLE_ELEMENT ToolkitException is thrown

2

Build and send a SELECT ITEM command with 2 items (ID=01, 02)

SELECT ITEM Proactive command

Terminal Response with Item 1 selected

Item Identifier TLV = 10 01 01

Call the getItemIdentifier() method

Result is 01h

3

Call the getValueByte() method

valueOffset = 00h

Result is 01h

4

Build and send a SELECT ITEM command with 3 items (ID=03, 05, 07)

SELECT ITEM Proactive command

Terminal Response with Item 5 selected

Item Identifier TLV = 10 01 05

Call the getItemIdentifier() method

Result is 05h

5

Call the getValueByte() method

valueOffset = 00h

Result is 05h

6

Build and send a SELECT ITEM command with 3 items (ID=FDh, FEh, FFh)

SELECT ITEM Proactive command

Terminal Response with Item FFh selected

Item Identifier TLV = 10 01 FF

Call the getItemIdentifier() method

Result is FFh

7

Call the getValueByte() method

valueOffset = 00h

Result is FFh

8

Build and send a SELECT ITEM command with 3 items (ID=FDh, FEh, FFh)

SELECT ITEM Proactive command

Terminal Response with 2 Item Identifier TLV

1st Item Identifier TLV = 10 01 FFh

2nd Item Identifier TLV = 10 01 FEh

Call the getItemIdentifier() method

Result is FFh

9

Call the getValueByte() method

valueOffset = 00h

Result is FFh

10

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response without item identifier in the Item Identifier Simple TLV

Item Identifier TLV = 10 00

Call to getItemIdentifier()

OUT_OF_TLV_BOUNDARIES ToolkitException is thrown

6.2.8.5.4 Test Coverage

CRR number

Test case number

N1

2, 4, 6, 8

N2

3, 5, 7, 9

C1

1

C2

10

6.2.8.6 Method getTextStringCodingScheme

Test Area Reference: API_2_PRH_GTCS

6.2.8.6.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public byte getTextStringCodingScheme()

throws ToolkitException

6.2.8.6.1.1 Normal execution

  • CRRN1: This method returns the data coding scheme from the first Text String TLV element.
  • CRRN2: If a Text String TLV element is available, it becomes the TLV selected.

6.2.8.6.1.2 Parameter errors

No requirements.

6.2.8.6.1.3 Context errors

  • CRRC1: A ToolkitException.UNAVAILABLE_ELEMENT shall be thrown in case of unavailable Text String TLV element.
  • CRRC2: A ToolkitException.OUT_OF_TLV_BOUNDARIES shall be thrown if the Text String TLV is present with a length of 0.

6.2.8.6.2 Test Suite files

Test Script: API_2_PRH_GTCS_1.scr

Test Applet: API_2_PRH_GTCS_1.java

Load Script: API_2_PRH_GTCS_1.ldr

Cleanup Script: API_2_PRH_GTCS_1.clr

Parameter File: API_2_PRH_GTCS_1.par

6.2.8.6.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response (no Text String TLV element available)

Call to getTextStringCodingScheme() with unavailable Text String TLV

UNAVAILABLE_ELEMENT ToolkitException is thrown

2

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with a null Text String TLV

Text String TLV = 0D 00

Call the getTextStringCodingScheme() method

OUT_OF_TLV_BOUNDARIES ToolkitException is thrown

3

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = 01h, DCS = 04h

Text String TLV = 0D 02 04 "A"

Call the getTextStringCodingScheme() method

Result is 04h

4

Call the getValueLength() method

Result is 02h

5

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = 02h, DCS = 00h

Text String TLV = 0D 03 00 "BB"

Call the getTextStringCodingScheme() method

Result is 00h

6

Call the getValueLength() method

Result is 03h

7

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = 7Eh, DCS = 08h

Text String TLV = 0D 7F 08 01 02 … 7E

Call the getTextStringCodingScheme() method

Result is 08h

8

Call the getValueLength() method

Result is 7Fh

9

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = 7Fh, DCS = 04h

Text String TLV = 0D 81 80 04 01 02 … 7F

Call the getTextStringCodingScheme() method

Result is 04h

10

Call the getValueLength() method

Result is 80h

11

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = EFh, DCS = 08h

Text String TLV = 0D 81 F0 08 01 02 … EE EF

Call the getTextStringCodingScheme() method

Result is 08h

12

Call the getValueLength() method

Result is F0h

13

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with 2 Text String TLV

1st Text String TLV = 0D 02 04 41

2nd Text String TLV = 0D 03 08 42 43

Call the getTextStringCodingScheme() method

Result is 04h

14

Call the getValueLength() method

Result is 02h

6.2.8.6.4 Test Coverage

CRR number

Test case number

N1

3, 5, 7, 9, 11, 13

N2

4, 6, 8, 10, 12, 14

C1

1

C2

2

6.2.8.7 Method GetTextStringLength

Test Area Reference: API_2_PRH_GTTL

6.2.8.7.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public short getTextStringLength()

throws ToolkitException

6.2.8.7.1.1 Normal execution

  • CRRN1: The getTextStringLength() method returns the text string length value from the first Text String TLV element.
  • CRRN2: If a Text String TLV element is available, it becomes the TLV selected.

6.2.8.7.1.2 Parameter errors

No requirements.

6.2.8.7.1.3 Context errors

  • CRRC1: A ToolkitException.UNAVAILABLE_ELEMENT shall be thrown in case of unavailable Text String TLV element.

6.2.8.7.2 Test Suite files

Test Script: API_2_PRH_GTTL_1.scr

Test Applet: API_2_PRH_GTTL_1.java

Load Script: API_2_PRH_GTTL_1.ldr

Cleanup Script: API_2_PRH_GTTL_1.clr

Parameter File: API_2_PRH_GTTL_1.par

6.2.8.7.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Build and send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response (no Text String TLV element available)

Call to getTextStringLength() with unavailable Text String TLV

UNAVAILABLE_ELEMENT ToolkitException is thrown

2

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with a null Text String TLV

Text String TLV = 0D 00

Call the getTextStringLength() method

Result is 00h

3

Call the getValueLength() method

Result is 00h

4

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = 01h, DCS = 04h

Text String TLV = 0D 02 04 "A"

Call the getTextStringLength() method

Result is 01h

5

Call the getValueLength() method

Result is 02h

6

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = 02h, DCS = 00h

Text String TLV = 0D 03 00 "BB"

Call the getTextStringLength() method

Result is 02h

7

Call the getValueLength() method

Result is 03h

8

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = 7Eh, DCS = 08h

Text String TLV = 0D 7F 08 01 02 … 7E

Call the getTextStringLength() method

Result is 7Eh

9

Call the getValueLength() method

Result is 7Fh

10

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = 7Fh, DCS = 04h

Text String TLV = 0D 81 80 04 01 02 … 7F

Call the getTextStringLength() method

Result is 7Fh

11

Call the getValueLength() method

Result is 80h

12

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with text length = EFh, DCS = 04h

Text String TLV = 0D 81 F0 04 01 02 … EE EF

Call the getTextStringLength() method

Result is EFh

13

Call the getValueLength() method

Result is F0h

14

Build and send a GET INPUT command

GET INPUT Proactive command

Terminal Response with 2 Text String TLV

1st Text String TLV = 0D 02 04 41

2nd Text String TLV = 0D 03 08 42 43

Call the getTextStringLength() method

Result is 01h

15

Call the getValueLength() method

Result is 02h

6.2.8.7.4 Test Coverage

CRR number

Test case number

1

2, 4, 6, 8, 10, 12, 14

2

3, 5, 7, 9, 11, 13, 15

3

1

6.2.8.8 Method getTheHandler

Test Area Reference: API_2_PRH_GTHD

6.2.8.8.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public static ProactiveResponseHandler getTheHandler()

throws ToolkitException

6.2.8.8.1.1 Normal execution

  • CRRN1: The method shall return the single system instance of the ProactiveHandler class.
  • CRRN2: The EnvelopeHandler is a Temporary JCRE Entry Point Object

6.2.8.8.1.2 Parameter errors

No requirements.

6.2.8.8.1.3 Context errors

  • CRRC1: The method shall throw ToolkitException.HANDLER_NOT_AVAILABLE if the handler is busy.

6.2.8.8.2 Test Suite files

Test Script: API_2_PRH_GTHD_1.scr

Test Applet: API_2_PRH_GTHD_1.java

Load Script: API_2_PRH_GTHD_1.ldr

Cleanup Script: API_2_PRH_GTHD_1.clr

Parameter File: API_2_PRH_GTHD_1.par

6.2.8.8.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Build and send a Proactive Command

Proactive Command

Terminal Response

getTheHandler() twice

The returned objects shall be the same

2

getTheHandler()

The reference shall be a ProactiveResponseHandler

3

getTheHandler()

The reference shall not be null

6.2.8.8.4 Test Coverage

CRR number

Test case number

N1

1, 2, 3

N2

Checked in Framework tests: FWK_API_HEPO (test case 4)

C1

Checked in Framework tests: FWK_MHA_PRHD

6.2.8.9 Method getLength

Test Area Reference API_2_PRH_GLEN

6.2.8.9.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public short getLength()

throws ToolkitException

6.2.8.9.1.1 Normal execution

  • CRRN1: returns the length in bytes of the TLV list.

6.2.8.9.1.2 Parameter errors

No requirements.

6.2.8.9.1.3 Context errors

  • CRRC1: if the handler is busy an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException.HANDLER_NOT_AVAILABLE.

6.2.8.9.2 Test Suite files

Test Script: API_2_PRH_GLEN_1.scr

Test Applet: API_2_PRH_GLEN_1.java

Load Script: API_2_PRH_GLEN_1.ldr

Cleanup Script: API_2_PRH_GLEN_1.clr

Parameter File: API_2_PRH_GLEN_1.par

6.2.8.9.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Build and send a Display Text command

DISPLAY TEXT Proactive command

Terminal Response without additional information in General Result TLV

ProactiveResponseHandler.getTheHandler()

getLength()

Result of getLength() is 12

2

Build and send a Display Text command

DISPLAY TEXT Proactive command

Terminal Response with F2h additional information in General Result TLV

ProactiveResponseHandler.getTheHandler()

getLength()

Result of getLength() is FFh

6.2.8.9.4 Test Coverage

CRR number

Test case number

N1

1, 2

C1

Does not apply for Proactive Response Handler

6.2.8.10 Method copy

Test Area Reference API_2_PRH_COPY_BSS

6.2.8.10.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public short copy(byte[] dstBuffer,

short dstOffset,

short dstLength)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.8.10.1.1 Normal execution

  • CRRN1: copies the simple TLV list contained in the handler to the destination byte array.
  • CRRN2: returns dstOffset + dstLength.

6.2.8.10.1.2 Parameter errors

  • CRRP1: if dstBuffer is null a NullPointerException is thrown.
  • CRRP2: if dstOffset or dstLength or both would cause access outside array bounds, or if dstLength is negative, an ArrayIndexOutOfBoundsException is thrown.
  • CRRP3: if dstLength is grater than the length of the simple TLV List, an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException. OUT_OF_TLV_BOUNDARIES.

6.2.8.10.1.3 Context errors

  • CRRC1: if the handler is busy an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException HANDLER_NOT_AVAILABLE.

6.2.8.10.2 Test Suite files

Test Script: API_2_PRH_COPY_BSS_1.scr

Test Applet: API_2_PRH_COPY_BSS_1.java

Load Script: API_2_PRH_COPY_BSS_1.ldr

Cleanup Script: API_2_PRH_COPY_BSS_1.clr

Parameter File: API_2_PRH_COPY_BSS_1.par

6.2.8.10.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response without Additional Information in General Result TLV:

81 03 01 21 00 02 02 82 81 03 01 00

ProactiveResponseHandler.getTheHandler()

copy() with NULL as parameter to dstBuffer

NullPointerException is thrown

2

dstOffset > dstBuffer.length

dstBuffer.length = 5

dstOffset = 6

dstLength = 0

ArrayIndexOutOfBoundsException is thrown

3

dstOffset < 0

dstBuffer.length = 5

dstOffset = -1

dstLength = 1

ArrayIndexOutOfBoundsException is thrown

4

dstLength > dstBuffer.length

dstBuffer.length = 5

dstOffset = 0

dstLength = 6

ArrayIndexOutOfBoundsException is thrown

5

dstOffset + dstLength > dstBuffer.length

dstBuffer.length = 5

dstOffset = 3

dstLength = 3

ArrayIndexOutOfBoundsException is thrown

6

dstLength < 0

dstBuffer.length = 5

dstOffset = 0

dstLength = -1

ArrayIndexOutOfBoundsException is thrown

7

dstLength > length of the simple TLV list

dstBuffer.length = 13

dstOffset = 0

dstLength = 13

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

8

Successful call, dstBuffer is the whole buffer

dstBuffer.length = 12

dstOffset = 0

dstLength = 12

Result of copy() is 12

9

Compare the buffer with buffer:

81 03 01 21 00 02 02 82 81 03 01 00

Result of arrayCompare() is 0

10

Successful call, dstBuffer is part of a buffer

dstBuffer.length = 20

dstOffset = 3

dstLength = 12

Result of copy() is 15

11

Compare the whole buffer

Reference =

00 01 02

81 03 01 21 00

02 02 82 81

03 01 00

0F 10 11 12 13

Result of arrayCompare() is 0

12

Initialise dstBuffer

dstBuffer = 00h 01h 02h … 13h

Successful call, dstBuffer is part of a buffer

dstBuffer.length = 20

dstOffset = 3

dstLength = 9

Result of copy() is 12

13

Compare the whole buffer

Reference =

00 01 02

81 03 01 21 00

02 02 82 81

0C 0D 0E

0F 10 11 12 13

Result of arrayCompare() is 0

6.2.8.10.4 Test Coverage

CRR number

Test case number

N1

9, 11, 13

N2

8, 10, 12

P1

1

P2

2, 3, 4, 5, 6

P3

7

C1

Does not apply for Proactive Response Handler

6.2.8.11 Method findTLV

Test Area Reference API_2_PRH_FINDBB

6.2.8.11.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public byte findTLV(byte tag, byte occurrence)

throws ToolkitException

6.2.8.11.1.1 Normal execution

Looks for the indicated occurrence of a TLV element from the beginning of the TLV list (handler buffer):

  • CRRN1: the method is successful if the required occurrence exists then the corresponding TLV becomes current.
  • CRRN2: if the method is successful then it returns TLV_FOUND_CR_SET when Comprehension Required flag is set.
  • CRRN3: if the method is successful then it returns TLV_FOUND_CR_NOT_SET when Comprehension Required flag is not set.
  • CRRN4: if the required occurrence of the TLV element does not exist, the current TLV is no longer defined and TLV_NOT_FOUND is returned.
  • CRRN5: The search method is comprehension required flag independent.

6.2.8.11.1.2 Parameter errors

  • CRRP1: if an input parameter is not valid (e.g. occurrence = 0) an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException BAD_INPUT_PARAMETER.

6.2.8.11.1.3 Context errors

  • CRRC1: if the handler is busy an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException HANDLER_NOT_AVAILABLE.

6.2.8.11.2 Test Suite files

Test Script: API_2_PRH_FINDBB_1.scr

Test Applet: API_2_PRH_FINDBB_1.java

Load Script: API_2_PRH_FINDBB_1.ldr

Cleanup Script: API_2_PRH_FINDBB_1.clr

Parameter File: API_2_PRH_FINDBB_1.par

6.2.8.11.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Send a DISPLAY TEXT command

DISPLAY TEXT Proactive command

Terminal Response with 2 General Result TLV

81 03 01 21 00

82 02 82 81

03 01 00

03 02 01 12

findTLV() with Invalid input parameter

occurrence = 0

ToolkitException.BAD_INPUT_PARAMETER is thrown

2

Search 1st TLV

tag = 01h

occurrence = 1

Result is TLV_FOUND_CR_SET

3

Call the getValueLength() method

Result is 03h

4

Search 2nd TLV

tag = 02h

occurrence = 1

Result is TLV_FOUND_CR_SET

5

Call the getValueLength() method

Result is 02h

6

Select a TLV (tag 02h)

Search a wrong tag

tag = 04h

occurrence = 1

Result is TLV_NOT_FOUND

7

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT shall be thrown

8

Search a tag with wrong occurrence

tag = 01h

occurrence = 2

Result is TLV_NOT_FOUND

9

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT shall be thrown.

10

Search 3rd TLV

tag = 03h

occurrence = 1

Result is TLV_FOUND_CR_NOT_SET

11

Call the getValueLength() method

Result is 01h

12

Search 3rd TLV

tag = 03h

occurrence = 2

Result is TLV_FOUND_CR_NOT_SET

13

Call the getValueLength() method

Result is 02h

14

Search tag 83h

Tag = 83h

Occurrence = 1

Result is TLV_FOUND_CR_NOT_SET

15

Search tag 82h

Tag = 82h

Occurrence = 1

Result is TLV_FOUND_CR_SET

6.2.8.11.4 Test Coverage

CRR number

Test case number

N1

3, 5, 11, 13

N2

2, 4

N3

10, 12

N4

6, 7,8, 9

N5

14,15

P1

1

C1

Does not apply for Proactive Response Handler

6.2.8.12 Method getValueLength

Test Area Reference API_2_PRH_GVLE

6.2.8.12.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public short getValueLength()

throws ToolkitException

6.2.8.12.1.1 Normal execution

  • CRRN1: gets and returns the binary length of the value field for the last TLV element which has been found in the handler.

6.2.8.12.1.2 Parameter errors

No requirements.

6.2.8.12.1.3 Context errors

  • CRRC1: if the handler is busy an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException HANDLER_NOT_AVAILABLE.
  • CRRC2: in case of unavailable TLV element an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException UNAVAILABLE_ELEMENT.

6.2.8.12.2 Test Suite files

Test Script: API_2_PRH_GVLE_1.scr

Test Applet: API_2_PRH_GVLE_1.java

Load Script: API_2_PRH_GVLE_1.ldr

Cleanup Script: API_2_PRH_GVLE_1.clr

Parameter File: API_2_PRH_GVLE_1.par

6.2.8.12.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response

Text String TLV = 0D 00

ProactiveResponseHandler.getTheHandler()

GetValueLength()

ToolkitException.UNAVAILABLE_ELEMENT is thrown

2

Search TLV 0Dh

getValueLength()

Result is 00h

3

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response

Text String TLV = 0D 02 04 41

Search TLV 0Dh (Text String TLV)

getValueLength()

Result is 02h

4

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 7Eh

Text String TLV = 0D 7F 04 01 02 … 7E

Search TLV 0Dh (Text String TLV)

getValueLength()

Result is 7Fh

5

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 7Fh

Text String TLV = 0D 81 80 04 01 02 … 7E 7F

Search TLV 0Dh (Text String TLV)

getValueLength()

Result is 80h

6

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = EFh

Text String TLV = 0D 81 F0 04 01 02 … EF

Search TLV 0Dh (Text String TLV)

getValueLength()

Result is F0h

6.2.8.12.4 Test Coverage

CRR number

Test case number

N1

2, 3, 4, 5, 6

C1

Does not apply for Proactive Response Handler

C2

1

6.2.8.13 Method getValueByte

Test Area Reference API_2_PRH_GVBYS

6.2.8.13.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public byte getValueByte(short valueOffset)

throws ToolkitException

6.2.8.13.1.1 Normal execution

  • CRRN1: Gets a byte from the last TLV element which has been found in the handler and returns its value (1 byte).

6.2.8.13.1.2 Parameter errors

  • CRRP1: if valueOffset is out of the current TLV an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException OUT_OF_TLV_BOUNDARIES.

6.2.8.13.1.3 Context errors

  • CRRC1: if the handler is busy an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException HANDLER_NOT_AVAILABLE.
  • CRRC2: in case of unavailable TLV element an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException UNAVAILABLE_ELEMENT.

6.2.8.13.2 Test Suite files

Test Script: API_2_PRH_GVBYS_1.scr

Test Applet: API_2_PRH_GVBYS_1.java

Load Script: API_2_PRH_GVBYS_1.ldr

Cleanup Script: API_2_PRH_GVBYS_1.clr

Parameter File: API_2_PRH_GVBYS_1.par

6.2.8.13.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 7Eh

Text String TLV = 0D 7F 04 01 02 … 7E

ProactiveResponseHandler.getTheHandler()

getValueByte(0)

ToolkitException.UNAVAILABLE_ELEMENT is thrown

2

Search TLV 01h (Command Details TLV)

getValueByte(3)

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

3

Search TLV 01h (Command Details TLV)

getValueByte(2)

Result is 00h (qualifier)

4

Search TLV 02h (Device Identities TLV)

getValueByte(0)

Result is 82h (Source)

5

Search TLV 0Dh (Text String TLV)

getValueByte(7E)

Result is 7Eh

6

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = EFh

Text String TLV = 0D 81 F0 04 01 02 … 7E 7F … EF

Search TLV 0Dh (Text String TLV)

getValueByte(7E)

Result is 7Eh

7

GetValueByte(7F)

Result is 7Fh

8

GetValueByte(EF)

Result is EFh

6.2.8.13.4 Test Coverage

CRR number

Test case number

N1

3, 4, 5, 6, 7, 8

P1

2

C1

Does not apply for Proactive Response Handler

C2

1

6.2.8.14 Method copyValue

Test Area Reference API_2_PRH_CPYVS_BSS

6.2.8.14.1 Conformance requirement

The method with following header shall be compliant with its definition in the API.

public short copyValue(short valueOffset,

byte[] dstBuffer,

short dstOffset,

short dstLength)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.8.14.1.1 Normal execution

  • CRRN1: copies a part of the last TLV element which has been found, into a destination. buffer.
  • CRRN2: returns dstOffset + dstLength.

6.2.8.14.1.2 Parameter errors

  • CRRP1: if dstBuffer is null NullPointerException is thrown.
  • CRRP2: if dstOffset or dstLength or both would cause access outside array bounds, or if dstLength is negative ArrayIndexOutOfBoundsException is thrown.
  • CRRP3: if valueOffset, dstLength or both are out of the current TLV an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException OUT_OF_TLV_BOUNDARIES.

6.2.8.14.1.3 Context errors

  • CRRC1: if the handler is busy an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException HANDLER_NOT_AVAILABLE.
  • CRRC2: in case of unavailable TLV element an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException UNAVAILABLE_ELEMENT.

6.2.8.14.2 Test Suite files

Test Script: API_2_PRH_CPYVS_BSS_1.scr

Test Applet: API_2_PRH_CPYVS_BSS_1.java

Load Script: API_2_PRH_CPYVS_BSS_1.ldr

Cleanup Script: API_2_PRH_CPYVS_BSS_1.clr

Parameter File: API_2_PRH_CPYVS_BSS_1.par

6.2.8.14.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 5

Text String TLV = 0D 06 04 01 02 … 05

ProactiveResponseHandler.getTheHandler()

Select Text String TLV

CopyValue() with a null dstBuffer

NullPointerException is thrown

2

dstOffset > dstBuffer.length

dstBuffer.length = 5

dstOffset = 6

dstLength = 0

ArrayIndexOutOfBoundsException is thrown

3

dstOffset < 0

dstBuffer.length = 5

dstOffset = -1

dstLength = 1

ArrayIndexOutOfBoundsException is thrown

4

dstLength >dstBuffer.length

dstBuffer.length = 5

dstOffset = 0

dstLength = 6

ArrayIndexOutOfBoundsException is thrown

5

dstOffset + dstLength >dstBuffer.length

dstBuffer.length = 5

dstOffset = 3

dstLength = 3

ArrayIndexOutOfBoundsException is thrown

6

dstLength < 0

dstBuffer.length = 5

dstOffset = 0

dstLength = -1

ArrayIndexOutOfBoundsException is thrown

7

valueOffset > Text String Length

valueOffset = 7

dstBuffer.length = 15

dstOffset = 0

dstLength = 0

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

8

valueOffset < 0

valueOffset = -1

dstBuffer.length = 15

dstOffset = 0

dstLength = 1

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

9

dstLength > Text String length

valueOffset = 0

dstBuffer.length = 15

dstOffset = 0

dstLength = 7

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

10

ValueOffset + dstLength > Text String length

ValueOffset = 2

DstBuffer.length = 15

DstOffset = 0

DstLength = 5

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

11

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 16

Text String TLV = 0D 11 04 00 01 … 0F

ProactiveResponseHandler.getTheHandler

CopyValue()

ToolkitException.UNAVAILABLE_ELEMENT is thrown

12

Select Text String TLV

Successful call

ValueOffset = 0

DstBuffer.length = 17

DstOffset = 0

DstLength = 17

Result of copyValue() is 17

13

Compare buffer

Buffer = 04 00 01 … 0F

Result is 00h

14

initialise dstBuffer

dstBuffer = 55 55 … 55

Successful call

ValueOffset = 2

DstBuffer.length = 20

DstOffset = 3

DstLength = 12

Result of copyValue() is 15

15

Compare buffer

Buffer =

55 55 55 01 02

03 04 05 06 07

08 09 0A 0B 0C

55 55 55 55 55

Result is 00h

6.2.8.14.4 Test Coverage

CRR number

Test case number

N1

13, 15

N2

12, 14

P1

1

P2

2, 3, 4, 5, 6

P3

7, 8, 9, 10

C1

Does not apply for Proactive Response Handler

C2

11

6.2.8.15 Method compareValue

Test Area Reference API_2_PRH_CPRVS_BSS

6.2.8.15.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public byte compareValue(short valueOffset,

byte[] compareBuffer,

short compareOffset,

short compareLength)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.8.15.1.1 Normal execution

Compares the last found TLV element with a buffer:

  • CRRN1: returns 0 if identical.
  • CRRN2: returns -1 if the first miscomparing byte in simple TLV List is less than that in compareBuffer.
  • CRRN3: returns 1 if the first miscomparing byte in simple TLV List is greater than that in compareBuffer.

6.2.8.15.1.2 Parameter errors

  • CRRP1: if compareBuffer is null NullPointerException shall be thrown.
  • CRRP2: if compareOffset or compareLength or both would cause access outside array bounds, or if compareLength is negative ArrayIndexOutOfBoundsException shall be thrown.
  • CRRP3: if valueOffset, dstLength or both are out of the current TLV an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException OUT_OF_TLV_BOUNDARIES.

6.2.8.15.1.3 Context errors

  • CRRC1: if the handler is busy an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException HANDLER_NOT_AVAILABLE.
  • CRRC2: in case of unavailable TLV element an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException UNAVAILABLE_ELEMENT.

6.2.8.15.2 Test Suite files

Test Script: API_2_PRH_CPRVS_BSS_1.scr

Test Applet: API_2_PRH_CPRVS_BSS_1.java

Load Script: API_2_PRH_CPRVS_BSS_1.ldr

Cleanup Script: API_2_PRH_CPRVS_BSS_1.clr

Parameter File: API_2_PRH_CPRVS_BSS_1.par

6.2.8.15.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 5

Text String TLV = 0D 06 04 01 02 … 05

ProactiveResponseHandler.getTheHandler()

Select Text String TLV

compareValue() with a null compareBuffer

NullPointerException is thrown

2

compareOffset > compareBuffer.length

compareBuffer.length = 5

compareOffset = 6

compareLength = 0

ArrayIndexOutOfBoundsException is thrown

3

compareOffset < 0

compareBuffer.length = 5

compareOffset = -1

compareLength = 1

ArrayIndexOutOfBoundsException is thrown

4

compareLength >compareBuffer.length

compareBuffer.length = 5

compareOffset = 0

compareLength = 6

ArrayIndexOutOfBoundsException is thrown

5

compareOffset + compareLength >compareBuffer.length

compareBuffer.length = 5

compareOffset = 3

compareLength = 3

ArrayIndexOutOfBoundsException is thrown

6

compareLength < 0

compareBuffer.length = 5

compareOffset = 0

compareLength = -1

ArrayIndexOutOfBoundsException is thrown

7

valueOffset > Text String Length

valueOffset = 7

compareBuffer.length = 15

compareOffset = 0

compareLength = 0

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

8

valueOffset < 0

valueOffset = -1

compareBuffer.length = 15

compareOffset = 0

compareLength = 1

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

9

compareLength > Text String length

valueOffset = 0

compareBuffer.length = 15

compareOffset = 0

compareLength = 7

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

10

valueOffset + compareLength > Text String length

valueOffset = 2

compareBuffer.length = 15

compareOffset = 0

compareLength = 5

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

11

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 16

Text String TLV = 0D 11 04 00 01 … 0F

ProactiveResponseHandler.getTheHandler()

CompareValue()

ToolkitException.UNAVAILABLE_ELEMENT is thrown

12

Select Text String TLV

Initialise compareBuffer

CompareBuffer =

04 00 01 … 0F

Compare buffers

ValueOffset = 0

CompareOffset = 0

CompareLength = 17

Result is 00h

13

Initialise compareBuffer

CompareBuffer =

04 00 01 … 10

Compare buffers with same parameters

Result is -1

14

Initialise compareBuffer

CompareBuffer =

03 00 01 … 0F

Compare buffers with same parameters

Result is +1

15

Initialise compareBuffer

CompareBuffer =

55 55 55 01 02

03 04 05 06 07

08 09 0A 0B 0C

55 55 55 55 55

Compare buffers

ValueOffset = 2

CompareOffset = 3

CompareLength = 12

Result is 00h

16

Initialise compareBuffer

CompareBuffer =

55 55 55 02 01

03 04 05 06 07

08 09 0A 0B 0C

55 55 55 55 55

Compare buffers with same parameters

Result is -1

17

Initialise compareBuffer

CompareBuffer =

55 55 55 01 02

03 04 05 06 07

08 09 0A 0A 0D

55 55 55 55 55

Compare buffers with same parameters

Result is +1

6.2.8.15.4 Test Coverage

CRR number

Test case number

N1

12, 15

N2

13, 16

N3

14, 17

P1

1

P2

2, 3, 4, 5, 6

P3

7, 8, 9, 10

C1

Does not apply for Proactive Response Handler

C2

11

6.2.8.16 Method findAndCopyValue(byte tag, byte[] dstBuffer, short valueOffset)

Test Area Reference API_2_PRH_FACYB_BS

6.2.8.16.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public short findAndCopyValue(byte tag,

byte[] dstBuffer,

short dstOffset)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.8.16.1.1 Normal execution

  • CRRN1: looks for the first occurrence of a TLV element from the beginning of a TLV list and copy its value into a destination buffer.
  • CRRN2: if no TLV element is found, the UNAVAILABLE_ELEMENT exception is thrown and the current TLV is no longer defined.
  • CRRN3: if the method is successful then the corresponding TLV becomes current and dstOffset + length of the copied value is returned.
  • CRRN4: The search method is comprehension required flag independent.

6.2.8.16.1.2 Parameter errors

  • CRRP1: if dstBuffer is null NullPointerException shall be thrown.
  • CRRP2: if dstOffset would cause access outside array bounds ArrayIndexOutOfBoundsException shall be thrown.

6.2.8.16.1.3 Context errors

  • CRRC1: if the handler is busy an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException HANDLER_NOT_AVAILABLE.

6.2.8.16.2 Test Suite files

Test Script: API_2_PRH_FACYB_BS_1.scr

Test Applet: API_2_PRH_FACYB_BS_1.java

Load Script: API_2_PRH_FACYB_BS_1.ldr

Cleanup Script: API_2_PRH_FACYB_BS_1.clr

Parameter File: API_2_PRH_FACYB_BS_1.par

6.2.8.16.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 15

Text String TLV = 0D 10 04 01 02 … 0F

ProactiveResponseHandler.getTheHandler()

FindAndCopyValue() with a null dstBuffer

NullPointerException is thrown

2

dstOffset > dstBuffer.length

tag = 0Dh

dstBuffer.length = 20

dstOffset = 21

ArrayIndexOutOfBoundsException is thrown

3

dstOffset < 0

dstBuffer.length = 20

dstOffset = -1

ArrayIndexOutOfBoundsException is thrown

4

length > dstBuffer.length

dstBuffer.length = 15

dstOffset = 0

ArrayIndexOutOfBoundsException is thrown

5

dstOffset + length >dstBuffer.length

dstBuffer.length = 20

dstOffset = 5

ArrayIndexOutOfBoundsException is thrown

6

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 16

Text String TLV = 0D 11 04 00 01 … 0F

ProactiveResponseHandler.getTheHandler()

Select a TLV (tag 02h)

findAndCopyValue()

tag = 04h

ToolkitException.UNAVAILABLE_ELEMENT is thrown

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

7

Successful call

Tag = 0Dh

DstBuffer.length = 17

DstOffset = 0

Result of findAndcopyValue() is 17

8

Compare buffer

Buffer = 04 00 01 … 0F

Result is 00h

9

initialise dstBuffer

dstBuffer = 55 55 … 55

Successful call

DstBuffer.length = 20

DstOffset = 2

Result of findAndcopyValue() is 19

10

Compare buffer

Buffer =

55 55 04 00 01

02 03 04 05 06

07 08 09 0A 0B

0C 0D 0E 0F 55

Result is 00h

11

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, with 2 Text String TLV

0D 11 04 00 01 … 0F

0D 02 04 41

ProactiveResponseHandler.getTheHandler()

Successful call

Tag = 0Dh

DstBuffer.length = 17

DstOffset = 0

Result of findAndcopyValue() is 17

12

Compare buffer

Buffer = 04 00 01 … 0F

Result is 00h

13

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 16

Text String TLV = 0D 11 04 00 01 … 0F

ProactiveResponseHandler.getTheHandler()

Successful call (with tag 8Dh)

Tag = 8Dh

DstBuffer.length = 17

DstOffset = 0

Result of findAndcopyValue() is 17

14

Compare buffer

Buffer = 04 00 01 … 0F

Result is 00h

6.2.8.16.4 Test Coverage

CRR number

Test case number

N1

8, 10, 12

N2

6

N3

7, 9, 11

N4

13, 14

P1

1

P2

2, 3, 4, 5

C1

Does not apply for Proactive Response Handler

6.2.8.17 Method findAndCopyValue(byte tag, byte occurence, short valueOffset, byte[] dstBuffer, short dstOffset, short dstLength)

Test Area Reference API_2_PRH_FACYBBS_BSS

6.2.8.17.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public short findAndCopyValue(byte tag,

byte occurence,

short valueOffset,

byte[] dstBuffer,

short dstOffset,

short dstLength)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.8.17.1.1 Normal execution

  • CRRN1: looks for the indicated occurrence of a TLV element from the beginning of a TLV list and copy its value into a destination buffer.
  • CRRN2: if no TLV element is found, the UNAVAILABLE_ELEMENT exception is thrown and the current TLV is no longer defined.
  • CRRN3: if the method is successful then the corresponding TLV becomes current and dstOffset + dstLength is returned.
  • CRRN4: The search method is comprehension required flag independent.

6.2.8.17.1.2 Parameter errors

  • CRRP1: if dstBuffer is null NullPointerException shall be thrown.
  • CRRP2: if dstOffset or dstLength or both would cause access outside array bounds, or if dstLength is negative ArrayIndexOutOfBoundsException shall be thrown.
  • CRRP3: if valueOffset, dstLength or both are out of the current TLV an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException OUT_OF_TLV_BOUNDARIES.

6.2.8.17.1.3 Context errors

  • CRRC1: if the handler is busy an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException HANDLER_NOT_AVAILABLE.

6.2.8.17.2 Test Suite files

Test Script: API_2_PRH_FACYBBS_BSS_1.scr

Test Applet: API_2_PRH_FACYBBS_BSS_1.java

Load Script: API_2_PRH_FACYBBS_BSS_1.ldr

Cleanup Script: API_2_PRH_FACYBBS_BSS_1.clr

Parameter File: API_2_PRH_FACYBBS_BSS_1.par

6.2.8.17.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 15

Text String TLV = 0D 10 04 01 02 … 0F

ProactiveResponseHandler.getTheHandler()

findAndCopyValue() with a null dstBuffer

NullPointerException is thrown

2

dstOffset > dstBuffer.length

tag = 0Dh, occurrence = 1

valueOffset = 0

dstBuffer.length = 5

dstOffset = 6

dstLength = 0

ArrayIndexOutOfBoundsException is thrown

3

dstOffset < 0

dstBuffer.length = 5

dstOffset = -1

dstLength = 1

ArrayIndexOutOfBoundsException is thrown

4

dstLength > dstBuffer.length

dstBuffer.length = 5

dstOffset = 0

dstLength = 6

ArrayIndexOutOfBoundsException is thrown

5

dstOffset + dstLength > dstBuffer.length

dstBuffer.length = 5

dstOffset = 3

dstLength = 3

ArrayIndexOutOfBoundsException is thrown

6

dstLength < 0

dstBuffer.length = 5

dstOffset = 0

dstLength = -1

ArrayIndexOutOfBoundsException is thrown

7

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 5

Text String TLV = 0D 06 04 01 02 … 05

ProactiveResponseHandler.getTheHandler()

valueOffset > Text String Length

tag = 0Dh, occurrence = 1

valueOffset = 7

dstBuffer.length = 15

dstOffset = 0

dstLength = 0

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

8

valueOffset < 0

valueOffset = -1

dstBuffer.length = 15

dstOffset = 0

dstLength = 1

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

9

dstLength > Text String length

valueOffset = 0

dstBuffer.length = 15

dstOffset = 0

dstLength = 7

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

10

valueOffset + dstLength > Text String length

valueOffset = 2

dstBuffer.length = 15

dstOffset = 0

dstLength = 5

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

11

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 16

Text String TLV = 0D 11 04 00 01 … 0F

ProactiveResponseHandler.getTheHandler()

Select a TLV (tag 02h)

findAndCopyValue()

tag = 0Dh

occurrence = 2

ToolkitException.UNAVAILABLE_ELEMENT is thrown

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

12

Successful call

Tag = 0Dh, occurrence = 1

ValueOffset = 0

DstBuffer.length = 17

DstOffset = 0

DstLength = 17

Result of findAndCopyValue() is 17

13

Compare buffer

Buffer = 04 00 01 … 0F

Result is 00h

14

initialise dstBuffer

dstBuffer = 55 55 … 55

Successful call

Tag = 0Dh, occurrence = 1

ValueOffset = 2

DstBuffer.length = 20

DstOffset = 3

DstLength = 12

Result of findAndcopyValue() is 15

15

Compare buffer

Buffer =

55 55 55 01 02

03 04 05 06 07

08 09 0A 0B 0C

55 55 55 55 55

Result is 00h

16

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, with 2 Text String TLV

0D 11 04 00 01 02 … 0F

0D 06 00 11 22 33 44 55 (no specific DCS byte)

ProactiveResponseHandler.getTheHandler()

Successful call

Tag = 0Dh, occurrence = 1

ValueOffset = 0

DstBuffer.length = 17

DstOffset = 0

DstLength = 17

Result of findAndCopyValue() is 17

17

Compare buffer

Buffer = 04 00 01 … 0F

Result is 00h

18

Successful call

Tag = 0Dh, occurrence = 2

ValueOffset = 0

DstBuffer.length = 6

DstOffset = 0

DstLength = 6

Result of findAndCopyValue() is 6

19

Compare buffer

Buffer = 00 11 22 33 44 55

Result is 00h

20

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 16

Text String TLV = 0D 11 04 00 01 … 0F

ProactiveResponseHandler.getTheHandler()

Successful call (with tag 8Dh)

Tag = 8Dh, occurrence = 1

ValueOffset = 0

DstBuffer.length = 17

DstOffset = 0

DstLength = 17

Result of findAndcopyValue() is 17

21

Compare buffer

Buffer = 04 00 01 … 0F

Result is 00h

6.2.8.17.4 Test Coverage

CRR number

Test case number

N1

13, 15, 17, 19

N2

11

N3

12, 14, 16, 18

N4

20, 21

P1

1

P2

2, 3, 4, 5, 6

P3

7, 8, 9, 10

C1

Does not apply for Proactive Response Handler

6.2.8.18 Method findAndCompareValue(byte tag, byte[] compareBuffer, short compareOffset)

Test Area Reference API_2_PRH_FACRB_BS

6.2.8.18.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public byte findAndCompareValue(byte tag,

byte[] compareBuffer,

short compareOffset)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.8.18.1.1 Normal execution

Looks for the first occurrence of a TLV element from beginning of a TLV list and compare its value with a buffer:

  • CRRN1: if no TLV element is found, the UNAVAILABLE_ELEMENT exception is thrown and the current TLV is no longer defined.
  • CRRN2: if the method is successful then the corresponding TLV becomes current.
  • CRRN3: if identical returns 0.
  • CRRN4: if the first miscomparing byte in simple TLV is less than that in compareBuffer returns -1.
  • CRRN5: if the first miscomparing byte in simple TLV is greater than that in compareBuffer returns 1.
  • CRRN6: The search method is comprehension required flag independent.

6.2.8.18.1.2 Parameter errors

  • CRRP1: if compareBuffer is null NullPointerException shall be thrown.
  • CRRP2: if compareOffset would cause access outside array bounds ArrayIndexOutOfBoundsException shall be thrown.

6.2.8.18.1.3 Context errors

  • CRRC1: if the handler is busy an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException HANDLER_NOT_AVAILABLE.

6.2.8.18.2 Test Suite files

Test Script: API_2_PRH_FACRB_BS_1.scr

Test Applet: API_2_PRH_FACRB_BS_1.java

Load Script: API_2_PRH_FACRB_BS_1.ldr

Cleanup Script: API_2_PRH_FACRB_BS_1.clr

Parameter File: API_2_PRH_FACRB_BS_1.par

6.2.8.18.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 15

Text String TLV = 0D 10 04 01 02 … 0F

ProactiveResponseHandler.getTheHandler()

FindAndCompareValue() with a null dstBuffer

NullPointerException is thrown

2

compareOffset > compareBuffer.length

tag = 0Dh

compareBuffer.length = 20

compareOffset = 21

ArrayIndexOutOfBoundsException is thrown

3

compareOffset < 0

compareBuffer.length = 20

compareOffset = -1

ArrayIndexOutOfBoundsException is thrown

4

length > compareBuffer.length

compareBuffer.length = 15

compareOffset = 0

ArrayIndexOutOfBoundsException is thrown

5

CompareOffset + length > compareBuffer.length

CompareBuffer.length = 20

CompareOffset = 5

ArrayIndexOutOfBoundsException is thrown

6

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 16

Text String TLV = 0D 11 04 00 01 … 0F

ProactiveResponseHandler.getTheHandler()

Select a TLV (tag 02h)

findAndCompareValue()

tag = 04h

ToolkitException.UNAVAILABLE_ELEMENT is thrown

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

7

Initialise compareBuffer

CompareBuffer =

04 00 01 … 0F

Compare buffers

Tag = 0Dh

CompareOffset = 0

Result is 00h

8

Verify current TLV

GetValueLength()

Result is 17

9

Initialise compareBuffer

CompareBuffer =

04 00 01 … 10

Compare buffers with same parameters

Result is -1

10

Initialise compareBuffer

CompareBuffer =

03 00 01 … 0F

Compare buffers with same parameters

Result is +1

11

Initialise compareBuffer

CompareBuffer =

55 55 04 00 01

02 03 04 05 06

07 08 09 0A 0B

0C 0D 0E 0F 55

Compare buffers

CompareOffset = 2

Result is 00h

12

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, with 2 Text String TLV

0D 11 04 00 01 … 0F

0D 06 00 11 22 33 44 55

ProactiveResponseHandler.getTheHandler()

Initialise compareBuffer

CompareBuffer =

55 55 04 00 01

02 03 04 05 06

07 08 09 0A 0B

0C 0D 0E 0F 55

Compare buffers

CompareOffset = 2

Result is 00h

13

Initialise compareBuffer

CompareBuffer =

55 55 04 01 01

02 03 04 05 06

07 08 09 0A 0B

0C 0D 0E 0F 55

Compare buffers

CompareOffset = 2

Result is -1

14

Initialise compareBuffer

CompareBuffer =

55 55 04 00 01

02 03 04 05 06

07 08 09 0A 0B

0C 0D 0D 10 55

Compare buffers

CompareOffset = 2

Result is +1

15

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 16

Text String TLV = 0D 11 04 00 01 … 0F

ProactiveResponseHandler.getTheHandler()

Initialise compareBuffer

CompareBuffer =

04 00 01 … 0F

Compare buffers (with tag 8Dh)

Tag = 8Dh

CompareOffset = 0

Result is 00h

6.2.8.18.4 Test Coverage

CRR number

Test case number

N1

6

N2

8

N3

7, 11, 12

N4

9, 13

N5

10, 14

N6

15

P1

1

P2

2, 3, 4, 5

C1

Does not apply for Proactive Response Handler

6.2.8.19 Method findAndCompareValue(byte tag, byte occurence, short valueOffset, byte[] compareBuffer, short compareOffset, short compareLength)

Test Area Reference API_2_PRH_FACRBBS_BSS

6.2.8.19.1 Conformance requirement

The method with following header shall be compliant to its definition in the API.

public byte findAndCompareValue(byte tag,

byte occurence,

short valueOffset,

byte[] compareBuffer,

short compareOffset,

short compareLength)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.8.19.1.1 Normal execution

Looks for the indicated occurrence of a TLV element from the beginning of a TLV list and compare its value with a buffer:

  • CRRN1: if no TLV element is found, the UNAVAILABLE_ELEMENT exception is thrown and the current TLV is no longer defined.
  • CRRN2: if the method is successful then the corresponding TLV becomes current.
  • CRRN3: if identical 0 is returned.
  • CRRN4: if the first miscomparing byte in simple TLV is less than that in compareBuffer -1 is returned.
  • CRRN5: if the first miscomparing byte in simple TLV is greater than that in compareBuffer 1 is returned
  • CRRN6: The search method is comprehension required flag independent.

6.2.8.19.1.2 Parameter errors

  • CRRP1: if compareBuffer is null NullPointerException shall be thrown.
  • CRRP2: if compareOffset or compareLength or both would cause access outside array bounds, or if compareLength is negative ArrayIndexOutOfBoundsException shall be thrown.
  • CRRP3: if valueOffset, compareLength or both are out of the current TLV an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException OUT_OF_TLV_BOUNDARIES.
  • CRRP4: if an input parameter is not valid (e.g. occurence = 0) an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException BAD_INPUT_PARAMETER.

6.2.8.19.1.3 Context errors

  • CRRC1: if the handler is busy an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException HANDLER_NOT_AVAILABLE.

6.2.8.19.2 Test Suite files

Test Script: API_2_PRH_FACRBBS_BSS_1.scr

Test Applet: API_2_PRH_FACRBBS_BSS_1.java

Load Script: API_2_PRH_FACRBBS_BSS_1.ldr

Cleanup Script: API_2_PRH_FACRBBS_BSS_1.clr

Parameter File: API_2_PRH_FACRBBS_BSS_1.par

6.2.8.19.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 15

Text String TLV = 0D 10 04 01 02 … 0F

ProactiveResponseHandler.getTheHandler()

findAndCompareValue() with a null compareBuffer

NullPointerException is thrown

2

compareOffset > compareBuffer.length

tag = 0Dh, occurrence = 1

valueOffset = 0

compareBuffer.length = 5

compareOffset = 6

compareLength = 0

ArrayIndexOutOfBoundsException is thrown

3

compareOffset < 0

compareBuffer.length = 5

compareOffset = -1

compareLength = 1

ArrayIndexOutOfBoundsException is thrown

4

compareLength >compareBuffer.length

compareBuffer.length = 5

compareOffset = 0

compareLength = 6

ArrayIndexOutOfBoundsException is thrown

5

CompareOffset + compareLength >compareBuffer.length

CompareBuffer.length = 5

CompareOffset = 3

CompareLength = 3

ArrayIndexOutOfBoundsException is thrown

6

compareLength < 0

compareBuffer.length = 5

compareOffset = 0

compareLength = -1

ArrayIndexOutOfBoundsException is thrown

7

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 5

Text String TLV = 0D 06 04 01 02 … 05

ProactiveResponseHandler.getTheHandler()

valueOffset ≥ Text String Length

tag = 0Dh, occurrence = 1

valueOffset = 7

compareBuffer.length = 15

compareOffset = 0

compareLength = 0

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

8

valueOffset < 0

valueOffset = -1

compareBuffer.length = 15

compareOffset = 0

compareLength = 1

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

9

compareLength > Text String length

valueOffset = 0

compareBuffer.length = 15

compareOffset = 0

compareLength = 7

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

10

valueOffset + compareLength > Text String length

valueOffset = 2

compareBuffer.length = 15

compareOffset = 0

compareLength = 5

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

11

Invalid parameter

Occurrence = 0

ToolkitException.BAD_INPUT_PARAMETER is thrown

12

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 16

Text String TLV = 0D 11 04 00 01 … 0F

ProactiveResponseHandler.getTheHandler()

Select a TLV (tag 02h)

findAndCompareValue()

tag = 0Dh

occurrence = 2

ToolkitException.UNAVAILABLE_ELEMENT is thrown

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

13

Initialise compareBuffer

CompareBuffer =

04 00 01 … 0F

findAndCompareValue()

tag = 0Dh, occurrence = 1

valueOffset = 0

compareOffset = 0

compareLength = 17

Result is 00h

14

Verify current TLV

GetValueLength()

Result is 17

15

Initialise compareBuffer

compareBuffer =

04 00 01 … 10

Compare buffers with same parameters

Result is -1

16

Initialise compareBuffer

compareBuffer =

03 00 01 … 0F

Compare buffers with same parameters

Result is +1

17

Initialise compareBuffer

compareBuffer =

55 55 55 01 02

03 04 05 06 07

08 09 0A 0B 0C

55 55 55 55 55

Compare buffers

valueOffset = 2

compareOffset = 3

compareLength = 12

Result is 00h

18

Initialise compareBuffer

compareBuffer =

55 55 55 02 01

03 04 05 06 07

08 09 0A 0B 0C

55 55 55 55 55

Compare buffers with same parameters

Result is -1

19

Initialise compareBuffer

compareBuffer =

55 55 55 01 02

03 04 05 06 07

08 09 0A 0A 0D

55 55 55 55 55

Compare buffers with same parameters

Result is +1

20

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, with 2 Text String TLV

0D 11 04 00 01 … 0F

0D 06 00 11 22 33 44 55

ProactiveResponseHandler.getTheHandler()

Initialise compareBuffer

compareBuffer =

04 00 01 … 0F

findAndCompareValue()

tag = 0Dh, occurrence = 1

valueOffset = 0

compareOffset = 0

compareLength = 17

Result is 00h

21

Initialise compareBuffer

compareBuffer =

00 11 22 33 44 55

findAndCompareValue()

tag = 0Dh, occurrence = 2

valueOffset = 0

compareOffset = 0

compareLength = 6

Result is 00h

22

Initialise compareBuffer

compareBuffer =

00 11 22 33 44 66

findAndCompareValue()

tag = 0Dh, occurrence = 2

valueOffset = 0

compareOffset = 0

compareLength = 6

Result is -1

23

Send a GET INPUT command

GET INPUT Proactive command

Terminal Response, Text String length = 16

Text String TLV = 0D 11 04 00 01 … 0F

ProactiveResponseHandler.getTheHandler()

Initialise compareBuffer

CompareBuffer =

04 00 01 … 0F

Compare buffers (with tag 8Dh)

tag = 8Dh, occurrence = 1

valueOffset = 0

compareOffset = 0

compareLength = 17

Result is 00h

6.2.8.19.4 Test Coverage

CRR number

Test case number

N1

12

N2

14

N3

13, 17, 20, 21

N4

15, 18, 22

N5

16, 19

N6

23

P1

1

P2

2, 3, 4, 5, 6

P3

7, 8, 9, 10

P4

11

C1

Does not apply for Proactive Response Handler

6.2.8.20 Method getCapacity

Test Area Reference: API_2_PRH_GCAP

6.2.8.20.1 Conformance Requirement

The method with following header shall be compliant to its definition in the API.

public byte getCapacity()

6.2.8.20.1.1 Normal execution

  • CRRN1: The method shall return the maximum size of the Simple TLV list managed by the handler.

6.2.8.20.2 Test suite files

Test Script: API_2_PRH_GCAP_1.scr

Test Applet: API_2_PRH_GCAP_1.java

Load Script: API_2_PRH_GCAP_1.ldr

Cleanup Script: API_2_PRH_GCAP_1.clr

Parameter File: API_2_PRH_GCAP_1.par

6.2.8.20.3 Test Procedure

Id

Description

API Expectation

APDU Expectation

1

ProactiveResponseHandler available

1- Send envelope SMS-PP Formatted

2- The applet sends a proactive command

3- Fetch the proactive command and send Terminal Response

4- The applet calls method getCapacity() method

5- The applet calls method getLength() method

1- Applet is triggered

4-No exception is thrown

5- The Capacity result is greater or equal to getLength() result

2- 91 XX

3- The proactive command is fetched

6.2.8.20.4 Test Coverage

CRR number

Test case number

N1

1

6.2.8.21 Method getChannelIdentifier

Test Area Reference: API_2_PRH_GCID

6.2.8.21.1 Conformance Requirement:

The method with following header shall be compliant to its definition in the API.

public byte getChannelIdentifier()

throws ToolkitException

6.2.8.21.1.1 Normal execution

  • CRRN1:The method shall return the channel identifier byte value.
  • CRRN2:The channel identifier byte value returned shall be from the first Channel status TLV element.
  • CRRN3: If the element is available it becomes the currently selected TLV.

6.2.8.21.1.2 Context errors

  • CRRC1: The method shall throw ToolkitException (UNAVAILABLE_ELEMENT) if the Channel status TLV is not present.
  • CRRC2: The method shall throw ToolkitException (OUT_OF_TLV_BOUNDARIES) if the Simple TLV Channel Status length is equal to 0.

6.2.8.21.2 Test suite files

Test Script: API_2_PRH_GCID_1.scr

Test Applet: API_2_PRH_GCID_1.java

Load Script: API_2_PRH_GCID_1.ldr

Cleanup Script: API_2_PRH_GCID_1.clr

Parameter File: API_2_PRH_GCID_1.par

6.2.8.21.3 Test Procedure

Id

Description

API Expectation

APDU Expectation

0

Applet1 is installed with maximum number of channel = 01.

1

Channel status TLV is not present

1- Build and send a DISPLAY TEXT command

2- Call ProactiveResponseHandler.getChannelIdentifier() method.

2- UNAVAILABLE_ELEMENT ToolkitException is thrown

1- DISPLAY TEXT Proactive command is fetched.

TERMINAL RESPONSE with no Channel status TLV available.

2

Channel status TLV with a length equal to 0

1- Build and send a OPEN CHANNEL proactive command

2- Call ProactiveResponseHandler.getChannelIdentifier() method.

2- OUT_OF_TLV_BOUNDARIES ToolkitException is thrown

1- OPEN CHANNEL Proactive command is fetched.

TERMINAL RESPONSE with Channel status TLV length equal to 0.

3

Get channel identifier value

1- Call ProactiveHandler.init() and ProactiveHandler.send() methods to open a channel.

2- Call ProactiveResponseHandler.getChannelIdentifier() method.

3- Call ProactiveHandler.initCloseChannel() and ProactiveHandler.send() methods.

2- Returns 0x01

1- OPEN CHANNEL Proactive Command is fetched.

TERMINAL RESPONSE is issued with channel status value = 0x8100.

4

Get channel identifier value with 2 TLV

1- Call ProactiveHandler.init()and ProactiveHandler.send() methods to open a channel

2- Call ProactiveResponseHandler.getChannelIdentifier()

3- Call ProactiveHandler.initCloseChannel() and ProactiveHandler.send() methods.

2- Returns 0x01

1- OPEN CHANNEL Proactive Command is fetched.

TERMINAL RESPONSE is issued with channel status value = 0x8100 and 0x8200.

5

Channel status TLV is currently selected TLV

1- Call ProactiveHandler.init() and ProactiveHandler.send() methods to open a channel.

ViewHandler.FindTLV with Device Identity Tag.

2- Call ProactiveResponseHandler.getChannelIdentifier() method.

3- Compare ProactiveResponseHandler.getChannelIdentifier() and then ViewHandler.getValueByte(0) methods.

2- Returns 0x03

3- Check getChannelIdentifier() =getValueByte(0)

1- OPEN CHANNEL Proactive Command is fetched.

TERMINAL RESPONSE is issued with channel status value = 0x0305.

6.2.8.21.4 Test Coverage

CRR number

Test case number

N1

3

N2

4

N3

5

C1

1

C2

2

6.2.8.22 Method copyChannelData

Test Area Reference: API_2_PRH_CCHD_BSS

6.2.8.22.1 Conformance Requirement:

The method with following header shall be compliant to its definition in the API.

public short copyChannelData(byte[] dstBuffer,

short dstOffset,

short dstLength)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.8.22.1 Normal execution

  • CRRN1: The method shall copy a part of the Channel data string field.
  • CRRN2: The Channel data string field value returned shall be the first Channel data TLV element of the current response data field.
  • CRRN3: If the element is available it becomes the currenly selected TLV.
  • CRRN4: Returns dstOffset + dstLength.

6.2.8.22.2 Parameters error

  • CRRP1: If dstBuffer is null, a NullPointerException is thrown.
  • CRRP2: If dstOffset or dstLength parameter is negative an ArrayIndexOutOfBoundsException exception is thrown and no copy is performed.
  • CRRP3: If dstOffset+dstLength is greater than dstBuffer.length, the length of the dstBuffer array an ArrayIndexOutOfBoundsException exception is thrown and no copy is performed.
  • CRRP4: If dstLength is greater than the value field of the available TLV, a OUT_OF_TLV_BOUNDARIES ToolkitException is thrown.

6.2.8.22.3 Context errors

  • CRRC1: The method shall throw a UNAVAILABLE_ELEMENT ToolkitException if the Result TLV is not present.

6.2.8.22.2 Test suite files

Test Script: API_2_PRH_CCHD_BSS_1.scr

Test Applet: API_2_PRH_CCHD_BSS_1.java

Load Script: API_2_PRH_CCHD_BSS_1.ldr

Cleanup Script: API_2_PRH_CCHD_BSS_1.clr

Parameter File: API_2_PRH_CCHD_BSS_1.par

6.2.8.22.3 Test Procedure

Id

Description

API Expectation

APDU Expectation

0

1- Applet1 is installed with maximum number of channel = 01.

2- Applet1 builds proactive commands OPEN CHANNEL with init() method in order to open one channel.

ProactiveHandler.send() method is called.

2- OPEN CHANNEL proactive command is fetched

TERMINAL RESPONSE is issued with Channel Id = 01

1

CopyChannelData() with NULL dstBuffer

Build and send a RECEIVE DATA command

Call ProactiveResponseHandler.copyChannelData dstBuffer = NULL

dstOffset = 0

dstLength = 1

NullPointerException is thrown

RECEIVE DATA Proactive command is fetched.

TERMINAL RESPONSE with not empty Channel Data TLV is issued.

2

CopyChannelData() with negative dstOffset

1- call init() method for the RECEIVE DATA proactive command.

2- call ProactiveResponseHandler.copyChannelData()

dstBuffer.length = 8

dstOffset = -1

dstLength = 1

3- check dstBuffer is empty.

2- an ArrayIndexOutOfBoundsException exception is thrown.

3- no copy is performed.

1- RECEIVE DATA proactive command is fetched.

TERMINAL RESPONSE with 6 bytes avalaible (‘Hello1’)

3

CopyChannelData() with negative dstLength

1- call ProactiveResponseHandler.copyChannelData()

dstBuffer.length = 8

dstOffset = 0

dstLength = -1

2- check dstBuffer is empty.

1- an ArrayIndexOutOfBoundsException exception is thrown.

2- no copy is performed.

4

CopyChannelData() with dstOffset+dstLength greater than dstBuffer.length

1- call ProactiveResponseHandler.copyChannelData() with dstOffset+dstLength greater than dstBuffer.length.

dstBuffer.length = 8

dstOffset = 5

dstLength = 5

2- check dstBuffer is empty.

1- an ArrayIndexOutOfBoundsException exception is thrown.

2- no copy is performed.

5

CopyChannelData() with dstLength too large

Call ProactiveResponseHandler.copyChannelData() with dstLength greater than the value field of the available TLV.

dstBuffer.length = 8

dstOffset = 0

dstLength = 7

a OUT_OF_TLV_BOUNDARIES ToolkitException is thrown.

6

CopyChannelData() without Channel Data TLV element

1- call init() method for the RECEIVE DATA proactive command.

Call send() method.

2- call ProactiveResponseHandler.copyChannelData()

dstBuffer.length = 8

dstOffset = 0

dstLength = 6

2- a UNAVAILABLE_ELEMENT ToolkitException is thrown.

1- RECEIVE DATA proactive command is fetched

TERMINAL RESPONSE without ChannelData TLV element.

7

Successful copyChannelData()

Call init() method for the RECEIVE DATA proactive command.

Call send() method.

2- Call findTLV() with TAG of DEVICE IDENTITY.

3- Call ProactiveResponseHandler.copyChannelData()

dstBuffer.length = 8

dstOffset = 0

dstLength = 6

dstBuffer is the whole Buffer.

3- the Channel Data TLV is copied into dstBuffer.

The applet checks the returned value is dstOffset + dstLength = 6.

1- RECEIVE DATA proactive command is fetched

TERMINAL RESPONSE with one Channel data TLV element. (6 bytes available = ‘Hello2’)

8

Compare copied Buffer

Check dstBuffer.

The applet checks that dstBuffer contains the channel data from the TERMINAL RESPONSE.

9

Check the Channel Data TLV is selected

Call the ViewHandler.getValueByte(0) method

The returned byte is the same than the first byte of the Channel data TLV (i.e. ‘H’)

10

Successful copyChannelData()

Call ProactiveResponseHandler.copyChannelData()

dstBuffer.length = 8

dstOffset = 2

dstLength = 3

DstBuffer is a part of Buffer.

The Channel Data TLV is copied into dstBuffer.

The applet checks the returned value is dstOffset + dstLength = 5.

11

Compare copied Buffer

Check dstBuffer.

The applet checks that bytes from 2 to 4 of dstBuffer contain the first 3 bytes of channel data TLV from the TERMINAL RESPONSE.

12

Successful copyChannelData()

1- Initialise dstBuffer to [00, 01…]

2- Call ProactiveResponseHandler.copyChannelData()

dstBuffer.length = 8

dstOffset = 2

dstLength = 3

DstBuffer is a part of buffer.

2- The Channel Data TLV is copied into dstBuffer.

The returned value is dstOffset + dstLength = 5.

13

Compare copied Buffer

Check dstBuffer.

The applet checks that only bytes from 2 to 4 of dstBuffer have been updated with the first 3 bytes of channel data TLV from the TERMINAL RESPONSE.

14

Successful copyChannelData(), with 2 TLV

1- call init() method for the RECEIVE DATA proactive command.

Call send() method.

2- call ProactiveResponseHandler.copyChannelData() with dstLength lower than the value field of the available TLV.

dstBuffer.length = 8

dstOffset = 0

dstLength = 6

2- the first Channel Data TLV is copied into dstBuffer.

The returned value is dstOffset+dstLength =0x06

1- RECEIVE DATA proactive command is fetched

TERMINAL RESPONSE with two Channel data TLV element

1st TLV : 6 bytes available = ‘Hello3’

2nd TLV : 6 bytes available = ‘Hello4’

15

Compare copied Buffer

Check dstBuffer.

Check that dstBuffer contains the first Channel Data TLV from the TERMINAL RESPONSE.

6.2.8.22.4 Test Coverage

CRR number

Test case number

N1

7, 10, 12, 14

N2

14

N3

9

N4

8, 11, 13, 15

P1

1

P2

2, 3

P3

4

P4

5

C1

6