test_LibItsSecurity_TypesAndValues.ttcn3 61.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000
module test_LibItsSecurity_TypesAndValues {
    
    // LibCommon
    import from LibItsCommon_Functions {function f_getCurrentTime;}
    import from LibCommon_DataStrings all;
    
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues all;
    import from LibItsSecurity_Templates {template all;}
    import from LibItsSecurity_Functions all;
    import from LibItsSecurity_Pixits all;
    
    // TestUnits
    import from test_CommonCodec all;
    
    group LibItsSecurity_testCases {
        
        group securityAcPrimitives {
            
            /**
             * @desc Validate Security AcPrimitive
             */
            testcase tc_acEnableSecurity() runs on TCType system TCType {
                
                var ToBeSignedSecuredMessage v_toBeSignedSecuredMessageDigest, v_toBeSignedSecuredMessageCertificate;
                
                f_loadCertificates("cfg01");
                vc_location := {
                    22345,
                    54321,
                    '0000'O
                };
                
                v_toBeSignedSecuredMessageDigest := f_buildSecuredMessagePayloadToBeSigned();
                v_toBeSignedSecuredMessageCertificate := f_buildSecuredMessagePayloadToBeSigned(true);
                
                test_PDU<AcEnableSecurity>(
                    m_enableSecurity( 
                        "TA_CERT_A"
                    ),
                    true,
                    oct2bit('54415F434552545F41'O)
                );
            }
            
        } // End of group securityAcPrimitives 
        
        group basicFormatElements {
            
            /**
             * @desc Validate PublicKey/EccPoint
             * @verdict Pass on success, Fail otherwise
             */
            testcase tc_PublicKey_eccPoint_01() runs on TCType system TCType {
                test_PDU<PublicKey>(
                    m_publicKey_eccPoint(
                        m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only(
                            'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
                        )
                    )
                );
            } // End of testcase tc_PublicKey_eccPoint_01
            
            /**
             * @desc Validate PublicKey/EccPoint
             * @verdict Pass on success, Fail otherwise
             */
            testcase tc_PublicKey_eccPoint_02() runs on TCType system TCType {
                test_PDU<PublicKey>(
                    m_publicKey_eccPoint(
                        m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                            'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
                            '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
                        )
                    )
                );
            } // End of testcase tc_PublicKey_eccPoint_02
            
            /**
             * @desc Validate PublicKey/EccPoint
             * @verdict Pass on success, Fail otherwise
             */
            testcase tc_PublicKey_aesccm_01() runs on TCType system TCType {
                test_PDU<PublicKey>(
                    m_publicKey_aesccm(
                        m_aesccm(
                            m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only(
                                'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
                            )
                        )
                    )
                );
            } // End of testcase tc_PublicKey_aesccm_01
            
            /**
             * @desc Validate PublicKey/EccPoint
             * @verdict Pass on success, Fail otherwise
             */
            testcase tc_PublicKey_aesccm_02() runs on TCType system TCType {
                test_PDU<PublicKey>(
                    m_publicKey_aesccm(
                        m_aesccm(
                            m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
                                '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
                            )
                        )
                    )
                );
            } // End of testcase tc_PublicKey_aesccm_02
            
            /**
             * @desc Validate EcdsaSignature
             * @remark The EccPointType of R shall be set to x_coordinate_only
             * @verdict Pass on success, Fail otherwise
             */
            testcase tc_EcdsaSignature_01() runs on TCType system TCType {
                test_PDU<EcdsaSignature>(
                    m_ecdsaSignature(
                        m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only(
                            'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
                        ),
                        '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
                    )
                );
            } // End of testcase tc_EcdsaSignature_01
            
            testcase tc_Duration_01() runs on TCType system TCType {
                test_PDU<Duration>(
                     m_duration_in_seconds(
                          456
                    )
                );
            } // End of testcase tc_Duration_01
            
