6.2.4 Class EnvelopeHandler

11.133GPPRelease 1999Test specification for Subscriber Interface Module (SIM) Application Programme Interface (API) for Java cardTS

6.2.4.1 Method getEnvelopeTag

Test Area Reference: API_2_ENH_GENT.

6.2.4.1.1 Conformance Requirement

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

public byte getEnvelopeTag()

6.2.4.1.1.1 Normal execution

  • CRRN1: The method shall return the Envelope BER-TLV tag.
  • CRRN2: The Envelope BER TAG is available for all triggered toolkit applets from the invocation to the termination of their processToolkit method if the EnvelopeHandler is available.

6.2.4.1.1.2 Parameters error

No requirements.

6.2.4.1.1.3 Context errors

No requirements.

6.2.4.1.2 Test suite files

Test Script: API_2_ENH_GENT_1.scr

Test Applet: API_2_ENH_GENT_1.java

Load Script: API_2_ENH_GENT_1.ldr

Cleanup Script: API_2_ENH_GENT_1.clr

Parameter File: API_2_ENH_GENT_1.par

6.2.4.1.3 Test Procedure

Id

Description

API Expectation

APDU Expectation

1

getEnvelopeTag called just after triggering of the application.

Returns 0xD1

2

getEnvelopeTag called after a proactive command.

Returns 0xD1

3

getEnvelopeTag called after a second proactive command.

Returns 0xD1

6.2.4.1.4 Test Coverage

CRR number

Test case number

N1

1, 2, 3

N2

1, 2, 3

6.2.4.2 Method getItemIdentifier

Test Area Reference: API_2_ENH_GIID.

6.2.4.2.1 Conformance Requirement

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

public byte getItemIdentifier()

throws ToolkitException

6.2.4.2.1.1 Normal execution

  • CRRN1:The method shall return the item identifier byte value.
  • CRRN2:The item identifier byte value returned shall be from the first Item Identifier TLV element.
  • CRRN3: If the element is available it becomes the TLV selected.
  • CRRN4: The item identifier is available for all triggered toolkit applets from the invocation to the termination of their processToolkit method if the EnvelopeHandler is available.

6.2.4.2.1.2 Parameters error

No requirements.

6.2.4.2.1.3 Context errors

  • CRRC1: The method shall throw ToolkitException (UNAVAILABLE_ELEMENT) if the item identifier TLV is not present.
  • CRRC2: The method shall throw ToolkitException (OUT_OF_TLV_BOUNDARIES) if the item identifier byte is missing in the Item Identifier Simple TLV.

6.2.4.2.2 Test suite files

Test Script: API_2_ENH_GIID_1.scr

Test Applet: API_2_ENH_GIID_1.java

Load Script: API_2_ENH_GIID_1.ldr

Cleanup Script: API_2_ENH_GIID_1.clr

Parameter File: API_2_ENH_GIID_1.par

6.2.4.2.3 Test Procedure

Id

Description

API Expectation

APDU Expectation

1

Send envelope SMS-PP Formatted with item identifier TLV and identifier value of 03

Returns 03

2

Send envelope SMS-PP Formatted with two item identifier TLV with first value FF and second 44

Returns FF

3

Send envelope SMS-PP Formatted with two item identifier TLV with first value 81 and second 44, call twice the method getItemIdentifier

Returns 81

Returns 81

4

Send envelope SMS-PP Formatted with item identifier TLV and value of 66. FindTLV with TAG 02. getItemIdentifier and then getValueByte with offset 0

getItemIdentifier=getValueByte

5

Send envelope SMS-PP Formatted without item identifier TLV and getItemIdentifier

ToolkitException (UNAVAILABLE_ELEMENT)

6

Send Envelope SMS-PP Formatted with item identifier TLV (66), send proactive command. Then getItemIdentifier

Returns 66

7

Send Envelope SMS-PP Formatted with item identifier TLV but without item number

ToolkitException (OUT_OF_TLV_BOUNDARIES)

6.2.4.2.4 Test Coverage

CRR number

Test case number

N1

1, 2, 3

N2

2, 3

N3

4

N4

6

C1

5

C2

7

6.2.4.3 Method getSecuredDataLength

Test Area Reference: API_2_ENH_GSDL.

6.2.4.3.1 Conformance Requirement

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

public short getSecuredDataLength()

throws ToolkitException

6.2.4.3.1.1 Normal execution

  • CRRN1: The method shall return the length of the secured data contained in a SMS TPDU TLV.
  • CRRN2: The length is from the first SMS TPDU TLV.
  • CRRN3: The length should not include padding bytes.
  • CRRN4: The method can be used if the event is EVENT_FORMATTED_SMS_PP_ENV and if the SMS TP-UD is formatted according to GSM 03.48 [8].
  • CRRN5: The method can be used if the event is EVENT_FORMATTED_SMS_PP_UPD and if the SMS TP-UD is formatted according to GSM 03.48 [8].
  • CRRN6: The method can be used if the event is EVENT_FORMATTED_SMS_CB and if the Cell Broadcast Page is formatted according to GSM 03.48 [8].
  • CRRN7: If the method is successful and if the event is EVENT_FORMATTED_SMS_PP_ENV, the selected TLV should be the SMS TPDU TLV.
  • CRRN8: If the method is successful and if the event is EVENT_FORMATTED_SMS_CB, the selected TLV should be the Cell Broadcast Page TLV.

6.2.4.3.1.2 Parameters error

No requirements.

6.2.4.3.1.3 Context errors

  • CRRC1: The method shall thrown ToolkitException (UNAVAILABLE_ELEMENT) in case of unavailable SMS TPDU TLV element.
  • CRRC2: The method shall thrown ToolkitException (UNAVAILABLE_ELEMENT) in case of missing Secured Data.

6.2.4.3.2 Test suite files

