6.2.5 Class EnvelopeResponseHandler

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

6.2.5.1 Method getTheHandler

Test Area Reference: API_2_ERH_GTHD

6.2.5.1.1 Conformance requirement:

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

public static EnvelopeResponseHandler getTheHandler()

throws ToolkitException

6.2.5.1.1.1 Normal execution

  • CRRN1: The method shall return the single system instance of the EnvelopeResponseHandler class.
  • CRRN2: The EnvelopeResponseHandler is a Temporary JCRE Entry Point Object ( see Javacard 2.1 Runtime Environment (JCRE) Specification [12]).

6.2.5.1.1.1 Parameter errors

No requirements.

6.2.5.1.1.3 Context errors

  • CRRC1: The method shall thrown ToolkitException (HANDLER_NOT_AVAILABLE) if the handler is busy.
  • CRRC2: After the first invocation of the ProactiveHandler.send method the EnvelopeResponseHandler is no more available

6.2.5.1.2 Test suite files

Test Script: API_2_ERH_GTHD_1.scr

Test Applet: API_2_ERH_GTHD_1.java

Load Script: API_2_ERH_GTHD_1.ldr

Cleanup Script: API_2_ERH_GTHD_1.clr

Parameter File: API_2_ERH_GTHD_1.par

6.2.5.1.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

getTheHandler twice

The returned objects shall be the same

2

Verify that getTheHandler returns an EnvelopeHandler

getTheHandler

The reference returned shall be an EnvelopeResponseHandler (checkcast)

3

Verify the returned value is not null

getTheHandler

The reference returned shall not be null.

4

Send a proactive command, and then getTheHandler()

ToolkitException HANDLER_NOT_AVAILABLE is thrown

6.2.5.1.4 Test Coverage

CRR number

Test case number

N1

1, 2, 3

N2

Checked in Framework tests: FWK_API_HEPO (test case 2)

C1

Checked in Framework tests: FWK_MHA_ERHD

C2

4

6.2.5.2 Method post

Test Area Reference: API_2_ERH_POSTB

6.2.5.2.1 Conformance requirement

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

public void post(byte statusType)

throws ToolkitException

6.2.5.2.1.1 Normal execution

  • CRRN1: When the method is called, the toolkit applet can continue it’s processing (e.g. prepare a proactive command).
  • CRRN2: The byte statusType is SW1 of the status.
  • CRRN3: If the send method is called after a post method, the posted data are the first sent to the ME.
  • CRRN4: The SIM Toolkit Framework shall take the optional Application Data posted by the triggered toolkit applet if present, secure and send the response packet. The SIM Toolkit Framework will return the response APDU defined by the toolkit applet.

6.2.5.2.1.2 Parameter error

No requirements.

6.2.5.2.1.3 Context errors

  • CRRC1: The method shall thrown ToolkitException (HANDLER_NOT_AVAILABLE) if the handler is busy.

6.2.5.2.2 Test suite files

Specific triggering: Unformatted SMS PP Env and Call control

Test Script: API_2_ERH_POSTB_1.scr

Test Applet: API_2_ERH_POSTB_1.java

Load Script: API_2_ERH_POSTB_1.ldr

Cleanup Script: API_2_ERH_POSTB_1.clr

Parameter File: API_2_ERH_POSTB_1.par

6.2.5.2.3 Test procedure

Id

Description

API Expectation

APDU Expectation

Call Control Triggering

1

getTheHandler and then post

(the handler is empty)

9000

2

Fill the handler ( appendTLV to have bytes in it )and then post data with status 9F

9FFD data are retrieved with GET RESPONSE command

3

Verify that after a post the handler is no more available

appendTLV, post and then appendTLV

ToolkitException HANDLER_NOT_AVAILABLE is thrown on the second appendTLV

Unformatted SMS PP Env triggering

4

construct the response (appendTLV with 0x10 data) and post it with status 9E and then send a display text

9E12 and posted data retrieved by a GET RESPONSE with status 9113 and display text retrieved by a FETCH

5

Verify that it is possible to send a proactive command after a post

getTheHandler and post , then send a display text

91 13 and display text is retrieved by a FETCH

6

Verify it is not possible to post after a proactive command

getTheHandler, appendTLV, send a display text, post.

ToolkitException HANDLER_NOT_AVAILABLE is thrown

7

Verify that the handler is no more available after a post

getTheHandler, appendTLV, post with status 9E, post with status 9F

ToolkitException HANDLER_NOT_AVAILABLE is thrown

9E12 and posted data retrieved by a GET RESPONSE

6.2.5.2.4 Test Coverage

CRR number

Test case number

N1

3, 4, 7

N2

1, 2, 4, 7

N3

4, 5

N4

Checked in Framework tests: FWK_FWS_OUDA

C1

6

6.2.5.3 Method postAsBERTLV

Test Area Reference:API_2_ERH_POSTBB

6.2.5.3.1 Conformance Requirement

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

public void postAsBERTLV(byte statusType,

byte tag)

throws ToolkitException

6.2.5.3.1.1 Normal execution

  • CRRN1: When the method is called, the toolkit applet can continue it’s processing (e.g. prepare a proactive command) the SIM Toolkit Framework will return the response APDU defined by the toolkit applet.
  • CRRN2: The byte statusType is SW1 of the status
  • CRRN3: If the send method is called after a postAsBERTLV method, the posted data are the first sent to the ME.
  • CRRN4: The byte tag is the BER Tag at the beginning of the simple TLV list.

6.2.5.3.1.2 Parameter errors

No requirements.

6.2.5.3.1.3 Context errors

  • CRRC1: The method shall thrown ToolkitException (HANDLER_NOT_AVAILABLE) if the handler is busy.

6.2.5.3.2 Test suite files

Specific triggering: Unformatted SMS PP Env and Call control

Test Script: API_2_ERH_POSTBB_1.scr

Test Applet: API_2_ERH_POSTBB_1.java

Load Script: API_2_ERH_POSTBB_1.ldr

Cleanup Script: API_2_ERH_POSTBB_1.clr

Parameter File: API_2_ERH_POSTBB_1.par

6.2.5.3.3 Test procedure

Id

Description

API Expectation

APDU Expectation

Call Control triggering

1

getTheHandler and then postAsBERTLV

(the handler is empty)

9F02 data are retrieved with GET RESPONSE command, the tag shall be 33 and the length is 00

2

Fill the handler and then postAsBERTLV the data with status 9F, and tag 33

9FFF data are retrieved with GET RESPONSE command, the tag shall be 33