            /**
             * @desc Validate Time64WithStandardDeviation
             * @verdict Pass on success, Fail otherwise
             */
            testcase tc_Time64WithStandardDeviation_01() runs on TCType system TCType {
                test_PDU<Time64WithStandardDeviation>(
                    m_time64WithStandardDeviation(
                        oct2int('FACEB00C'O),
                        128
                    )
                );
            } // End of testcase tc_Time64WithStandardDeviation_01
            
            /**
             * @desc Validate TwoDLocation
             * @verdict Pass on success, Fail otherwise
             */
            testcase tc_TwoDLocation_01() runs on TCType system TCType {
                test_PDU<TwoDLocation>(
                    m_twoDLocation(
                        22345,
                        54321
                    )
                );
            } // End of testcase tc_TwoDLocation_01
            
            /**
             * @desc Validate ThreeDLocation
             * @verdict Pass on success, Fail otherwise
             */
            testcase tc_ThreeDLocation_01() runs on TCType system TCType {
                test_PDU<ThreeDLocation>(
                    m_threeDLocation(
                        12345,
                        54321,
                        int2oct(1024, 2)
                    )
                );
            } // End of testcase tc_ThreeDLocation_01
            
            testcase tc_EncryptionParameters_01() runs on TCType system TCType {
                test_PDU<EncryptionParameters>(
                    m_encryptionParameters_aes_128_ccm(
                        '010203040506070808080808'O
                    )
                );
            } // End of testcase tc_EncryptionParameters_01
            
            testcase tc_GeographicRegion_01() runs on TCType system TCType {
                test_PDU<GeographicRegion>(
                    m_geographicRegion_circle(
                        m_twoDLocation(
                            22345,
                            54321
                        ),
                        2550
                    )
                );
            } // End of testcase tc_EncryptionParameters_01
            
            testcase tc_GeographicRegion_02() runs on TCType system TCType {
                test_PDU<GeographicRegion>(
                    m_geographicRegion_rectangle(
                        m_twoDLocation(
                            22345,
                            54321
                        ),
                        m_twoDLocation(
                            2*22345,
                            2*54321
                        )
                    )
                );
            } // End of testcase tc_EncryptionParameters_02
            
            testcase tc_GeographicRegion_03() runs on TCType system TCType {
                test_PDU<GeographicRegion>(
                    m_geographicRegion_polygonial(
                        {
                            m_twoDLocation(
                                22345,
                                54321
                            ),
                            m_twoDLocation(
                                2*22345,
                                2*54321
                            )
                        }
                    )
                );
            } // End of testcase tc_EncryptionParameters_03
            
            template (value) IdentifiedRegion m_identifiedRegion_01 := {
                region_dictionary := e_un_stats,
                region_identifier := 3,
                local_region      := 10
            } // End of template m_identifiedRegion_01
            
            template (value) IdentifiedRegion m_identifiedRegion_02 := {
                region_dictionary := e_iso_3166_1,
                region_identifier := 4567,
                local_region      := 78
            } // End of template m_identifiedRegion_01
            
            template (value) IdentifiedRegion m_identifiedRegion_03 := {
                region_dictionary := e_iso_3166_1,
                region_identifier := 2,
                local_region      := 2184
            } // End of template m_identifiedRegion_03
            
            template (value) IdentifiedRegion m_identifiedRegion_04 := {
                region_dictionary := e_iso_3166_1,
                region_identifier := 2,
                local_region      := 9 * 2184
            } // End of template m_identifiedRegion_04
            
            testcase tc_GeographicRegion_04() runs on TCType system TCType {
                test_PDU<GeographicRegion>(
                    m_geographicRegion_identifiedRegion(
                        m_identifiedRegion_01
                    )
                );
            } // End of testcase tc_GeographicRegion_04
            
            testcase tc_GeographicRegion_05() runs on TCType system TCType {
                test_PDU<GeographicRegion>(
                    m_geographicRegion_identifiedRegion(
                        m_identifiedRegion_02
                    )
                );
            } // End of testcase tc_GeographicRegion_05
            