Specific triggering:

– FORMATTED SMS CB.

– UNFORMATTED SMS CB.

– FORMATTED SMS PP UPD.

– UNFORMATED SMS PP ENV.

– For Formatted triggering if CC/RC/DS is used, the security parameters are the one used for downloading applications.

Test Script: API_2_ENH_GSDL_1.scr

Test Applet: API_2_ENH_GSDL_1.java

Load Script: API_2_ENH_GSDL_1.ldr

Cleanup Script: API_2_ENH_GSLD_1.clr

Parameter File: API_2_ENH_GSLD_1.par

6.2.4.3.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Test with FORMATTED_SMS_PP_ENV and TP-OA length of 2

Returns 0x2A

2

Test with TP-OA length of 6

Returns 0x2A

3

Test with TP-OA length of 12

Returns 0x2A

4

Test with RC/CC/DS length of 0

Returns 0x10

5

Test with RC/CC/DS length of 8

Returns 0x10

6

Test with PCNTR = 0

Returns 0x10

7

Test with PCNTR = 7

Returns 0x05

8

Test with SecuredDataLength = 00

Returns 0x00

9

Test with UserDataLength = 0x33

Returns 0x33

10

Test with UserDataLength = 0x 6C

Returns 0x 6C

11

Test with UserDataLength = 0x 6D

Returns 0x 6D

12

Test with UserDataLength = maximum length: 0x79

Returns 0x 79

13

Verify it is the first TPDU TLV:

Send a SMS PP with 2 TPDU TLV and inside two different secured data lengths: 5 and 10

Returns 0x05

14

Same test as 1 but with FORMATTED_SMS_PP_UPD

Returns 0x2A

15

Same test as 2 but with FORMATTED_SMS_PP_UPD

Returns 0x2A

16

Same test as 3 but with FORMATTED_SMS_PP_UPD

Returns 0x2A

17

Same test as 4 but with FORMATTED_SMS_PP_UPD

Returns 0x10

18

Same test as 5 but with FORMATTED_SMS_PP_UPD

Returns 0x10

19

Same test as 6 but with FORMATTED_SMS_PP_UPD

Returns 0x10

20

Same test as 7 but with FORMATTED_SMS_PP_UPD

Returns 0x05

21

Same test as 8 but with FORMATTED_SMS_PP_UPD

Returns 0x00

22

Same test as 9 but with FORMATTED_SMS_PP_UPD

Returns 0x33

23

Same test as 10 but with FORMATTED_SMS_PP_UPD

Returns 0x 6C

24

Same test as 11 but with FORMATTED_SMS_PP_UPD

Returns 0x 6D

25

Same test as 12 but with FORMATTED_SMS_PP_UPD

Returns 0x 79

26

Same test as 13 but with FORMATTED_SMS_PP_UPD

Returns 0x05

27

Same test as 4 but with FORMATTED_SMS_CB

Returns 0x10

28

Same test as 5 but with FORMATTED_SMS_CB

Returns 0x10

29

Same test as 6 but with FORMATTED_SMS_CB

Returns 0x10

30

Same test as 7 but with FORMATTED_SMS_CB

Returns 0x05

31

Same test as 8 but with FORMATTED_SMS_CB

Returns 0x00

32

Same test as 9 but with FORMATTED_SMS_CB

Returns 0x33

33

Same test as 12 but with maximum length: 0x42, and FORMATTED_SMS_CB

Returns 0x 42

34

Test with FORMATTED_SMS_PP_ENV

Verify after call of the method the current TLV is the TPDU TLV:

findTLV device identities, getSecuredDataLength and then getValueByte to verify that the current TLV is the TPDU TLV

getValueByte returns 0x40

35

Test with FORMATTED_SMS_CB

Verify after call of the method the current TLV is the Cell Broadcast Page TLV:

findTLV device identities, getSecuredDataLength and then getValueByte to verify that the current TLV is the Cell Broadcast Page TLV

getValueByte returns 0x58

36

Send an envelope SMS CB, getSecuredDataLength

ToolkitException UNAVAILABLE_ELEMENT

37

Send an envelope SMS PP unformatted

ToolkitException UNAVAILABLE_ELEMENT

6.2.4.3.4 Test Coverage

This method has only been tested with call control and the tests shall be improved during GSM 03.48 [8] tests.

CRR number

Test case number

N1

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13

N2

13

N3

6, 7

N4

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 25

N5

14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26

N6

27, 28, 29, 30, 31, 32, 33

N7

34

N8

35

C1

36

C2

37

6.2.4.4 Method getSecuredDataOffset

Test Area Reference: API_2_ENH_GSDO.

6.2.4.4.1 Conformance Requirement

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

public short getSecuredDataOffset()

throws ToolkitException

6.2.4.4.1.1 Normal execution

  • CRRN1: The method shall return the offset of the secured data first byte contained in a SMS TPDU TLV.
  • CRRN2: The offset is from the first SMS TPDU TLV.
  • CRRN3: The method can be used if the event is EVENT_FORMATTED_SMS_PP_ENV and if the SMS TP-UD is formatted according to GSM 03.48 [8].
  • CRRN4: The method can be used if the event is EVENT_FORMATTED_SMS_PP_UPD and if the SMS TP-UD is formatted according to GSM 03.48 [8].
  • CRRN5: The method can be used if the event is EVENT_FORMATTED_SMS_CB and if the Cell Broadcast Page is formatted according to GSM 03.48 [8].
  • CRRN6: If the method is successful and if the event is EVENT_FORMATTED_SMS_PP_ENV, the selected TLV should be the SMS TPDU TLV.
  • CRRN7: If the method is successful and if the event is EVENT_FORMATTED_SMS_CB, the selected TLV should be the Cell Broadcast Page TLV.

6.2.4.4.1.2 Parameters error