3

appendTLV, postAsBERTLV and then appendTLV

ToolkitException HANDLER_NOT_AVAILABLE is thrown on the second appendTLV

Unformatted SMS PP Env triggering

4

construct the response (appendTLV with 0x10 data) and postAsBERTLV it with status 9E, tag 75 and then send a display text

9E14 and posted data retrieved by a GET RESPONSE the tag shall be 75 with status 9113 and display text retrieved by a FETCH

5

getTheHandler and postAsBERTLV, then send a display text

9E02 and posted data retrieved by a GET RESPONSE the tag 33 (and the length 00) with status 9113 and display text is retrieved by a FETCH

6

Verify it is not possible to postAsBERTLV after a proactive command

getTheHandler, appendTLV, send a display text, postAsBERTLV.

ToolkitException HANDLER_NOT_AVAILABLE is thrown on the postAsBERTLV

7

Verify that the handler is no more available after a postAsBERTLV

getTheHandler, appendTLV(with data length = 0x10, postAsBERTLV with status 9E, tag 56, postAsBERTLV with status 9F, tag 28

ToolkitException HANDLER_NOT_AVAILABLE is thrown on the second postAsBERTLV

9E14 and posted data retrieved by a GET RESPONSE the tag shall be 56 with status 9000

6.2.5.3.4 Test Coverage

CRR number

Test case number

N1

3, 4, 7

N2

1, 2, 4, 7

N3

4, 5

N4

2, 4, 7

C1

6

6.2.5.4 Method getLength

Test Area Reference: API_2_ERH_GLEN

6.2.5.4.1 Conformance requirement

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

public short getLength()

throws ToolkitException

6.2.5.4.1.1 Normal execution

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

6.2.5.4.1.2 Parameter errors

No requirements.

6.2.5.4.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.5.4.2 Test Suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_GLEN_1.scr

Test Applet: API_2_ERH_GLEN_1.java

Load Script: API_2_ERH_GLEN_1.ldr

Cleanup Script: API_2_ERH_GLEN_1.clr

Parameter File: API_2_ERH_GLEN_1.par

6.2.5.4.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Clear the handler

getLength()

Result of getLength() is 0

2

appendTLV with length of 7

getLength()

Result of getLength() is 9

3

Clear the handler and appendTLV with Length of 250

getLength()

Result of getLength() is 253

4

Build a 7Fh Envelope response handler

getLength()

Result of getLength() is 81h

5

Build a 80h Envelope response handler

getLength()

Result of getLength() is 83h

6

Call the post() method

getLength()

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

NOTE: Test case 3 is limited to 253 and not 256 because the current 3GPP TS 43.019 [7] is not clear enough on this point. So this test allows the two possible implementations.

6.2.5.4.4 Test Coverage

CRR number

Test case number

N1

1, 2, 3, 4, 5

C1

6

6.2.5.5 Method copy

Test Area Reference: API_2_ERH_COPY_BSS

6.2.5.5.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.5.5.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.5.5.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 greater 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.5.5.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.5.5.2 Test Suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_COPY_BSS_1.scr

Test Applet: API_2_ERH_COPY_BSS_1.java

Load Script: API_2_ERH_COPY_BSS_1.ldr

Cleanup Script: API_2_ERH_COPY_BSS_1.clr

Parameter File: API_2_ERH_COPY_BSS_1.par

6.2.5.5.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

appendTLV with value length of 7

NULL as parameter to dstBuffer

NullPointerException is thrown

2

dstOffset ≥ dstBuffer.length

dstBuffer.length = 5

dstOffset = 5

dstLength = 1

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 = 10

dstOffset = 0

dstLength = 10

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

8

Successful call, dstBuffer is the whole buffer

dstBuffer.length = 9

dstOffset = 0

dstLength = 9

Result of copy() is 9

9

Compare the buffer

Result of arrayCompare() is 0

10

Successful call, dstBuffer is part of a buffer

dstBuffer.length = 15

dstOffset = 3

dstLength = 9

Result of copy() is 12

11

Compare the whole buffer

Result of arrayCompare() is 0

12

Successful call, dstBuffer is part of a buffer

dstBuffer.length = 15

dstOffset = 3

dstLength = 6

Result of copy() is 9

13

Compare the whole buffer

Result of arrayCompare() is 0

14

Successful call, copy with length =0

dstBuffer.length = 15

dstOffset = 15

dstLength = 0

Result of copy() is 15

15

Call the post() method

Call copy():

dstBuffer.length = 10

dstOffset = 0

dstLength = 0

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.5.4 Test Coverage

CRR number

Test case number

N1

9, 11, 13

N2

8, 10, 12, 14

P1

1

P2

2, 3, 4, 5, 6

P3

7

C1

15

6.2.5.6 Method findTLV

Test Area Reference: API_2_ERH_FINDBB

6.2.5.6.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.5.6.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.5.6.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.5.6.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.5.6.2 Test Suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_FINDBB_1.scr

Test Applet: API_2_ERH_FINDBB_1.java

Load Script: API_2_ERH_FINDBB_1.ldr

Cleanup Script: API_2_ERH_FINDBB_1.clr

Parameter File: API_2_ERH_FINDBB_1.par

6.2.5.6.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

append the handler with TLVs:

81 03 11 22 33

82 02 99 77

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 = 03h

Occurrence = 1

Result is TLV_NOT_FOUND

7

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT is 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 is thrown.

10

Append a TLV with tag=02h

Search the TLV

Tag = 02h

Occurrence = 2

Result is TLV_FOUND_CR_NOT_SET

11

Append a TLV with tag=04h

Search the TLV

Tag = 04h

Occurrence = 1

Result is TLV_FOUND_CR_NOT_SET

12

Search tag 81h

Tag = 81h

Occurrence = 1

Result is TLV_FOUND_CR_SET

13

Search tag 84h

Tag = 84h

Occurrence = 1

Result is TLV_FOUND_CR_NOT_SET

14

Call the post() method then Search 1st TLV

Tag = 81h

Occurrence = 1

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.6.4 Test Coverage

CRR number

Test case number

N1

3, 5

N2

2, 4

N3

10, 11

N4

6, 7,8, 9

N5

12, 13

P1

1

C1

14

6.2.5.7 Method getValueLength

Test Area Reference: API_2_ERH_GVLE

6.2.5.7.1 Conformance requirement

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

public short getValueLength()

throws ToolkitException

6.2.5.7.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.5.7.1.2 Parameter errors

No requirements.

6.2.5.7.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.5.7.2 Test Suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_GVLE_1.scr

Test Applet: API_2_ERH_GVLE_1.java

Load Script: API_2_ERH_GVLE_1.ldr

Cleanup Script: API_2_ERH_GVLE_1.clr

Parameter File: API_2_ERH_GVLE_1.par

6.2.5.7.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

appendTLV 02 02 02 02

findTLV with TAG 03

getValueLength()

ToolkitException.UNAVAILABLE_ELEMENT is thrown

2

appendTLV with TAG 0D and length 00

Search TLV 0Dh

getValueLength()

Result is 00h

3

Clear the handler and append TLV with TAG 0D and length 02

Search TLV 0Dh

getValueLength()

Result is 02h

4

Clear the handler and append TLV with TAG 0D and length 0x7F

Search TLV 0Dh

getValueLength()

Result is 7Fh

5

Clear the handler and append TLV with TAG 0D and length 0x80

Search TLV 0Dh

getValueLength()

Result is 80h

6

Clear the handler and append TLV with TAG 0D and length 0xF1

Search TLV 0Dh

getValueLength()

Result is F1h

7

Call the post() method

getValueLength()

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.7.4 Test Coverage

CRR number

Test case number

N1

2, 3, 4, 5, 6

C1

7

C2

1

6.2.5.8 Method getValueByte

Test Area Reference: API_2_ERH_GVBYS

6.2.5.8.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.5.8.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.5.8.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.5.8.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.5.8.2 Test Suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_GVBYS_1.scr

Test Applet: API_2_ERH_GVBYS_1.java

Load Script: API_2_ERH_GVBYS_1.ldr

Cleanup Script: API_2_ERH_GVBYS_1.clr

Parameter File: API_2_ERH_GVBYS_1.par

6.2.5.8.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

appendTLV 82 02 81 82, appendTLV 81 03 11 22 FE

findTLV with TAG 03

getValueByte(0x00)

ToolkitException.UNAVAILABLE_ELEMENT is thrown

2

Search TLV 01h

getValueByte(0x03)

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

3

Search TLV 01h

getValueByte(0x02)

Result is FEh

4

Search TLV 02h

getValueByte(0x00)

Result is 81h

5

appendTLV with TAG 0D, Length 0x7E, Value: 00, 01, …, 7D

getValueByte(0x07D)

Result is 7Dh

6

clear the handler, appendTLV with TAG 0D, Length 0x80, Value: 00, 01, …, 7F

getValueByte(0x07E)

Result is 7Eh

7

getValueByte(0x07F)

Result is 7Fh

8

clear the handler, appendTLV with TAG 0D, Length 0xF1, Value: 00, 01, …, F0

getValueByte(0x0F0)

Result is F0h

9

Call the post() method

getValueByte(0)

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.8.4 Test Coverage

CRR number

Test case number

N1

3, 4, 5, 6, 7, 8

P1

2

C1

9

C2

1

6.2.5.9 Method copyValue

Test Area Reference: API_2_ERH_CPYVS_BSS

6.2.5.9.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.5.9.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.5.9.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.5.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.
  • CRRC2: in case of unavailable TLV element an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException.UNAVAILABLE_ELEMENT.

6.2.5.9.2 Test Suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_CPYVS_BSS_1.scr

Test Applet: API_2_ERH_CPYVS_BSS_1.java

Load Script: API_2_ERH_CPYVS_BSS_1.ldr

Cleanup Script: API_2_ERH_CPYVS_BSS_1.clr

Parameter File: API_2_ERH_CPYVS_BSS_1.par

6.2.5.9.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

appendTLV with TAG: 0D and length 16

Select Text String TLV

copyValue() with a null dstBuffer

NullPointerException is thrown

2

dstOffset ≥ dstBuffer.length

dstBuffer.length = 5

dstOffset = 5

dstLength = 1

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

clear the handler, appendTLV with TAG: 0D and length 6

Select Text String TLV

valueOffset ≥ Text String Length

valueOffset = 6

dstBuffer.length = 15

dstOffset = 0

dstLength = 1

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

Initialise the handler

copyValue()

ToolkitException.UNAVAILABLE_ELEMENT is thrown

12

clear the handler, appendTLV with TAG: 0D and value: 04 00 01 … 0F

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

16

Successful call, copyValue with length =0

dstBuffer.length = 20

dstOffset = 20

dstLength = 0

Result of copyValue() is 20

17

Call post() method then copyValue()

dstBuffer.length = 20

dstOffset = 0

dstLength = 0

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.9.4 Test Coverage

CRR number

Test case number

N1

13, 15

N2

12, 14, 16

P1

1

P2

2, 3, 4, 5, 6

P3

7, 8, 9, 10

C1

17

C2

11

6.2.5.10 Method compareValue

Test Area Reference: API_2_ERH_CPRVS_BSS

6.2.5.10.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.5.10.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.5.10.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.5.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.
  • CRRC2: in case of unavailable TLV element an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException.UNAVAILABLE_ELEMENT.

6.2.5.10.2 Test Suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_CPRVS_BSS_1.scr

Test Applet: API_2_ERH_CPRVS_BSS_1.java

Load Script: API_2_ERH_CPRVS_BSS_1.ldr

Cleanup Script: API_2_ERH_CPRVS_BSS_1.clr

Parameter File: API_2_ERH_CPRVS_BSS_1.par

6.2.5.10.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

appendTLV with TAG: 0D and length 16

Select Text String TLV

compareValue() with a null compareBuffer

NullPointerException is thrown

2

compareOffset ≥ compareBuffer.length

compareBuffer.length = 5

compareOffset = 5

compareLength = 1

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

appendTLV with TAG: 0D and length 6

Select Text String TLV

valueOffset ≥ Text String Length

valueOffset = 6

compareBuffer.length = 15

compareOffset = 0

compareLength = 1

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

Initialise the handler

compareValue()

ToolkitException.UNAVAILABLE_ELEMENT is thrown

12

appendTLV with TAG: 0D and value: 04 00 01 … 0F

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 02 03

04 05 06 07 08

05 0A 0B 0C 0D

0E 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

18

Successful call, compareValue with length =0

compareBuffer.length = 20

compareOffset = 15

compareLength = 0

Result of compareValue() is 0

19

Call post() method then compareValue()

compareBuffer.length = 20

compareOffset = 0

compareLength = 0

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.10.4 Test Coverage

CRR number

Test case number

N1

12, 15, 18

N2

13, 16

N3

14, 17

P1

1

P2

2, 3, 4, 5, 6

P3

7, 8, 9, 10

C1

19

C2

11

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

Test Area Reference: API_2_ERH_FACYB_BS

6.2.5.11.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.5.11.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.5.11.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.5.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.5.11.2 Test Suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_FACYB_BS_1.scr

Test Applet: API_2_ERH_FACYB_BS_1.java

Load Script: API_2_ERH_FACYB_BS_1.ldr

Cleanup Script: API_2_ERH_FACYB_BS_1.clr

Parameter File: API_2_ERH_FACYB_BS_1.par

6.2.5.11.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Initialise the handler

findAndCopyValue() with a null dstBuffer

NullPointerException is thrown

2

appendTLV with TAG: 0D and length 16

Select Text String TLV

dstOffset ≥ dstBuffer.length

tag = 0Dh

dstBuffer.length = 20

dstOffset = 20

ArrayIndexOutOfBoundsException is thrown

3

dstOffset < 0

dstBuffer.length = 20

dstOffset = -1

ArrayIndexOutOfBoundsException is thrown

4

dstOffset + length >dstBuffer.length

dstBuffer.length = 20

dstOffset = 5

ArrayIndexOutOfBoundsException is thrown

5

length > dstBuffer.length

dstBuffer.length = 15

dstOffset = 0

ArrayIndexOutOfBoundsException is thrown

6

clear the handler, appendTLV with TAG 02 and Length 02

Select a TLV (tag 02h)

findAndCopyValue()

tag = 03h

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT is thrown

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

7

appendTLV with TAG: 0D and value: 04 00 01 … 0F

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

clear the handler, appendTLV with TAG: 0D and value: 04 00 01 … 0F

append a 2nd Text String TLV

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

clear the handler, appendTLV with TAG: 0D and value: 04 00 01 … 0F

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

15

Append tag 0Fh

buffer = 00 01 … 0F

Successful call (with tag 8Fh)

tag = 8Fh

dstBuffer.length = 16

dstOffset = 0

Result of findAndCopyValue() is 16

16

Compare buffer

buffer = 00 01 … 0F

Result is 00h

17

Call post() method then findAndCopyValue()

tag = 8Fh

dstBuffer.length = 0

dstOffset = 0

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.11.4 Test Coverage

CRR number

Test case number

N1

8, 10, 12

N2

6

N3

7, 9, 11

N4

13, 14, 15, 16

P1

1

P2

2, 3, 4, 5

C1

17

6.2.5.12 Method findAndCopyValue(byte tag, byte occurrence, short valueOffset, byte[] dstBuffer, short dstOffset, short dstLength)

Test Area Reference: API_2_ERH_FACYBBS_BSS

6.2.5.12.1 Conformance requirement

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

public short findAndCopyValue(byte tag,

byte occurrence,

short valueOffset,

byte[] dstBuffer,

short dstOffset,

short dstLength)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.5.12.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.5.12.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.5.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.

6.2.5.12.2 Test Suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_FACYBBS_BSS_1.scr

Test Applet: API_2_ERH_FACYBBS_BSS_1.java

Load Script: API_2_ERH_FACYBBS_BSS_1.ldr

Cleanup Script: API_2_ERH_FACYBBS_BSS_1.clr

Parameter File: API_2_ERH_FACYBBS_BSS_1.par

6.2.5.12.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Initialise the handler

findAndCopyValue() with a null dstBuffer

NullPointerException is thrown

2

appendTLV with TAG: 0D and length 16

dstOffset ≥ dstBuffer.length

tag = 0Dh, occurrence = 1

valueOffset = 0

dstBuffer.length = 5

dstOffset = 5

dstLength = 1

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

appendTLV with TAG: 0D and length 6

valueOffset ≥ Text String Length

tag = 0Dh, occurrence = 1

valueOffset = 6

dstBuffer.length = 15

dstOffset = 0

dstLength = 1

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

clear the handler, appendTLV with TAG 02 and Length 02

Select a TLV (tag 02h)

findAndCopyValue()

tag = 0Dh

occurrence = 2

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT is thrown

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

12

clear the handler and appendTLV with TAG: 0D and value: 04 00 01 … 0F

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

Append a Text String TLV

tag = 0D

buffer = 00 11 22 33 44 55 (no specific DCS byte)

Successful call

tag = 0Dh, occurrence = 1

valueOffset = 0

dstBuffer.length = 20

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

clear the handler and appendTLV with TAG: 0D and value: 04 00 01 … 0F

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

22

Append tag 0Fh

buffer = 00 01 … 0F

Successful call (with tag 8Fh)

tag = 8Fh

occurrence = 1

valueOffset = 0

dstBuffer.length = 16

dstOffset = 0

dstLength = 16

Result of findAndCopyValue () is 16

23

Compare buffer

buffer = 00 01 … 0F

Result is 00h

24

Successful call, findAndCopyValue with length =0

dstBuffer.length = 16

dstOffset = 16

dstLength = 0

Result of findAndCopyValue () is 16

25

Call post() method then findAndCopyValue()

dstBuffer.length = 16

dstOffset = 0

dstLength = 0

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.12.4 Test Coverage

CRR number

Test case number

N1

13, 15, 17, 19

N2

11

N3

12, 14, 16, 18, 24

N4

20, 21, 22, 23

P1

1

P2

2, 3, 4, 5, 6

P3

7, 8, 9, 10

C1

25

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

Test Area Reference: API_2_ERH_FACRB_BS

6.2.5.13.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.5.13.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.5.13.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.5.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.

6.2.5.13.2 Test Suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_FACRB_BS_1.scr

Test Applet: API_2_ERH_FACRB_BS_1.java

Load Script: API_2_ERH_FACRB_BS_1.ldr

Cleanup Script: API_2_ERH_FACRB_BS_1.clr

Parameter File: API_2_ERH_FACRB_BS_1.par

6.2.5.13.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

appendTLV with TAG: 0D and length 16

findAndCompareValue() with a null dstBuffer and tag 0Dh

NullPointerException is thrown

2

compareOffset ≥ compareBuffer.length

tag = 0Dh

compareBuffer.length = 20

compareOffset = 20

ArrayIndexOutOfBoundsException is thrown

3

compareOffset < 0

compareBuffer.length = 20

compareOffset = -1

ArrayIndexOutOfBoundsException is thrown

4

compareOffset + length > compareBuffer.length

compareBuffer.length = 20

compareOffset = 5

ArrayIndexOutOfBoundsException is thrown

5

length > compareBuffer.length

compareBuffer.length = 15

compareOffset = 0

ArrayIndexOutOfBoundsException is thrown

6

clear the handler, appendTLV with TAG 02 and Length 02

Select a TLV (tag 02h)

findAndCompareValue()

tag = 03h

ToolkitException.UNAVAILABLE_ELEMENT is thrown

7

Verify current TLV

getValueLength()

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

8

clear the handler and appendTLV with TAG: 0D and value: 04 00 01 … 0F

Initialise compareBuffer

compareBuffer =

04 00 01 … 0F

Compare buffers

tag = 0Dh

compareOffset = 0

Result is 00h

9

Verify current TLV

getValueLength()

Result is 17

10

Initialise compareBuffer

compareBuffer =

04 00 01 … 10

Compare buffers with same parameters

Result is -1

11

Initialise compareBuffer

compareBuffer =

03 00 01 … 0F

Compare buffers with same parameters

Result is +1

12

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

append a Text String TLV

tag = 0Dh

buffer = 00 11 22 33 44 55

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

14

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

15

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

16

clear the handler and appendTLV with TAG: 0D and value: 04 00 01 … 0F

Initialise compareBuffer

compareBuffer = 04 00 01 … 0F

Successful call (with tag 8Dh)

tag = 8Dh

compareBuffer.length = 17

compareOffset = 0

Result is 00h

17

Append tag 0Fh

buffer = 00 01 … 0F

Initialise compareBuffer

compareBuffer = 00 01 … 0F

Successful call (with tag 8Fh)

tag = 8Fh

compareBuffer.length = 16

compareOffset = 0

Result is 00h

18

Call post() method then findAndCompareValue()

tag = 8Fh

compareBuffer.length = 0

compareOffset = 0

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.13.4 Test Coverage

CRR number

Test case number

N1

6,7

N2

7,9

N3

8, 13, 12

N4

10, 14

N5

11, 15

N6

17, 16

P1

1

P2

2, 3, 4, 5

C1

18

6.2.5.14 Method findAndCompareValue(byte tag, byte occurrence, short valueOffset, byte[] compareBuffer, short compareOffset, short compareLength)

Test Area Reference: API_2_ERH_FACRBBS_BSS

6.2.5.14.1 Conformance requirement

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

public byte findAndCompareValue(byte tag,

byte occurrence,

short valueOffset,

byte[] compareBuffer,

short compareOffset,

short compareLength)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.5.14.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.5.14.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. occurrence = 0) an instance of ToolkitException shall be thrown. The reason code shall be ToolkitException.BAD_INPUT_PARAMETER.