            testcase tc_GeographicRegion_06() runs on TCType system TCType {
                test_PDU<GeographicRegion>(
                    m_geographicRegion_identifiedRegion(
                        m_identifiedRegion_03
                    )
                );
            } // End of testcase tc_GeographicRegion_06
            
            testcase tc_GeographicRegion_07() runs on TCType system TCType {
                test_PDU<GeographicRegion>(
                    m_geographicRegion_identifiedRegion(
                        m_identifiedRegion_04
                    )
                );
            } // End of testcase tc_GeographicRegion_07
            
            testcase tc_GeographicRegion_08() runs on TCType system TCType {
                test_PDU<GeographicRegion>(
                    m_geographicRegion_nonce
                );
            } // End of testcase tc_GeographicRegion_08
            
        } // End of group basicFormatElements
            
        group securityHeader {
            
            testcase tc_Payload_01() runs on TCType system TCType {
                test_PDU<SecPayload>(
                    m_payload_signed_external
                );
            } // End of testcase tc_Payload_01
            
            testcase tc_Payload_02() runs on TCType system TCType {
                test_PDU<SecPayload>(
                    m_payload_unsecured('DEEDBEEF'O)
                );
            } // End of testcase tc_Payload_02
            
            testcase tc_Payload_03() runs on TCType system TCType {
                test_PDU<SecPayload>(
                    m_payload_signed('DEEDBEEF'O)
                );
            } // End of testcase tc_Payload_03
            
            testcase tc_Payload_04() runs on TCType system TCType {
                test_PDU<SecPayload>(
                    m_payload_encrypted('DEEDBEEF'O)
                );
            } // End of testcase tc_Payload_04
            
            testcase tc_Payload_05() runs on TCType system TCType {
                test_PDU<SecPayload>(
                    m_payload_signed_and_encrypted('DEEDBEEF'O)
                );
            } // End of testcase tc_Payload_05
            
            testcase tc_HeaderField_01() runs on TCType system TCType {
                test_PDU<HeaderField>(
                    m_header_field_generation_time(
                        123456789
                    )
                );
            } // End of testcase tc_HeaderField_01
            
            testcase tc_HeaderField_02() runs on TCType system TCType {
                test_PDU<HeaderField>(
                    m_header_field_generation_time_with_standard_deviation(
                        m_time64WithStandardDeviation(
                            oct2int('FACEB00C'O),
                            128
                        )
                    )
                );
            } // End of testcase tc_HeaderField_02
            
            testcase tc_HeaderField_03() runs on TCType system TCType {
                test_PDU<HeaderField>(
                    m_header_field_expiry_time(
                        3600
                    )
                );
            } // End of testcase tc_HeaderField_03
            
            testcase tc_HeaderField_04() runs on TCType system TCType {
                test_PDU<HeaderField>(
                    m_header_field_generation_location(
                        m_threeDLocation(
                            -12345,
                            -54321,
                            int2oct(1024, 2)
                        )
                    )
                );
            } // End of testcase tc_HeaderField_04
            
            testcase tc_HeaderField_05() runs on TCType system TCType {
                test_PDU<HeaderField>(
                    m_header_field_unrecognised_certificate(
                        '060708'O
                    )
                );
            } // End of testcase tc_HeaderField_05
            
            testcase tc_HeaderField_06() runs on TCType system TCType {
                test_PDU<HeaderField>(
                    mw_header_field_its_aid(16512)
                );
            } // End of testcase tc_HeaderField_06
            
            testcase tc_HeaderField_07() runs on TCType system TCType {
                test_PDU<HeaderField>(
                    mw_header_field_its_aid(16513)
                );
            } // End of testcase tc_HeaderField_07
            
            testcase tc_HeaderField_08() runs on TCType system TCType {
                test_PDU<HeaderField>(
                    m_header_field_its_aid(
                        12345
                    )
                );
            } // End of testcase tc_HeaderField_08
            
            testcase tc_HeaderField_09() runs on TCType system TCType {
                test_PDU<HeaderField>(
                    m_header_field_signer_info(
                        m_signerInfo_self
                    )
                );
            } // End of testcase tc_HeaderField_09
            
            testcase tc_HeaderField_10() runs on TCType system TCType {
                test_PDU<HeaderField>(
                    m_header_field_enc_params(
                        m_encryptionParameters_aes_128_ccm(
                            '010203040506070808080808'O
                        )
                    )
                );
            } // End of testcase tc_HeaderField_10
            
            testcase tc_TrailerField_01() runs on TCType system TCType {
                test_PDU<TrailerField>(
                    m_trailer_field_signature(
                        m_signature(
                            m_ecdsaSignature(
                                m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                    'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
                                    '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
                                ),
                                '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
                            )
                        )
                    )
                );
            } // End of testcase tc_TrailerField_01
            
            testcase tc_SecuredMessage_01() runs on TCType system TCType {
                test_PDU<SecuredMessage>(
                    m_secureMessage_dummy
                );
            } // End of testcase tc_SecuredMessage_01
            
            template (value) SecuredMessage m_secureMessageCAMs_01
            modifies m_secureMessage_dummy := {
                header_fields        := {
                    m_header_field_signer_info(
                        m_signerInfo_digest('0102030405060708'O)
                    ),
                    m_header_field_signer_info(
                        m_signerInfo_digest('1020304050607080'O)
                    )
                },
                payload_field := m_payload_signed('DEEDBEEF01'O),
                trailer_fields        := { 
                    m_trailer_field_signature(
                        m_signature(
                            m_ecdsaSignature(
                                m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                    'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
                                    '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
                                ),
                                '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
                            )
                        )
                    )
                }
            } // End of template tc_SecuredMessage_01
            
            template (value) SecuredMessage m_secureMessage_02
            modifies m_secureMessage_dummy := {
                header_fields        := {
                    m_header_field_signer_info(
                        m_signerInfo_digest('0102030405060708'O)
                    ),
                    m_header_field_signer_info(
                        m_signerInfo_digest('1020304050607080'O)
                    )
                },
                payload_field := m_payload_signed('DEEDBEEF01'O),
                trailer_fields        := { 
                    m_trailer_field_signature(
                        m_signature(
                            m_ecdsaSignature(
                                m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                    'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
                                    '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
                                ),
                                '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
                            )
                        )
                    ),
                    m_trailer_field_signature(
                        m_signature(
                            m_ecdsaSignature(
                                m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                    '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O,
                                    '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
                                ),
                                'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
                            )
                        )
                    )
                }
            } // End of template m_secureMessage_02
            
            template (value) SecuredMessage m_secureMessageCAMs
            modifies m_secureMessage_dummy := {
                header_fields        := {
                    m_header_field_signer_info(
                        m_signerInfo_digest('0102030405060708'O)
                    ),
                    m_header_field_generation_time(1000 * f_getCurrentTime()),
                    m_header_field_its_aid_CAM
                },
                payload_field := m_payload_signed('DEEDBEEF01'O),
                trailer_fields        := { 
                    m_trailer_field_signature(
                        m_signature(
                            m_ecdsaSignature(
                                m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                    'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
                                    '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
                                ),
                                '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
                            )
                        )
                    ),
                    m_trailer_field_signature(
                        m_signature(
                            m_ecdsaSignature(
                                m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                    '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O,
                                    '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
                                ),
                                'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
                            )
                        )
                    )
                }
            } // End of template m_secureMessageCAMs
            
            template (value) SecuredMessage m_secureMessageDENMs
            modifies m_secureMessage_dummy := {
                header_fields        := {
                    m_header_field_signer_info(
                        m_signerInfo_digest('0102030405060708'O)
                    ),
                    m_header_field_generation_time(1000 * f_getCurrentTime()),
                    m_header_field_generation_location(
                        m_threeDLocation(
                            12345,
                            54321,
                            int2oct(1024, 2)
                        )
                    ),
                    m_header_field_its_aid_DENM
                },
                payload_field := m_payload_signed('DEEDBEEF01'O),
                trailer_fields        := { 
                    m_trailer_field_signature(
                        m_signature(
                            m_ecdsaSignature(
                                m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                    'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
                                    '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
                                ),
                                '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
                            )
                        )
                    ),
                    m_trailer_field_signature(
                        m_signature(
                            m_ecdsaSignature(
                                m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                    '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O,
                                    '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
                                ),
                                'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
                            )
                        )
                    )
                }
            } // End of template m_secureMessageDENMs
            
            template (value) SecuredMessage m_secureMessageOthers
            modifies m_secureMessage_dummy := {
                header_fields        := {
                    m_header_field_signer_info(
                        m_signerInfo_digest('0102030405060708'O)
                    ),
                    m_header_field_generation_time(1000 * f_getCurrentTime()),
                    m_header_field_generation_location(
                        m_threeDLocation(
                            12345,
                            54321,
                            int2oct(1024, 2)
                        )
                    )
                },
                payload_field := m_payload_signed('DEEDBEEF01'O),
                trailer_fields        := { 
                    m_trailer_field_signature(
                        m_signature(
                            m_ecdsaSignature(
                                m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                    'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
                                    '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
                                ),
                                '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
                            )
                        )
                    ),
                    m_trailer_field_signature(
                        m_signature(
                            m_ecdsaSignature(
                                m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                    '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O,
                                    '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
                                ),
                                'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
                            )
                        )
                    )
                }
            } // End of template m_secureMessageOthers
            
            testcase tc_SecuredMessage_02() runs on TCType system TCType {
                test_PDU<SecuredMessage>(
                    m_secureMessage_02
                );
            } // End of testcase tc_SecuredMessage_02
            
            testcase tc_SecuredMessage_03() runs on TCType system TCType {
                test_PDU<SecuredMessage>(
                    m_secureMessageCAMs
                );
                
                if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_CAMs) == true) {
                    setverdict(pass, "Basic");
                }
                if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_CAMs(mw_header_field_signer_info_digest)) == true) {
                    setverdict(pass, "With digest");
                }
                if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_CAMs(mw_header_field_signer_info_certificate)) == false) {
                    setverdict(pass, "With certificate mismatch");
                }
                if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_DENMs) == true) {
                    setverdict(fail, "Shall not match with DENM template");
                    stop;
                }
                if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_Others) == true) {
                    setverdict(fail, "Shall not match with Other template");
                    stop;
                }
            } // End of testcase tc_SecuredMessage_03
            
            testcase tc_SecuredMessage_04() runs on TCType system TCType {
                test_PDU<SecuredMessage>(
                    m_secureMessageDENMs
                );
                
                if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_DENMs) == true) {
                    setverdict(pass, "Basic");
                }
                if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_DENMs(mw_header_field_signer_info_digest)) == true) {
                    setverdict(pass, "With digest");
                }
                if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_DENMs(mw_header_field_signer_info_certificate)) == false) {
                    setverdict(pass, "With certificate mismatch");
                }
                if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_CAMs) == true) {
                    setverdict(fail, "Shall not match with CAM template");
                    stop;
                }
                if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_Others) == true) {
                    setverdict(fail, "Shall not match with Other template");
                    stop;
                }
            } // End of testcase tc_SecuredMessage_04
            
            testcase tc_SecuredMessage_05() runs on TCType system TCType {
                test_PDU<SecuredMessage>(
                m_secureMessageOthers
                );
                
                if (match(valueof(m_secureMessageOthers), mdw_securedMessage_Others) == true) {
                    setverdict(pass, "Basic");
                }
                if (match(valueof(m_secureMessageOthers), mdw_securedMessage_Others(mw_header_field_signer_info_digest)) == true) {
                    setverdict(pass, "With digest");
                }
                if (match(valueof(m_secureMessageOthers), mdw_securedMessage_Others(mw_header_field_signer_info_certificate)) == false) {
                    setverdict(pass, "With certificate mismatch");
                }
                if (match(valueof(m_secureMessageOthers), mdw_securedMessage_CAMs) == true) {
                    setverdict(fail, "Shall not match with CAM template");
                    stop;
                }
                if (match(valueof(m_secureMessageOthers), mdw_securedMessage_CAMs) == true) {
                    setverdict(fail, "Shall not match with CAM template");
                    stop;
                }
                if (match(valueof(m_secureMessageOthers), mdw_securedMessage_DENMs) == true) {
                    setverdict(fail, "Shall not match with DENM template");
                    stop;
                }
            } // End of testcase tc_SecuredMessage_05
            
        } // End of group securityHeader
        
        group certificates {
            
            testcase tc_SubjectInfo_01() runs on TCType system TCType {
                test_PDU<SubjectInfo>(
                    m_subject_info_root_ca('DEADBEEF'O)
                );
            } // End of testcase tc_SubjectInfo_01
            
            testcase tc_SubjectInfo_02() runs on TCType system TCType {
                test_PDU<SubjectInfo>(
                    m_subject_info_revocation('DE5EA5ED'O)
                );
            } // End of testcase tc_SubjectInfo_02
            
            testcase tc_SubjectAttribute_01() runs on TCType system TCType {
                test_PDU<SubjectAttribute>(
                    m_subject_attribute_verification_key(
                        m_publicKey_eccPoint(
                            m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
                                '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
                            )
                        )
                    )
                );
            } // End of testcase tc_SubjectAttribute_01
            
            testcase tc_SubjectAttribute_02() runs on TCType system TCType {
                test_PDU<SubjectAttribute>(
                    m_subject_attribute_encryption_key(
                        m_publicKey_eccPoint(
                            m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
                                '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
                            )
                        )
                    )
                );
            } // End of testcase tc_SubjectAttribute_02
            
            testcase tc_SubjectAttribute_03() runs on TCType system TCType {
                test_PDU<SubjectAttribute>(
                    m_subject_attribute_reconstruction_value(
                        m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                            'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
                            '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
                        )
                    )
                );
            } // End of testcase tc_SubjectAttribute_03
            
            testcase tc_SubjectAttribute_04() runs on TCType system TCType {
                test_PDU<SubjectAttribute>(
                    m_subject_attribute_assurance_level(
                        m_subjectAssurance(
                            '101'B,
                            '11'B
                        )
                    )
                );
            } // End of testcase tc_SubjectAttribute_04
            
            testcase tc_SubjectAttribute_05() runs on TCType system TCType {
                test_PDU<SubjectAttribute>(
                    m_subject_attribute_its_aid_list(
                        {
                            9 * 2184,
                            7 * 2184,
                            5 * 2184,
                            3 * 2184,
                            2184
                        }
                    )
                );
            } // End of testcase tc_SubjectAttribute_05
            
            testcase tc_SubjectAttribute_06() runs on TCType system TCType {
                test_PDU<SubjectAttribute>(
                    m_subject_attribute_its_aid_ssp_list(
                        {
                            {
                                9 * 2184,
                                m_sspTest
                            },
                            {
                                7 * 2184,
                                m_sspTest
                            },
                            {
                                5 * 2184,
                                m_sspTest
                            },
                            {
                                3 * 2184,
                                m_sspTest
                            },
                            {
                                2184,
                                m_sspTest
                            }
                        }
                    ), 
                    true,
                    oct2bit('2115C04CC80100BBB80100AAA801009998010088880100'O)
                );
            } // End of testcase tc_SubjectAttribute_06
            
            testcase tc_SubjectAttribute_07() runs on TCType system TCType {
                test_PDU<SubjectAttribute>(
                    m_subject_attribute_its_aid_ssp_list(
                        {
                            {
                                16512,
                                {
                                    version := '00'O,
                                    sspContainer := omit
                                }
                            },
                            {
                                16513,
                                {
                                    version := '00'O,
                                    sspContainer := omit
                                }
                            }
                        }
                    ), 
                    true,
                    oct2bit('210AC040800100C040810100'O)
                );
            } // End of testcase tc_SubjectAttribute_07
            
            testcase tc_SubjectAttribute_08() runs on TCType system TCType {
                test_PDU<SubjectAttribute>(
                    m_subject_attribute_its_aid_ssp_list(
                        {
                            {
                                16512,
                                m_sspDENM_vehicle
                            },
                            {
                                16513,
                                m_sspDENM_vehicle
                            }
                        }
                    ), 
                    true,
                    oct2bit('2110C04080040101F8DFC04081040101F8DF'O)
                );
            } // End of testcase tc_SubjectAttribute_08
            
            testcase tc_SubjectAssurance_01() runs on TCType system TCType {
                test_PDU<SubjectAssurance>(
                    m_subjectAssurance(
                        '101'B,
                        '11'B
                    )
                );
            } // End of testcase tc_SubjectAssurance_01
            
            testcase tc_ValidityRestriction_01() runs on TCType system TCType {
                test_PDU<ValidityRestriction>(
                    m_validity_restriction_time_end(
                        12345
                    )
                );
            } // End of testcase tc_ValidityRestriction_01
            
            testcase tc_ValidityRestriction_02() runs on TCType system TCType {
                test_PDU<ValidityRestriction>(
                    m_validity_restriction_time_start_and_end(
                        12345,
                        12378
                    )
                );
            } // End of testcase tc_ValidityRestriction_02
            
            testcase tc_ValidityRestriction_03() runs on TCType system TCType {
                test_PDU<ValidityRestriction>(
                    m_validity_restriction_time_start_and_duration(
                        12345,
                        m_duration_in_seconds(
                             456
                       )
                    )
                );
            } // End of testcase tc_ValidityRestriction_03
            
            testcase tc_ValidityRestriction_04() runs on TCType system TCType {
                test_PDU<ValidityRestriction>(
                    m_validity_restriction_region(
                        m_geographicRegion_identifiedRegion(
                            m_identifiedRegion_02
                        )
                    )
                );
            } // End of testcase tc_ValidityRestriction_04
            
            /**
             * @desc Root certificate self signed
             * @verdict 
             */
            testcase tc_Certificate_01() runs on TCType system TCType {
                test_PDU<Certificate>(
                    m_certificate(
                        m_signerInfo_self, 
                        m_subject_info_root_ca('455453495f506c7567746573745f526f6f74'O), // ETSI_Plugtest_Root
                        {
                            m_subject_attribute_verification_key(
                                m_publicKey_eccPoint(
                                    m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                        '63eb5c4ea82bc6a6b27e5857a075dce18f0e3cdc01d42896418b23f68872e41a'O,
                                        'd04f5dfcdc2be224986e15147840ff21f709dcb6503a416207e1b8e1ce395c2a'O
                                    )
                                )
                            ),
                            m_subject_attribute_verification_key(
                                m_publicKey_aesccm(
                                    m_aesccm(
                                        m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                            '4dff56b92fcf680ee694ee58473f9f7d37516c3708f108a5185c185c5f159f02'O,
                                            'f47aa5d2514f593245dd6575613114182dc83ec67ac2a7b6726421d94c55184b'O
                                        )
                                    )
                                )
                            )
                        }, // End of field subject_attributes
                        {
                        }, // End of field validity_restrictions
                        m_signature(
                            m_ecdsaSignature(
                                m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only(
                                    'd06ff2baf762e9618cac21bd110f271ea2a7c91355dca14753fc9a0dded1ab34'O
                                ),
                                '71db2dd2ba840126e2904297f34386ccdfe86a0ebe0e585748517a5da49808b4'O
                            )
                        )
                    ) // End of template m_certificate
                );
            } // End of testcase tc_Certificate_01
            
            template (value) octetstring m_rootCertificate := '02000412455453495f506c7567746573745f526f6f748091000004a0ce08d329fd7be6b5af8fde7dad64e57fa5ff54dfaf9ec42b7443193c1f9d9d48e3c03250e59f895b17ca1e68cd8f5f1e9b1b06eddd0b98dfde91e88fa1199501010004e82c1957b1da51b5a00f29e51db151b30bd6ef29bd0c2f3e8e5cf457826f8660e59e4783e9b4b2a5b455263183ea88b18ae7e2d90ec805260213978014d1b2bf02202006c04080c0408124011464b4031a5617030303181db9cf7c052616001db9566e0526872a1d53f0d0052783500000a83ef7af9f3509189db625cd2e30eaefaf4f5b604d36389ece4f06b37a3923cf13ce5734485e25e360a7cf386eee795debbe9c61586de56b4fbd46d704109956'O;
            template (value) octetstring m_aaCertificate := '02016da94961ba3e28810210455453495f506c7567746573745f41418091000004c368a797aa7943e4176aa5004d37eec5e12b92fea6b9630a9e197a10702f0f495c775d0e12bdbb21eb18648409443072ff2a383d51b5f7a5a7dca88434b5bb8801010004b244be4855cbb05cc7302903d043fe36d5abaa1b331b8c4de3e74c212cfac113b244be4855cbb05cc7302903d043fe36d5abaa1b331b8c4de3e74c212cfac11302202006c04080c0408124011464b4031a5617030303181db9cf7c052616001db9566e0526872a1d53f0d00527835000004c004618e92921341bcded2f15c58f50aa3590e59a3a798fe1a3b2364d66d8823b855859920f3e7f96e66f85ce90cee26ac71cb2ee9fbeecb64747ce19c50804'O;
            template (value) octetstring m_atCertificate := '0201ebdb26e96a88ea1b01008095000004ceb7c449075ce00c1e7e1f997d443194dcf904f01f6149d4287bdcdb3bad251aa882d59fe8747108e2980c663353967a152c5b27cd83e055f93bc9b9da265859010100044d1c988453d69cae826f8a14f46d672d000b777c606a05b1b622a11f356fb2facba1fa6f2fb2ba44d47765dc6062966ded39161a5222799af887508767b657ec0220210ac040800100c04081010024011464b4031a5617030303181db9cf7c052616001db9566e0526872a1d53f0d005278350000050804677f295dbd99a64aaec8d100f07efd14234a6152012fd1371c32ff1e4479543df14c2de7d744c8526ed330bca75f05e30361a25c11dd2c83bbdf495f81f'O;
            
            testcase tc_Certificate_02() runs on TCType system TCType {
                test_decodePDU<Certificate>(
                    mw_certificate_dummy,
                    m_rootCertificate
                );
            } // End of testcase tc_Certificate_02
            
            testcase tc_Certificate_03() runs on TCType system TCType {
                test_decodePDU<Certificate>(
                    mw_certificate_dummy,
                m_aaCertificate
                );
            } // End of testcase tc_Certificate_03
            
            testcase tc_Certificate_04() runs on TCType system TCType {
                test_decodePDU<Certificate>(
                    mw_certificate_dummy,
                m_atCertificate
                );
            } // End of testcase tc_Certificate_04
            
            testcase tc_Certificate_05() runs on TCType system TCType {
                var Certificate v_ca;
                var Certificate v_aa;
                var Certificate v_at;
                var bitstring v_encMsg;
                var integer v_res;
                var HashedId8 v_hashedId8;
                var HashedId3 v_hashedId3;
                
                // AT certificate
                v_res := decvalue(oct2bit(m_atCertificate), v_at);
                if (v_res != 0) {
                    setverdict(fail, "Decoding failed.");
                    stop;
                }
                // AA certificate
                v_res := decvalue(oct2bit(m_aaCertificate), v_aa);
                if (v_res != 0) {
                    setverdict(fail, "Decoding failed.");
                    stop;
                }
                // CA certificate
                v_res := decvalue(oct2bit(m_rootCertificate), v_ca);
                if (v_res != 0) {
                    setverdict(fail, "Decoding failed.");
                    stop;
                }
                
                // AT-AA certificates
                v_hashedId8 := f_calculateDigestFromCertificate(v_aa);
                if (v_hashedId8 != v_at.signer_info.signerInfo.digest) {
                    setverdict(fail, "Digest does not match.");
                    stop;
                } else {
                    setverdict(pass, "Digest match.");
                }