No requirements.

6.2.4.4.1.3 Context errors

  • CRRC1: The method shall thrown ToolkitException (UNAVAILABLE_ELEMENT) in case of unavailable SMS TPDU TLV element.
  • CRRC2: The method shall thrown ToolkitException (UNAVAILABLE_ELEMENT) in case of missing Secured Data.

6.2.4.4.2 Test suite files

Specific triggering:

– FORMATTED SMS CB.

– UNFORMATTED SMS CB.

– FORMATTED SMS PP UPD.

– UNFORMATED SMS PP ENV.

– For Formatted triggering if CC/RC/DS is used, the security parameters are the one used for downloading applications.

Test Script: API_2_ENH_GSDO_1.scr

Test Applet: API_2_ENH_GSDO_1.java

Load Script: API_2_ENH_GSDO_1.ldr

Cleanup Script: API_2_ENH_GSDO_1.clr

Parameter File: API_2_ENH_GSDO_1.par

6.2.4.4.3 Test Procedure

Id

Description

API Expectation

APDU Expectation

1

Test with TP-OA length of 2

Returns 0x21

2

Test with TP-OA length of 6

Returns 0x23

3

Test with TP-OA length of 12

Returns 0x26

4

Test with RC/CC/DS length of 0

Returns 0x21

5

Test with RC/CC/DS length of 8

Returns 0x29

6

Send a SMS PP with 2 TPDU TLV and inside two different secured data offsets

Returns 0x24 ( the first offset )

7

Same test as 1 but with FORMATTED_SMS_PP_UPD

Returns 0x21

8

Same test as 2 but with FORMATTED_SMS_PP_UPD

Returns 0x23

9

Same test as 3 but with FORMATTED_SMS_PP_UPD

Returns 0x26

10

Same test as 4 but with FORMATTED_SMS_PP_UPD

Returns 0x21

11

Same test as 5 but with FORMATTED_SMS_PP_UPD

Returns 0x29

12

Same test as 6 but with FORMATTED_SMS_PP_UPD

Returns 0x24 ( the first offset )

13

Test with FORMATTED_SMS_PP ENV

Verify after call of the method the current TLV is the TPDU TLV:

findTLV device identities, getSecuredDataOffset and then getValueByte to verify that the current TLV is the TPDU TLV

Returns 0x40

14

Same test as 4 but with FORMATTED_SMS_CB

Returns 0x16

15

Same test as 5 but with FORMATTED_SMS_CB

Returns 0x1E

16

Test with FORMATTED_SMS_CB

Verify after call of the method the current TLV is the Cell Broadcast Page TLV:

findTLV device identities, getSecuredDataOffset and then getValueByte to verify that the current TLV is the Cell Broadcast Page TLV

Returns 0x58

17

Send an UNFORMATTED SMS CB envelope, getSecuredDataOffset

ToolkitException UNAVAILABLE_ELEMENT

18

Send an UNFORMATTED SMS PP envelope

ToolkitException UNAVAILABLE_ELEMENT

19

Send an FORMATTED SMS-PP envelope with no secured data, getSecuredDataOffset

Returns 0x21

6.2.4.4.4 Test Coverage

This method has only been tested with call control and the tests shall be improved during GSM 03.48 [8] tests.

CRR number

Test case number

N1

1, 2, 3, 4, 5, 6, 19

N2

6, 12

N3

1, 2, 3, 4, 5, 6, 19

N4

7, 8, 9, 10, 11

N5

14,15

N6

13

N7

16

C1

17

C2

18

6.2.4.5 Method getTheHandler

Test Area Reference: API_2_ENH_GTHD.

6.2.4.5.1 Conformance Requirements

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

public static EnvelopeHandler getTheHandler()

throws ToolkitException

6.2.4.5.1.1 Normal execution

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

6.2.4.5.1.2 Parameters error

No requirements.

6.2.4.5.1.3 Context errors

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

6.2.4.5.2 Test suite files

Test Script: API_2_ENH_GTHD_1.scr

Test Applet: API_2_ENH_GTHD_1.java

Load Script: API_2_ENH_GTHD_1.ldr

Cleanup Script: API_2_ENH_GTHD_1.clr

Parameter File: API_2_ENH_GTHD_1.par

6.2.4.5.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 EnvelopeHandler (checkcast)

3

Verify the returned value is not null

GetTheHandler

The reference returned shall not be null.

6.2.4.5.4 Test Coverage

CRR number

Test case number

N1

1, 2, 3

N2

To be checked in Framework tests and insert here cross reference

C1

To be checked in Framework tests and insert here cross reference

6.2.4.6 Method getTPUDLOffset

Test Area Reference: API_2_ENH_GTPO.

6.2.4.6.1 Conformance Requirement:

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

public short getTPUDLOffset()

throws ToolkitException

6.2.4.6.1.1 Normal execution

  • CRRN1: The method shall return the TPUDL offset in a SMS TPDU TLV.
  • CRRN2: The offset is from the first SMS TPDU TLV.
  • CRRN3: The method can be used if the event is EVENT_FORMATTED_SMS_PP_ENV.
  • CRRN4: The method can be used if the event is EVENT_FORMATTED_SMS_PP_UPD.
  • CRRN5: The method can be used if the event is EVENT_UNFORMATTED_SMS_PP_ENV.
  • CRRN6: The method can be used if the event is EVENT_UNFORMATTED_SMS_PP_UPD.
  • CRRN7: If the method is successful, the selected TLV should be the SMS TPDU TLV.

6.2.4.6.1.2 Parameters error

No requirements.

6.2.4.6.1.3 Context errors

  • CRRC1: The method shall thrown ToolkitException (UNAVAILABLE_ELEMENT) in case of unavailable SMS TPDU TLV element.
  • CRRC2: The method shall thrown ToolkitException (UNAVAILABLE_ELEMENT) if the TPUDL field does not exist.