6.2.5.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.

6.2.5.14.2 Test Suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_FACRBBS_BSS_1.scr

Test Applet: API_2_ERH_FACRBBS_BSS_1.java

Load Script: API_2_ERH_FACRBBS_BSS_1.ldr

Cleanup Script: API_2_ERH_FACRBBS_BSS_1.clr

Parameter File: API_2_ERH_FACRBBS_BSS_1.par

6.2.5.14.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Initialise the handler

findAndCompareValue() with a null compareBuffer

NullPointerException is thrown

2

clear the handler and appendTLV with TAG: 0D and value: 04 00 01 … 0F

compareOffset ≥ compareBuffer.length

tag = 0Dh, occurrence = 1

valueOffset = 0

compareBuffer.length = 5

compareOffset = 5

compareLength = 1

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

clear the handler and appendTLV with TAG and length of 6

valueOffset ≥ Text String Length

tag = 0Dh, occurrence = 1

valueOffset = 6

compareBuffer.length = 15

compareOffset = 0

compareLength = 1

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

appendTLV with TAG 02 and length 02

Select a TLV (tag 02h)

findAndCompareValue()

tag = 0Dh

occurrence = 2

ToolkitException.UNAVAILABLE_ELEMENT is thrown

13

Verify current TLV

getValueLength()

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

14

clear the handler and appendTLV with TAG: 0D and value: 04 00 01 … 0F

Initialise compareBuffer

compareBuffer =

04 00 01 … 0F

findAndCompareValue()

tag = 0Dh, occurrence = 1

valueOffset = 0

compareOffset = 0

compareLength = 17

Result is 00h

15

Verify current TLV

getValueLength()

Result is 17

16

Initialise compareBuffer

compareBuffer =

04 00 01 … 10

Compare buffers with same parameters

Result is -1

17

Initialise compareBuffer

compareBuffer =

03 00 01 … 0F

Compare buffers with same parameters

Result is +1

18

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

19

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

20

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

21

append a Text String TLV

tag = 0Dh

buffer = 00 11 22 33 44 55

Initialise compareBuffer

compareBuffer =

04 00 01 … 0F

findAndCompareValue()

tag = 0Dh, occurrence = 1

valueOffset = 0

compareOffset = 0

compareLength = 17

Result is 00h

22

Initialise compareBuffer

compareBuffer =

00 11 22 33 44 55

findAndCompareValue()

tag = 0Dh, occurrence = 2

valueOffset = 0

compareOffset = 0

compareLength = 6

Result is 00h

23

Initialise compareBuffer

compareBuffer =

00 11 22 33 44 66