6.2.4.6.2 Test suite files

Specific triggering:

FORMATTED SMS PP UPD

UNFORMATTED SMS PP UPD

UNFORMATTED SMS PP ENV

SMS CB

Test Script: API_2_ENH_GTPO_1.scr

Test Applet: API_2_ENH_GTPO_1.java

Load Script: API_2_ENH_GTPO_1.ldr

Cleanup Script: API_2_ENH_GTPO_1.clr

Parameter File: API_2_ENH_GTPO_1.par

6.2.4.6.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Test with TP-OA length of 2

Returns 0x0D

2

Test with TP-OA length of 6

Returns 0x0F

3

Test with TP-OA length of 12

Returns 0x12

4

Send a SMS PP with 2 TPDU TLV and inside two different UDL offsets

Returns 0x10 (the first offset)

5

Same test as 1 but with FORMATTED_SMS_PP_UPD

Returns 0x0D

6

Same test as 2 but with FORMATTED_SMS_PP_UPD

Returns 0x0F

7

Same test as 3 but with FORMATTED_SMS_PP_UPD

Returns 0x12

8

Same test as 4 but with FORMATTED_SMS_PP_UPD

Returns 0x10 (the first offset)

9

Same test as 1 but with UNFORMATTED_SMS_PP_UPD

Returns 0x0D

10

Same test as 2 but with UNFORMATTED_SMS_PP_UPD

Returns 0x0F

11

Same test as 3 but with UNFORMATTED_SMS_PP_UPD

Returns 0x12

12

Same test as 4 but with UNFORMATTED_SMS_PP_UPD

Returns 0x12 (the first offset)

13

Same test as 1 but with UNFORMATTED_SMS_PP_ENV

Returns 0x0D

14

Same test as 2 but with UNFORMATTED_SMS_PP_ENV

Returns 0x0F

15

Same test as 3 but with UNFORMATTED_SMS_PP_ENV

Returns 0x12

16

Same test as 4 but with UNFORMATTED_SMS_PP_ENV

Returns 0x10 (the first offset)

17

Verify after call of the method the current TLV is the TPDU TLV:

findTLV device identities, getTPUDLOffset and then getValueByte to verify that the current TLV is the TPDU TLV

Returns 0x40

18

Send an envelope SMS CB, getTPUDLOffset

ToolkitException UNAVAILABLE_ELEMENT

6.2.4.6.4 Test Coverage

CRR number

Test case number

N1

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17

N2

4

N3

1, 2, 3, 4, 17

N4

5, 6, 7, 8

N5

13, 14, 15, 16

N6

9, 10, 11, 12

N7

17

C1

18

C2

Don’t no how to test

6.2.4.7 Method getLength

Test Area Reference: API_2_ENH_GLEN.

6.2.4.7.1 Conformance Requirement

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

public short getLength()

throws ToolkitException

6.2.4.7.1.1 Normal execution

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

6.2.4.7.1.2 Parameter Error

No requirements.

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

6.2.4.7.2 Test Suite files

Specific triggering: None

Test Script: API_2_ENH_GLEN_1.scr

Test Applet: API_2_ENH_GLEN_1.java

Load Script: API_2_ENH_GLEN_1.ldr

Cleanup Script: API_2_ENH_GLEN_1.clr

Parameter File: API_2_ENH_GLEN_1.par

6.2.4.7.3 Test Procedure

Id

Description

API Expectation

APDU Expectation

1

Send an envelope SMS PP with BER length of 0x31

Result of getLength() is 0x0031

2

Send an envelope SMS PP with BER length of 0x7F

Result of getLength() is 0x007Fh

3

Send an envelope SMS PP with BER length of 81 80

Result of getLength() is 0x0080h

4

Send an envelope SMS PP with BER length of 81 FC

Result of getLength() is 0x00FCh

6.2.4.7.4 Test Coverage

CRR number

Test case number

N1

1, 2, 3, 4

C1

Does not apply for EnvelopeHandler

6.2.4.8 Method copy

Test Area Reference: API_2_ENH_COPY_BSS.

6.2.4.8.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.4.8.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.4.8.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.4.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.

6.2.4.8.2 Test Suite files

Specific triggering: None

Test Script: API_2_ENH_COPY_BSS_1.scr

Test Applet: API_2_ENH_COPY_BSS_1.java

Load Script: API_2_ENH_COPY_BSS_1.ldr

Cleanup Script: API_2_ENH_COPY_BSS_1.clr

Parameter File: API_2_ENH_COPY_BSS_1.par

6.2.4.8.3 Test Procedure

Id

Description

API Expectation

APDU Expectation

1

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

DstOffset = 0

DstLength = 48

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

8

Successful call, dstBuffer is the whole buffer

DstBuffer.length = 47

DstOffset = 0

DstLength = 47

Result of copy() is 0X0047

9

Compare the buffer

Result of arrayCompare() is 0

10

Successful call, dstBuffer is part of a buffer

DstBuffer.length = 50

dstOffset = 3

dstLength = 47

Result of copy() is 0X0032

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

13

Compare the whole buffer

Result of arrayCompare() is 0

14

Successful call, dstBuffer is part of a buffer

dstBuffer.length = 260

dstOffset = 257

dstLength = 3

Result of copy() is 0X0104

15

Compare the whole buffer

Result of arrayCompare() is 0

16

Successful call, copy with length =0

dstBuffer.length = 260

dstOffset = 260

dstLength = 0

Result of copy() is 0x104

6.2.4.8.4 Test Coverage

CRR number

Test case number

N1

9, 11, 13, 15

N2

8, 10, 12, 14, 16

P1

1

P2

2, 3, 4, 5, 6

P3

7

C1

Does not apply for EnvelopeHandler

6.2.4.9 Method findTLV

Test Area Reference: API_2_ENH_FINDBB.

6.2.4.9.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.4.9.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.4.9.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.4.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.4.9.2 Test Suite files

Specific triggering: None

Test Script: API_2_ENH_ENH_FINDBB_1.scr

Test Applet: API_2_ENH_ENH_FINDBB_1.java

Load Script: API_2_ENH_ENH_FINDBB_1.ldr

Cleanup Script: API_2_ENH_FINDBB_1.clr

Parameter File: API_2_ENH_FINDBB_1.par

6.2.4.9.3 Test Procedure

Id

Description

API Expectation

APDU Expectation

Trig the applet with SMS PP including one more tag 02 and one TAG 04

1

Invalid input parameter

Occurrence = 0

ToolkitException.BAD_INPUT_PARAMETER is thrown

2

Search 1st TLV

Tag = 02h

Occurrence = 1

Result is TLV_FOUND_CR_SET

3

Call the getValueLength() method

Result is 0x02

4

Search 2nd TLV

Tag = 06h

Occurrence = 1

Result is TLV_FOUND_CR_SET

5

Call the getValueLength() method

Result is 0x05h

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

Occurrence = 3

Result is TLV_NOT_FOUND

9

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

10

Search the TLV

Tag = 02h

Occurrence = 2

Result is TLV_FOUND_CR_NOT_SET

11

Search the TLV

Tag = 04h

Occurrence = 1

Result is TLV_FOUND_CR_NOT_SET

12

Search tag 81h

Tag = 86h

Occurrence = 1

Result is TLV_FOUND_CR_SET

13

Search tag 84h

Tag = 84h

Occurrence = 1

Result is TLV_FOUND_CR_NOT_SET

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

Does not apply for EnvelopeHandler

6.2.4.10 Method getValueLength

Test Area Reference: API_2_ENH_GVLE.

6.2.4.10.1 Conformance Requirement

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

public short getValueLength()

throws ToolkitException

6.2.4.10.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.4.10.1.2 Parameter errors

No requirements.

6.2.4.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.4.10.2 Test Suite files

Specific triggering: None

Test Script: API_2_ENH_GVLE_1.scr

Test Applet: API_2_ENH_GVLE_1.java

Load Script: API_2_ENH_GVLE_1.ldr

Cleanup Script: API_2_ENH_GVLE_1.clr

Parameter File: API_2_ENH_GVLE_1.par

6.2.4.10.3 Test Procedure

Id

Description

API Expectation

APDU Expectation

Fill the SMS PP with TLV: Tag 33, Length C8

1

getValueLength()

ToolkitException.UNAVAILABLE_ELEMENT is thrown

2

Search TLV 02h

getValueLength()

Result is 0X0002

3

Search TLV 0Bh

getValueLength()

Result is 0X0024

4

Search TLV 33h

getValueLength()

Result is 0X00C8

6.2.4.10.4 Test Coverage

CRR number

Test case number

N1

2, 3, 4

C1

Does not apply for EnvelopeHandler

C2

1

6.2.4.11 Method getValueByte

Test Area Reference: API_2_ENH_GVBYS.

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

6.2.4.11.2 Test Suite files

Specific triggering: None

Test Script: API_2_ENH_GVBYS_1.scr

Test Applet: API_2_ENH_GVBYS_1.java

Load Script: API_2_ENH_GVBYS_l.dr

Cleanup Script: API_2_ENH_GVBYS_1.clr

Parameter File: API_2_ENH_GVBYS_1.par

6.2.4.11.3 Test Procedure

Id

Description

API Expectation

APDU Expectation

Fill the SMS PP with TLV: Tag 33, Length C8 Value 01 02 …

1

getValueByte(0)

ToolkitException.UNAVAILABLE_ELEMENT is thrown

2

Search TLV 02h

getValueByte(2)

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

3

Search TLV 02h

getValueByte(1)

Result is 0x81

4

Search TLV 02h (Device Identities TLV)

getValueByte(0)

Result is 83h (Source)

5

Search TLV 33h

getValueByte(7E)

Result is 0x7F

6

Search TLV 33h

getValueByte(80)

Result is 0x81

7

getValueByte(7F)

Result is 0x80

8

Search TLV B3h

getValueByte(C7)

Result is 0xC8

6.2.4.11.4 Test Coverage

CRR number

Test case number

N1

3, 4, 5, 6, 7, 8

P1

2

C1

Does not apply for EnvelopeHandler

C2

1

6.2.4.12 Method copyValue

Test Area Reference: API_2_ENH_CPYVS_BSS.

6.2.4.12.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.4.12.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.4.12.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.4.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.4.12.2 Test Suite files

Specific triggering: None

Test Script: API_2_ENH_CPYVS_BSS_1.scr

Test Applet: API_2_ENH_CPYVS_BSS_1.java

Load Script: API_2_ENH_CPYVS_BSS_1.ldr

Cleanup Script: API_2_ENH_CPYVS_BSS_1.clr

Parameter File: API_2_ENH_CPYVS_BSS_1.par

6.2.4.12.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Search TLV 02h

copyValue() with a null dstBuffer

NullPointerException is thrown

2

Search TLV 0Bh

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

Search TLV 06h

valueOffset  TLV 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 > TLV length

valueOffset = 0

dstBuffer.length = 15

dstOffset = 0

dstLength = 7

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

10

valueOffset + dstLength > TLV length

valueOffset = 2

dstBuffer.length = 15

dstOffset = 0

dstLength = 5

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

11

Search TLV 01h

copyValue()

ToolkitException.UNAVAILABLE_ELEMENT is thrown on the copyValue() method

12

Search TLV 06h

Successful call

valueOffset = 0

dstBuffer.length = 6

dstOffset = 0

dstLength = 6