findAndCompareValue()

tag = 0Dh, occurrence = 2

valueOffset = 0

compareOffset = 0

compareLength = 6

Result is -1

24

clear the handler and appendTLV with TAG: 0D and value: 04 00 01 … 0F

Initialise compareBuffer

compareBuffer = 04 00 01 … 0F

Successful call (with tag 8Dh)

tag = 8Dh, occurrence = 1

valueOffset = 0

compareBuffer.length = 17

compareOffset = 0

compareLength = 17

Result is 00h

25

Append tag 0Fh

buffer = 00 01 … 0F

Initialise compareBuffer

compareBuffer = 00 01 … 0F

Successful call (with tag 8Fh)

tag = 8Fh, occurrence = 1

valueOffset = 0

compareBuffer.length = 16

compareOffset = 0

compareLength = 16

Result is 00h

26

Successful call, findAndCompareValue with length =0

CompareBuffer.length = 16

compareOffset = 16

compareLength = 0

Result of findAndCompareValue () is 00

27

Call post() method then findAndCompareValue()

CompareBuffer.length = 16

compareOffset = 0

compareLength = 0

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.14.4 Test Coverage

CRR number

Test case number

N1

12,13

N2

15,13

N3

14, 18, 22, 21, 26

N4

16, 19, 23