Result of copyValue() is 0x0006

13

Compare buffer

buffer = 81 11 22 33 44 F5

Result is 00h

14

initialize dstBuffer

dstBuffer = 55 55 … 55

Successful call

valueOffset = 1

dstBuffer.length = 20

dstOffset = 3

dstLength = 4

Result of copyValue() is 0x0007

15

Compare buffer

buffer =

55 55 55 11 22

33 44 55 55 55

55 55 55 55 55

55 55 55 55 55

Result is 00h

16

Successful call, copy with length =0

dstBuffer.length = 20

dstOffset = 20

dstLength = 0

Result of copyValue() is 20

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

Does not apply for EnvelopeHandler

C2

11

6.2.4.13 Method compareValue

Test Area Reference: API_2_ENH_CPRVS_BSS.

6.2.4.13.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.4.13.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.4.13.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.4.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.4.13.2 Test Suite files

Specific triggering: None

Test Script: API_2_ENH_CPRVS_BSS_1.scr

Test Applet: API_2_ENH_CPRVS_BSS_1.java

Load Script: API_2_ENH_CPRVS_BSS_1.ldr

Cleanup Script: API_2_ENH_CPRVS_BSS_1.clr

Parameter File: API_2_ENH_CPRVS_BSS_1.par

6.2.4.13.3 Test procedure

Id

Description

API Expectation

APDU Expectation

1

Search TLV 02h

compareValue() with a null compareBuffer

NullPointerException is thrown

2

Search TLV 0Bh

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

Search TLV 06h

valueOffset  TLV 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 > TLV length

valueOffset = 0

compareBuffer.length = 15

compareOffset = 0

compareLength = 7

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

10

valueOffset + compareLength > TLV length

valueOffset = 2

compareBuffer.length = 15

compareOffset = 0

compareLength = 5

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

11

Search TLV 01h

Result is TLV_NOT_FOUND

compareValue()

ToolkitException.UNAVAILABLE_ELEMENT is thrown

12

Search TLV 06h

Initialize compareBuffer

compareBuffer =

81 11 22 33 44 F5

Compare buffers

valueOffset = 0

compareOffset = 0

compareLength = 6

Result is 00h

13

Initialize compareBuffer

compareBuffer =

7F 11 22 33 44 F5

Compare buffers with same parameters

Result is -1

14

Initialize compareBuffer

compareBuffer =

83 11 22 33 44 F5

Compare buffers with same parameters

Result is -1

15

Initialize compareBuffer

compareBuffer =

55 55 55 81 11 22 33 44 F5

55 55 55 55 55

Compare buffers

valueOffset = 1

compareOffset = 4

compareLength = 5

Result is 00h

16

Initialize compareBuffer

compareBuffer =

55 55 55 81 10 22 33 44 F5

55 55 55 55 55

Compare buffers with same parameters

Result is +1

17

Initialize compareBuffer

compareBuffer =

55 55 55 81 12 22 33 44 F5

55 55 55 55 55

Compare buffers with same parameters

Result is -1

18

Successful call, compareValue with length =0

CompareBuffer.length = 15

CompareOffset = 15

CompareLength = 0

Result of compareValue() is 0

6.2.4.13.4 Test Coverage

CRR number

Test case number

N1

12, 15

N2

13, 16, 18

N3

14, 17

P1

1

P2

2, 3, 4, 5, 6

P3

7, 8, 9, 10

C1

Does not apply for EnvelopeHandler

C2

11

6.2.4.14 Method findAndCopyValue(byte tag, byte[] dstBuffer, short dstOffset)

Test Area Reference: API_2_ENH_FACYB_BS.

6.2.4.14.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.4.14.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.4.14.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.4.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.4.14.2 Test Suite files

Specific triggering: None

Test Script: API_2_ENH_FACYB_BS_1.scr

Test Applet: API_2_ENH_FACYB_BS_1.java

Load Script: API_2_ENH_FACYB_BS_1.ldr

Cleanup Script: API_2_ENH_FACYB_BS_1.clr

Parameter File: API_2_ENH_FACYB_BS_1.par

6.2.4.14.3 Test procedure

Id

Description

API Expectation

APDU Expectation

Fill the SMS PP with TLV: Tag 02 Value 22 44 Tag 33, Length C4 Value 01 02 …

1

FindAndCopyValue() with a null dstBuffer

NullPointerException is thrown

2

dstOffset  dstBuffer.length

tag = 06h

dstBuffer.length = 06

dstOffset = 06

ArrayIndexOutOfBoundsException is thrown

3

dstOffset < 0

dstBuffer.length = 06

dstOffset = -1

ArrayIndexOutOfBoundsException is thrown

4

length > dstBuffer.length

dstBuffer.length = 05

dstOffset = 0

ArrayIndexOutOfBoundsException is thrown

5

DstOffset + length >dstBuffer.length

DstBuffer.length = 06

DstOffset = 1

ArrayIndexOutOfBoundsException is thrown

6

Select a TLV (tag 02h)

findAndCopyValue()

tag = 03h

ToolkitException.UNAVAILABLE_ELEMENT is thrown

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

7

Successful call

Tag = 06h

DstBuffer.length = 06

DstOffset = 0

Result of findAndCopyValue () is 0006

8

Compare buffer

buffer = 81 11 22 33 44 F5

Result is 00h

9

initialize dstBuffer

dstBuffer = 55 55 … 55

Successful call

dstBuffer.length = 12

dstOffset = 2

Result of findAndCopyValue () is 0008

10

Compare buffer

buffer =

55 55 81 11 22 33 44 F5 55 55 55 55

Result is 00h

11

Successful call

tag = 02h

dstBuffer.length = 2

dstOffset = 0

Result of findAndCopyValue () is 0002

12

Compare buffer

buffer = 83 81

Result is 00h

13

Successful call (with tag 82h)

tag = 82h

dstBuffer.length = 02

dstOffset = 0

Result of findAndCopyValue () is 0002

14

Compare buffer

buffer = 83 81

Result is 00h

15

Successful call (with tag B3h)

tag = B3h

dstBuffer.length = C4

dstOffset = 0

Result of findAndCopyValue () is 00C4

16

Compare buffer

buffer = 01 02 … C4

Result is 00h

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

Does not apply for EnvelopeHandler

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

Test Area Reference: API_2_ENH_FACYBS_BSS.

6.2.4.15.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.4.15.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.4.15.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.4.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.

6.2.4.15.2 Test Suite files

Test Script: API_2_ENH_FACYBS_BSS_1.scr

Test Applet: API_2_ENH_FACYBS_BSS_1.java

Load Script: API_2_ENH_FACYBS_BSS_1.ldr

Cleanup Script: API_2_ENH_FACYBS_BSS_1.clr

Parameter File: API_2_ENH_FACYBS_BSS_1.par

6.2.4.15.3 Test procedure

Id

Description

API Expectation

APDU Expectation

Fill the SMS PP with TLV: Tag 02 Value 22 44 Tag 33, Length C4 Value 01 02 …

1

findAndCopyValue() with a null dstBuffer

NullPointerException is thrown

2

dstOffset  dstBuffer.length

tag = 06h, 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

valueOffset  Value Length

tag = 06h, 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 > Value 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

Select a TLV (tag 02h)

findAndCopyValue()

tag = 06h

occurrence = 2

ToolkitException.UNAVAILABLE_ELEMENT is thrown

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

12

Successful call

tag = 06h, occurrence = 1

valueOffset = 0

dstBuffer.length = 06

dstOffset = 0

dstLength = 06

Result of findAndCopyValue() is 6

13

Compare buffer

buffer = 81 11 22 33 44 F5

Result is 00h

14

initialize dstBuffer

dstBuffer = 55 55 … 55

Successful call

tag = 06h, occurrence = 1

valueOffset = 2

dstBuffer.length = 12

dstOffset = 3

dstLength = 04

Result of findAndCopyValue () is 0007

15

Compare buffer

buffer =

55 55 55 22 33 44 F5 55 55 55 55 55

Result is 00h

16

Successful call

tag = 02h, occurrence = 1

valueOffset = 0

dstBuffer.length = 12

dstOffset = 0

dstLength = 2

Result of findAndCopyValue() is 0002

17

Compare buffer

buffer = 83 81 55 … 55

Result is 00h

18

Successful call

tag = 02h, occurrence = 2

valueOffset = 0

dstBuffer.length = 12

dstOffset = 0

dstLength = 2

Result of findAndCopyValue() is 0002

19

Compare buffer

buffer = 22 44 55 … 55

Result is 00h

20

Successful call (with tag 82h)

tag = 82h

occurrence = 1

valueOffset = 0

dstBuffer.length = 12

dstOffset = 0

dstLength = 02

Result of findAndCopyValue () is 0002

21

Compare buffer

buffer = 83 81 55 … 55

Result is 00h

22

Successful call (with tag 82h)

tag = 82h

occurrence = 2

valueOffset = 0

dstBuffer.length = 12

dstOffset = 0

dstLength = 02

Result of findAndCopyValue () is 0002

23

Compare buffer

Buffer = 22 44 55 … 55

Result is 00h

24

Successful call, findAndCopyValue with length =0

DstBuffer.length = 12

dstOffset = 12

dstLength = 0

Result of findAndCopyValue () is 12

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

Does not apply for EnvelopeHandler

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

Test Area Reference: API_2_ENH_FACRB_BS.

6.2.4.16.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.4.16.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.4.16.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.4.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.4.16.2 Test Suite files

Test Script: API_2_ENH_FACRB_BS_1.scr

Test Applet: API_2_ENH_FACRB_BS_1.java

Load Script: API_2_ENH_FACRB_BS_1.ldr

Cleanup Script: API_2_ENH_FACRB_BS_1.clr

Parameter File: API_2_ENH_FACRB_BS_1.par

6.2.4.16.3 Test procedure

Id

Description

API Expectation

APDU Expectation

Fill the SMS PP with TLV: Tag 02 Value 22 44 Tag 33, Length C4 Value 01 02 …

1

findAndCompareValue() with a null dstBuffer

NullPointerException is thrown

2

compareOffset  compareBuffer.length

tag = 06h

compareBuffer.length = 12

compareOffset = 12

ArrayIndexOutOfBoundsException is thrown

3

compareOffset < 0

compareBuffer.length = 12

compareOffset = -1

ArrayIndexOutOfBoundsException is thrown

4

length > compareBuffer.length

compareBuffer.length = 05

compareOffset = 0

ArrayIndexOutOfBoundsException is thrown

5

compareOffset + length > compareBuffer.length

compareBuffer.length = 12

compareOffset = 7

ArrayIndexOutOfBoundsException is thrown

6

Select a TLV (tag 02h)

findAndCompareValue()

tag = 03h

ToolkitException.UNAVAILABLE_ELEMENT is thrown

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

7

Initialize compareBuffer

compareBuffer = 81 11 22 33 44 F5

Compare buffers

tag = 06h

compareOffset = 0

Result is 00h

8

Verify current TLV

getValueLength()

Result is 06

9

Initialize compareBuffer

compareBuffer = 81 11 22 33 44 F4

Compare buffers with same parameters

Result is +1

10

Initialize compareBuffer

compareBuffer = 81 11 22 33 44 F6

Compare buffers with same parameters

Result is -1

11

Initialize compareBuffer

compareBuffer =

55 55 81 11 22 33 44 F5 55 55 55 55

Compare buffers

compareOffset = 2

Result is 00h

12