N5

17, 19

N6

25, 24

P1

1

P2

2, 3, 4, 5, 6

P3

7, 8, 9, 10

P4

11

C1

27

6.2.5.15 Method appendArray

Test Area Reference: API_2_ERH_APDA_BSS

6.2.5.15.1 Conformance requirement:

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

public void appendArray(byte[] buffer,

short offset,

short length)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.5.15.1.1 Normal execution

  • CRRN1: appends a buffer into the EditHandler buffer.
  • CRRN2: a successful append does not modify the TLV selected.

6.2.5.15.1.2 Parameters error

  • CRRP1: if buffer is null, a java.lang.NullPointerException is thrown.
  • CRRP2: if offset or length or both would cause access outside the array bounds, or if length is negative, a java.lang.ArrayIndexOutOfBoundsException is thrown.

6.2.5.15.1.3 Context errors

  • CRRC1: if the EditHandler buffer is too small to append the requested data, a ToolkitException is thrown with reason code HANDLER_OVERFLOW.
  • CRRC2: if the EditHandler buffer is busy, a ToolkitException is thrown with reason code HANDLER_NOT_AVAILABLE.

6.2.5.15.2 Test suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_APDA_BSS_1.scr

Test Applet: API_2_ERH_APDA_BSS_1.java

Load Script: API_2_ERH_APDA_BSS_1.ldr

Cleanup Script: API_2_ERH_APDA_BSS_1.clr

Parameter File: API_2_ERH_APDA_BSS_1.par

6.2.5.15.3 Test procedure

Id

Description

API Expectation

APDU Expectation

Initialise the envelope response handler with a TLV of length 1

1

Null buffer

NullPointerException is thrown

2

offset ≥ buffer.length

buffer.length = 5

offset = 5

length = 1

ArrayIndexOutOfBoundsException is thrown

3

offset < 0

buffer.length = 5

offset = -1

length = 1

ArrayIndexOutOfBoundsException is thrown

4

length > buffer.length

buffer.length = 5

offset = 0

length = 6

ArrayIndexOutOfBoundsException is thrown

5

offset + length > buffer.length

buffer.length = 5

offset = 3

length = 3

ArrayIndexOutOfBoundsException is thrown

6

length < 0

buffer.length = 5

offset = 0

length = -1

ArrayIndexOutOfBoundsException is thrown

7

Handler overflow

buffer.length = 256

offset = 0

length = 256

ToolkitException.HANDLER_OVERFLOW is thrown

8

append the handler with TLVs:

81 03 11 22 33

82 02 99 77

findTLV 0x81

Successful call

buffer = FF FE … F8

offset = 0

length = 8

Verify Current TLV: Call getValueLength()

Result is 03h

9

Clear the handler

Successful call

buffer = FF FE … F8

offset = 0

length = 8

Call copy() method

Compare handler

compareBuffer = FF FE … F8

Result is 00h

10

Successful call

buffer = 00 01 … 07

offset = 2

length = 6

Call copy() method

Compare handler

compareBuffer = FF FE … F8 02 03 … 07

Result is 00h

11

Successful call

buffer = 11 22 … 88

offset = 2

length = 4

Call copy() method

Compare handler

compareBuffer = FF FE … F8 02 03 … 07 33 44 55 66

Result is 00h

12

Call post() method then appendArray()

buffer = 11 22 … 88

offset = 2

length = 4

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.15.4 Test Coverage

CRR number

Test case number

N1

9, 10, 11

N2

8

P1

1

P2

2, 3, 4, 5, 6

C1

7

C2

12

6.2.5.16 Method appendTLV(byte tag, byte value)

Test Area Reference: API_2_ERH_APTLBB

6.2.5.16.1 Conformance requirement:

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

public void appendTLV(byte tag,

byte value)

throws ToolkitException

6.2.5.16.1.1 Normal execution

  • CRRN1: Appends a TLV element to the current TLV list (1-byte element).
  • CRRN2: A successful append does not modify the TLV selected.

6.2.5.16.1.2 Parameters error

No requirements

6.2.5.16.1.3 Context errors

  • CRRC1: if the EditHandler buffer is too small to append the requested data, a ToolkitException is thrown with reason code HANDLER_OVERFLOW.
  • CRRC2: if the EditHandler buffer is busy, a ToolkitException is thrown with reason code HANDLER_NOT_AVAILABLE.

6.2.5.16.2 Test suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_APTLBB_1.scr

Test Applet: API_2_ERH_APTLBB_1.java

Load Script: API_2_ERH_APTLBB_1.ldr

Cleanup Script: API_2_ERH_APTLBB_1.clr

Parameter File: API_2_ERH_APTLBB_1.par

6.2.5.16.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Call appendArray()

length = 253

Handler Overflow: Call twice the appendTLV()method

ToolkitException.HANDLER_OVERFLOW is thrown by one of the two.

2

append the handler with TLVs:

81 03 11 22 33

82 02 99 77

Select Command Details TLV

Call the appendTLV() method

Verify Current TLV: Call getValueLength()

Result is 03h

3

Clear the handler

Successful call

tag = 84h

value = 00h

Call copy() method

Compare handler

compareBuffer = 84 01 00

Result is 00h

4

Successful call

tag = 01h

value = FEh

Call copy() method

Compare handler

compareBuffer = 84 01 00 01 01 FE

Result is 00h

5

Call post() method then appendTLV()

tag = 01h

value = FEh

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

NOTE: Test case 1 call twice appendTLV because the current 3GPP TS 43.019 [7] is not clear enough on this point. So this test allows the two possible implementations.

6.2.5.16.4 Test Coverage

CRR number

Test case number

N1

3, 4

N2

2

C1

1

C2

5

6.2.5.17 Method appendTLV(byte tag, byte value1, byte value2)

Test Area Reference: API_2_ERH_APTLBBB

6.2.5.17.1 Conformance requirements:

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

public void appendTLV(byte tag,

byte value1,

byte value2)

throws ToolkitException

6.2.5.17.1.1 Normal execution

  • CRRN1: Appends a TLV element to the current TLV list (2-byte element).
  • CRRN2: A successful append does not modify the TLV selected.

6.2.5.17.1.2 Parameters error

No requirements

6.2.5.17.1.3 Context errors

  • CRRC1: if the EditHandler buffer is too small to append the requested data, a ToolkitException is thrown with reason code HANDLER_OVERFLOW.
  • CRRC2: if the EditHandler buffer is busy, a ToolkitException is thrown with reason code HANDLER_NOT_AVAILABLE.