Initialize compareBuffer

compareBuffer =

55 55 83 81 55 55 55 55 55 55 55 55

Compare buffers

compareOffset = 2

Result is 00h

13

Initialize compareBuffer

compareBuffer =

55 55 83 80 55 55 55 55 55 55 55 55

Compare buffers

compareOffset = 2

Result is +1

14

Initialize compareBuffer

compareBuffer =

55 55 83 82 55 55 55 55 55 55 55 55

Compare buffers

compareOffset = 2

Result is –1

15

Initialize compareBuffer

compareBuffer =

83 81 55 55 55 55 55 55 55 55 55 55

Successful call (with tag 02h)

tag = 02h

compareBuffer.length = 12

compareOffset = 0

Result is 00h

16

Initialize compareBuffer

CompareBuffer = 01 02 … C4

Successful call (with tag B3h)

Tag = B3h

CompareBuffer.length = C4

CompareOffset = 0

Result is 00h

6.2.4.16.4 Test Coverage

CRR number

Test case number

N1

6

N2

8

N3

7, 11, 12

N4

9, 13

N5

10, 14

N6

15, 16

P1

1

P2

2, 3, 4, 5

C1

Does not apply for EnvelopeHandler

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

Test Area Reference: API_2_ENH_FACRBBS_BSS.

6.2.4.17.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.4.17.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.4.17.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.4.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.4.17.2 Test Suite files

Test Script: API_2_ENH_FACRBBS_BSS_1.scr

Test Applet: API_2_ENH_FACRBBS_BSS_1.java

Load Script: API_2_ENH_FACRBBS_BSS_1.ldr

Cleanup Script: API_2_ENH_FACRBBS_BSS_1.clr

Parameter File: API_2_ENH_FACRBBS_BSS_1.par

6.2.4.17.3 Test procedure

Id

Description

API Expectation

APDU Expectation

Fill the SMS PP with TLV: Tag 02 Value 22 44 Tag 33, Length C4 Value 01 02 …

1

findAndCompareValue() with a null compareBuffer

NullPointerException is thrown

2

compareOffset  compareBuffer.length

tag = 06h, occurrence = 1

valueOffset = 0

compareBuffer.length = 6

compareOffset = 6

compareLength = 1

ArrayIndexOutOfBoundsException is thrown

3

compareOffset < 0

compareBuffer.length = 6

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  Value Length

tag = 06h, 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 > Value length

valueOffset = 0

compareBuffer.length = 15

compareOffset = 0

compareLength = 7

ToolkitException.OUT_OF_TLV_BOUNDARIES is thrown

10

valueOffset + compareLength > Value 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

Select a TLV (tag 02h)

findAndCompareValue()

tag = 06h

occurrence = 2

ToolkitException.UNAVAILABLE_ELEMENT is thrown

Call the getValueLength() method

ToolkitException.UNAVAILABLE_ELEMENT is thrown.

13

Initialize compareBuffer

compareBuffer = 81 11 22 33 44 F5

findAndCompareValue()

tag = 06h, occurrence = 1

valueOffset = 0

compareOffset = 0

compareLength = 6

Result is 00h

14

Verify current TLV

getValueLength()

Result is 0006

15

Initialize compareBuffer

compareBuffer = 81 11 22 33 44 F4

Compare buffers with same parameters

Result is +1

16

Initialize compareBuffer

compareBuffer = 81 11 22 33 44 F6

Compare buffers with same parameters

Result is -1

17

Initialize compareBuffer

compareBuffer =

55 55 55 22 33 44 F5 55 55 55 55

Compare buffers

valueOffset = 2

compareOffset = 3

compareLength = 4

Result is 00h

18

Initialize compareBuffer

compareBuffer =

55 55 55 22 33 45 F5 55 55 55 55

Compare buffers with same parameters

Result is -1

19

Initialize compareBuffer

compareBuffer =

55 55 55 22 33 43 F5 55 55 55 55

Compare buffers with same parameters

Result is +1

20

Initialize compareBuffer

compareBuffer =

83 81 55 55 55 55 55 55 55 55 55 55

findAndCompareValue()

tag = 02h, occurrence = 1

valueOffset = 0

compareOffset = 0

compareLength = 2

Result is 00h

21

Initialize compareBuffer

compareBuffer =

22 44 55 55 55 55 55 55 55 55 55 55

findAndCompareValue()

tag = 02h, occurrence = 2

valueOffset = 0

compareOffset = 0

compareLength = 2

Result is 00h

22

Initialize compareBuffer

compareBuffer =

22 45 55 55 55 55 55 55 55 55 55 55

findAndCompareValue()

tag = 02h, occurrence = 2

valueOffset = 0

compareOffset = 0

compareLength = 2

Result is -1

23

Initialize compareBuffer

compareBuffer =

83 81 55 55 55 55 55 55 55 55 55 55

Successful call (with tag 02h)

tag = 02h, occurrence = 1

valueOffset = 0

compareBuffer.length = 12

compareOffset = 0

compareLength = 2

Result is 00h

24

Initialize compareBuffer

compareBuffer = 01 02 … C4

Successful call (with tag B3h)

tag = B3h, occurrence = 1

valueOffset = 0

compareBuffer.length = 00C4

compareOffset = 0

compareLength = 00C4

Result is 00h

25

Successful call, findAndCompareValue with length =0

DstBuffer.length = C4

DstOffset = C4

DstLength = 0

Result of findAndCompareValue() is 00h

6.2.4.17.4 Test Coverage

CRR number

Test case number

N1

12

N2

14

N3

13, 17, 20, 21, 25

N4

19, 15

N5

16, 18, 22

N6

23, 24

P1

1

P2

2, 3, 4, 5, 6

P3

7, 8, 9, 10

P4

11

C1

Does not apply for EnvelopeHandler