6.2.5.17.2 Test suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_APTLBBB_1.scr

Test Applet: API_2_ERH_APTL BBB_1.java

Load Script: API_2_ERH_APTL BBB_1.ldr

Cleanup Script: API_2_ERH_APTLBBB_1.clr

Parameter File: API_2_ERH_APTLBBB_1.par

6.2.5.17.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Call the appendArray with length of 253

Handler Overflow: Call the appendTLV() method

ToolkitException.HANDLER_OVERFLOW is thrown

2

clear the handler, append the handler with TLVs:

81 03 11 22 33

82 02 99 77

Select Command Details TLV

Call the appendTLV() method

Verify Current TLV: Call getValueLength()

Result is 03h

3

Clear the handler

Successful call

tag = 84h

value1 = 00h

value2 = 01h

Call copy() method

Compare handler

compareBuffer = 84 02 00 01

Result is 00h

4

Successful call

tag = 01h

value1 = FEh

value2 = FDh

Call copy() method

Compare handler

compareBuffer = 84 02 00 01 01 02 FE FD

Result is 00h

5

Call post() method then appendTLV()

tag = 01h

value1 = FEh

value2 = FDh

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.17.4 Test Coverage

CRR number

Test case number

N1

3, 4

N2

2

C1

1

C2

5

6.2.5.18 Method appendTLV(byte tag, byte[ ] value, short valueoffset, short valuelength)

Test Area Reference: API_2_ERH_APTLB_BSS

6.2.5.18.1 Conformance requirement:

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

public void appendTLV(byte tag,

byte[] value,

short valueOffset,

short valueLength)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.5.18.1.1 Normal execution

  • CRRN1: Appends a TLV element to the current TLV list (byte-array element).
  • CRRN2: A successful append does not modify the TLV selected.

6.2.5.18.1.2 Parameters error

  • CRRP1: if value is null, a java.lang.NullPointerException is thrown
  • CRRP2: if valueoffset or valuelength or both would cause access outside the array bounds, or if length is negative, a java.lang.ArrayIndexOutOfBoundsException is thrown.

6.2.5.18.1.3 Context errors

  • CRRC1: if the EditHandler buffer is too small to append the requested data, a ToolkitException is thrown with reason code HANDLER_OVERFLOW.
  • CRRC2: if the EditHandler buffer is busy, a ToolkitException is thrown with reason code HANDLER_NOT_AVAILABLE.
  • CRRC3: if valuelength is greater than 255, a ToolkitException is thrown with reason code BAD_INPUT_PARAMETER.

6.2.5.18.2 Test suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_APTLB_BSS_1.scr

Test Applet: API_2_ERH_APTLB_BSS_1.java

Load Script: API_2_ERH_APTLB_BSS_1.ldr

Cleanup Script: API_2_ERH_APTLB_BSS_1.clr

Parameter File: API_2_ERH_APTLB_BSS_1.par

6.2.5.18.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Null value

NullPointerException is thrown

2

valueOffset ≥ value.length

value.length = 5

valueOffset = 5

valueLength = 1

ArrayIndexOutOfBoundsException is thrown

3

valueOffset < 0

value.length = 5

valueOffset = -1

valueLength = 1

ArrayIndexOutOfBoundsException is thrown

4

valueLength > value.length

value.length = 5

valueOffset = 0

valueLength = 6

ArrayIndexOutOfBoundsException is thrown

5

ValueOffset + valueLength > value.length

value.length = 5

valueOffset = 3

valueLength = 3

ArrayIndexOutOfBoundsException is thrown

6

valueLength < 0

value.length = 5

valueOffset = 0

valueLength = -1

ArrayIndexOutOfBoundsException is thrown

7

Handler overflow

value.length = 254

valueOffset = 0

valueLength = 254

ToolkitException.HANDLER_OVERFLOW is thrown

8

Bad parameter

value.length = 256

valueOffset = 0

valueLength = 256

ToolkitException.BAD_INPUT_PARAMETER is thrown

9

clear the handler, append the handler with TLVs:

81 03 11 22 33

82 02 99 77

Select Command Details TLV

Successful call

tag = 04

value = FF FE … F8

valueOffset = 0

valueLength = 8

Verify Current TLV: Call getValueLength()

Result is 03h

10

Clear the handler

Successful call

tag = 04

value = FF FE … F8

valueOffset = 0

valueLength = 8

Call copy() method

Compare handler

CompareBuffer = 04 08 FF FE … F8

Result is 00

11

Successful call

tag = 85h

value = 00 01 … 07

valueOffset = 2

valueLength = 6

Call copy() method

Compare handler

compareBuffer = 04 08 FF FE … F8 85 06 02 03 … 07

Result is 00

12

Successful call

tag = 01

value = 11 22 … 88

valueOffset = 2

valueLength = 4

Call copy() method

Compare handler

compareBuffer = 04 08 FF FE … F8 85 06 02 03 … 07 01 04 33 44 55 66

Result is 00

13

Clear the handler

Successful call

tag = 04

value = 00 01 … 7F

valueOffset = 0

valueLength = 80h

Call copy() method

Compare handler

compareBuffer = 04 81 80 00 01…7F

Result is 00

14

Call post() method then appendTLV()

tag = 04

value = 00 01 … 7F

valueOffset = 0

valueLength = 80h

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.18.4 Test Coverage

CRR number

Test case number

N1

10, 11, 12, 13

N2

9

P1

1

P2

2, 3, 4, 5, 6

C1

7

C2

14

C3

8

6.2.5.19 Method appendTLV(byte tag, byte value1, byte[ ] value2, short value2offset, short value2length)

Test Area Reference: API_2_ERH_APTLBB_BSS

6.2.5.19.1 Conformance requirement:

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

public void appendTLV(byte tag,

byte value1,

byte[] value2,

short value2Offset,

short value2Length)

throws java.lang.NullPointerException,

java.lang.ArrayIndexOutOfBoundsException,

ToolkitException

6.2.5.19.1.1 Normal execution

  • CRRN1: Appends a TLV element to the current TLV list (1 byte and a byte-array element).
  • CRRN2: A successful append does not modify the TLV selected.

6.2.5.19.1.2 Parameters error

  • CRRP1: if value2 is null, a java.lang.NullPointerException is thrown.
  • CRRP2: if value2offset or value2length or both would cause access outside the array bounds, or if length is negative, a java.lang.ArrayIndexOutOfBoundsException is thrown.

6.2.5.19.1.3 Context errors

  • CRRC1: if the EditHandler buffer is too small to append the requested data, a ToolkitException is thrown with reason code HANDLER_OVERFLOW.
  • CRRC2: if the EditHandler buffer is busy, a ToolkitException is thrown with reason code HANDLER_NOT_AVAILABLE.
  • CRRC3: if valuelength is greater than 255, a ToolkitException is thrown with reason code BAD_INPUT_PARAMETER.

6.2.5.19.2 Test suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_APTLBB_BSS_1.scr

Test Applet: API_2_ERH_APTLBB_BSS_1.java

Load Script: API_2_ERH_APTLBB_BSS_1.ldr

Cleanup Script: API_2_ERH_APTLBB_BSS_1.clr

Parameter File: API_2_ERH_APTLBB_BSS_1.par

6.2.5.19.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Null value2

NullPointerException is thrown

2

value2Offset ≥ value2.length

value2.length = 5

value2Offset = 5

value2Length = 1

ArrayIndexOutOfBoundsException is thrown

3

value2Offset < 0

value2.length = 5

value2Offset = -1

value2Length = 1

ArrayIndexOutOfBoundsException is thrown

4

value2Length > value2.length

value2.length = 5

value2Offset = 0

value2Length = 6

ArrayIndexOutOfBoundsException is thrown

5

value2Offset + value2Length > value2.length

value2.length = 5

value2Offset = 3

value2Length = 3

ArrayIndexOutOfBoundsException is thrown

6

value2Length < 0

value2.length = 5

value2Offset = 0

value2Length = -1

ArrayIndexOutOfBoundsException is thrown

7

Handler overflow

value2.length = 254

value2Offset = 0

value2Length = 254

ToolkitException.HANDLER_OVERFLOW is thrown

8

Bad parameter

value2.length = 256

value2Offset = 0

value2Length = 256

ToolkitException.BAD_INPUT_PARAMETER is thrown

9

clear the handler, append the handler with TLVs:

81 03 11 22 33

82 02 99 77

Select Command Details TLV

Successful call

tag = 04

value1 = 05

value2 = FF FE … F8

value2Offset = 0

value2Length = 8

Verify Current TLV: Call getValueLength()

Result is 03h

10

Clear the handler

Successful call

tag = 04

value1 = 05

value2 = FF FE … F8

value2Offset = 0

value2Length = 8

Call copy() method

Compare handler

CompareBuffer = 04 09 05 FF FE … F8

Result is 00

11

Successful call

tag = 85h

value1 = 55h

value2 = 00 01 … 07

value2Offset = 2

value2Length = 6

Call copy() method

Compare handler

compareBuffer =

04 09 05 FF FE … F8

85 07 55 02 03 … 07

Result is 00

12

Successful call

tag = 01

value1 = 44h

value2 = 11 22 … 88

value2Offset = 2

value2Length = 4

Call copy() method

Compare handler

CompareBuffer =

04 09 05 FF FE … F8

85 07 55 02 03 … 07

01 05 44 33 44 55 66

Result is 00

13

Clear the handler

Successful call

tag = 04

value1 = 00

value2 = 01 … 7F

value2Offset = 0

value2Length = 7Fh

Call copy() method

Compare handler

compareBuffer = 04 81 80 00 01…7F

Result is 00

14

Call post() method then appendTLV()

tag = 04

value1 = 00

value2 = 01 … 7F

value2Offset = 0

value2Length = 7Fh

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.19.4 Test Coverage

CRR number

Test case number

N1

10, 11, 12, 13

N2

9

P1

1

P2

2, 3, 4, 5, 6

C1

7

C2

Does not apply for EnvelopeResponseHandler

C3

8

6.2.5.20 Method clear

Test Area Reference: API_2_ERH_CLER

6.2.5.20.1 Conformance requirement:

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

public void clear()

throws ToolkitException

6.2.5.20.1.1 Normal execution

  • CRRN1: Clears the TLV list of an EditHandler and resets the current TLV selected.

6.2.5.20.1.2 Parameters error

No requirements

6.2.5.20.1.3 Context errors

  • CRRC1: if the EditHandler buffer is busy, a ToolkitException is thrown with reason code HANDLER_NOT_AVAILABLE.

6.2.5.20.2 Test suite files

Specific triggering: Unrecognized Envelope

Test Script: API_2_ERH_CLER_1.scr

Test Applet: API_2_ERH_CLER_1.java

Load Script: API_2_ERH_CLER_1.ldr

Cleanup Script: API_2_ERH_CLER_1.clr

Parameter File: API_2_ERH_CLER_1.par

6.2.5.20.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

append the handler with TLVs:

81 03 11 22 33

82 02 99 77

Select Command Details TLV

Call the getLength() method

Clear the handler

Call the getLength() method

Result of getLength() is not null

Result of getLength() is 0

2

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT shall be thrown

3

Call post() method then clear()

A toolkit Exception with HANDLER_NOT_AVAILABLE reason is thrown.

6.2.5.20.4 Test Coverage

CRR number

Test case number

N1

1, 2

C1

3

6.2.5.21 Method getCapacity

Test Area Reference: API_2_ERH_GCAP

6.2.5.21.1 Conformance Requirement:

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

Public byte getCapacity()

6.2.5.21.1.1 Normal execution

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

6.2.5.21.1.2 Context errors

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

6.2.5.21.2 Test suite files

Test Script: API_2_ERH_GCAP_1.scr

Test Applet: API_2_ERH_GCAP_1.java

Load Script: API_2_ERH_GCAP_1.ldr

Cleanup Script: API_2_ERH_GCAP_1.clr

Parameter File: API_2_ERH_GCAP_1.par

6.2.5.21.3 Test Procedure

Id

Description

API Expectation

APDU Expectation

1

EnvelopeResponseHandler available

1- Send envelope SMS-PP Formatted

2- The applet calls getTheHandler() method

3- The applet calls getCapacity() method on the EnvelopeResponseHandler

4- The applet fills the handler with the maximum capacity using AppendTLV() method

5- The applet calls clear() method on the EnvelopeResponseHandler

6- The applet fills the handler with the maximum capacity plus one, using AppendTLV() method

1- Applet is triggered

2- No exception is thrown

3- No exception is thrown

4- No exception is thrown

5- No exception is thrown

6- HANDLER_OVERFLOW exception is thrown

6.2.5.21.4 Test Coverage

CRR number

Test case number

N1

1

C1

Tested in Framework part: FWK_MHA_ERHD