Commit 037b112e authored by garciay's avatar garciay
Browse files

STF538: Finalize GN, DENM & CAM TP implementation

parent 77a11f92
Loading
Loading
Loading
Loading
+104 −106
Original line number Diff line number Diff line
@@ -4213,9 +4213,8 @@ module ItsSecurity_TestCases {
            } // End of testcase TC_SEC_ITSS_SND_DENM_05_BV
            
            /**
             * @desc   Check that IUT sends the secured DENM containing generation time 
             *         and this time is inside the validity period of the signing certificate;
             *         Check that message generation time value is realistic.
             * @desc   Check that IUT sends the secured DENM containing generation location when signing certificate 
             *         chain doesn’t have any region restriction.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
@@ -4238,16 +4237,7 @@ module ItsSecurity_TestCases {
             *   } then {
             *       the IUT sends a SecuredMessage of type EtsiTs103097Data
             *           containing headerInfo
             *               containing generationTime
             *                   indicating TIME_1 (CUR_TIME - 10min <= TIME_1 <= CUR_TIME + 10min)
             *           and containing signer
             *               containing certificate
             *                   containing toBeSigned
             *                       containing validityPeriod
             *                           containing start
             *                               indicating value X_START_VALIDITY (X_START_VALIDITY <= GEN_TIME)
             *                           and containing duration
             *                               indicating value > GEN_TIME - X_START_VALIDITY 
             *               containing generationLocation 
             *   }
             * }
             * </pre>
@@ -4259,9 +4249,6 @@ module ItsSecurity_TestCases {
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var HeaderInfo       v_headerInfo;
                var SignerIdentifier v_signerIdentifier;
                var ValidityPeriod   v_validityPeriod;
                var Certificate      v_cert;
                var ItsDenm          v_denmComponent;
                
                // Test control
@@ -4298,7 +4285,7 @@ module ItsSecurity_TestCases {
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -, 
                                                    omit
                                                    ?
                                                )
                                            )
                                        )
@@ -4409,7 +4396,10 @@ module ItsSecurity_TestCases {
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -,
                                                    ?
                                                )
                                            )
                                        )
                                    )
@@ -4474,7 +4464,7 @@ module ItsSecurity_TestCases {
             * @desc   Check that IUT sends the secured DENM containing generation location which is inside the region 
             *         defined by the validity restriction of the certificate pointed by the message signer . 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_CERTIFICATE_SELECTION
             * Pics Selection: PICS_GN_SECURITY and not PICS_SEC_CERTIFICATE_SELECTION
             * Config Id: CF01
             * Initial conditions:
             * with {
@@ -4506,8 +4496,8 @@ module ItsSecurity_TestCases {
                var ItsDenm          v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_CERTIFICATE_SELECTION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_CERTIFICATE_SELECTION' required for executing the TC ***");
                if (not(PICS_GN_SECURITY) or PICS_SEC_CERTIFICATE_SELECTION) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and not PICS_SEC_CERTIFICATE_SELECTION' required for executing the TC ***");
                    stop;
                }
                
@@ -6470,90 +6460,98 @@ module ItsSecurity_TestCases {
         */
        group sendCertificatesProfile {
            
//            /**
//             * @desc    Check that AT certificate has version 2
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * Config Id: CF01
//             * Initial conditions:
//             * with {
//             *   the IUT being in the 'authorized' state
//             *   the IUT being requested to include certificate in the next CAM
//             * }
//             * Expected Behaviour:
//             * ensure that {
//             *    when {
//             *     the IUT is requested to send a CAM
//             *   } then {
//             *     the IUT sends a Ieee1609Dot2Data
//             *         containing header_fields['signer_info'].signer
//             *             containing type
//             *                 indicating certificate
//             *             containing certificate
//             *                 containing version
//             *                     indicating '2'
//             *   }
//             * }
//             * </pre>
//             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_01_01_BV
//             * @reference   ETSI TS 103 097 [1] Clauses 6.1 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_SND_CERT_01_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                // Local variables
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                    
//                // Test adapter configuration
//                    
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                tc_ac.start;
//                alt {
//                    [] geoNetworkingPort.receive(
//                        mw_geoNwInd(
//                            mw_geoNwSecPdu(
//                                mw_securedMessage(
//                                    superset(
//                                        mw_header_info_signer_info_certificate(
//                                            mw_certificate(
//                    ))))))) {
//                        tc_ac.stop;
//                        log("*** " & testcasename() & ": PASS: AT Certificate version set to " & int2char(c_certificate_version) & " ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    }
//                    [] geoNetworkingPort.receive(
//                        mw_geoNwInd(
//                            mw_geoNwSecPdu(
//                                mw_securedMessage(
//                                    superset(
//                                        mw_header_info_signer_info_certificate(
//                                            ?
//                    )))))) {
//                        tc_ac.stop;
//                        log("*** " & testcasename() & ": FAIL: AT Certificate version mismatch ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    [] tc_ac.timeout {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
//                    }
//                } // End of 'alt' statement
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_SND_CERT_01_01_BV
//            
        /**
         * @desc    Check that IUT certificate is explicit and has version 3.
         * <pre>
         * Pics Selection: PICS_GN_SECURITY
         * Config Id: CF01
         * Initial conditions:
         *  with {
         *      the IUT being in the 'authorized' state
         *  }
         * Expected behaviour:
         * ensure that {
         *     when { 
         *         the AA is issued the certificate
         *     } then {
         *         this certificate is of type EtsiTs103097Certificate
         *             containing version
         *                 indicating 3
         *             and containing type
         *                 indicating ‘explicit’
         *             and containing toBeSigned
         *                 containing verifyKeyIndicator
         *                     containing verificationKey
         *     }
         * }
         * </pre>
         *
         * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_01_BV
         * @reference   ETSI TS 103 097 [1], clauses 6
         * @reference   IEEE 1609.2 [2], clause 6.4.3
         */
        testcase TC_SEC_ITSS_SND_CERT_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
            // Local variables
            var Ieee1609Dot2Data v_recv;
            var Certificate v_cert;
            var HashedId8 v_digest;
                
            // Test control
            if (not(PICS_GN_SECURITY)) {
                log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                stop;
            }
            
            // Test component configuration
            f_cf01Up();
                
            // Test adapter configuration
            
            // Preamble
            f_prNeighbour();
            // Wait for the message with the certificate to retrieve the AA digest.
            // Ask for the chain, containing AT and AA certificate
            // Check AA Certificate
            log("*** " & testcasename() & ": INFO: Wait for certificate and ask for certificate chain  ***");
            tc_ac.start;
            f_askForCertificateChain(f_generateDefaultCam());
            tc_ac.stop;
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            tc_ac.start;
            alt {
                [] geoNetworkingPort.receive(
                    mw_geoNwInd(
                        mw_geoNwSecPdu(
                            mw_etsiTs103097Data_signed(
                                mw_signedData(
                                    -,
                                    mw_toBeSignedData(
                                        -,
                                        mw_ieee1609Dot2_headerInfo_request_certificate(
                                            -,
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_aa
                )))))))) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: Security protocol version set to 3 ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                }
            } // End of 'alt' statement
            
            // Postamble
            f_poNeighbour();
            f_cf01Down();
            
        } // End of testcase TC_SEC_ITSS_SND_CERT_01_BV
        
//            /**
//             * @desc    Check that AA certificate has version 2
//             * <pre>
+37 −0
Original line number Diff line number Diff line
@@ -70,6 +70,43 @@ module ItsSecurity_TestControl {
            execute(TC_SEC_ITSS_SND_DENM_04_BV());
            execute(TC_SEC_ITSS_SND_DENM_05_BV());
            execute(TC_SEC_ITSS_SND_DENM_06_BV());
            execute(TC_SEC_ITSS_SND_DENM_07_BV());
            execute(TC_SEC_ITSS_SND_DENM_08_BV());
            execute(TC_SEC_ITSS_SND_DENM_09_BV());
            execute(TC_SEC_ITSS_SND_DENM_10_BV());
            execute(TC_SEC_ITSS_SND_DENM_11_BV());
            execute(TC_SEC_ITSS_SND_DENM_12_BV());
            execute(TC_SEC_ITSS_SND_DENM_13_BV());
            execute(TC_SEC_ITSS_SND_DENM_14_BV());
            execute(TC_SEC_ITSS_SND_DENM_15_BV());
            execute(TC_SEC_ITSS_SND_DENM_16_BV());
            execute(TC_SEC_ITSS_SND_DENM_17_BV());
            execute(TC_SEC_ITSS_SND_DENM_18_BV());
            
            /**
             * @desc Sending behaviour test cases for DENM profile
             * @see ETSI TS 103 096-2 V1.2.2 (2016-01) Clause 5.2.6	Generic signed message profile
             */
            execute(TC_SEC_ITSS_SND_GENMSG_01_BV());
            execute(TC_SEC_ITSS_SND_GENMSG_02_BV());
            execute(TC_SEC_ITSS_SND_GENMSG_03_BV());
            execute(TC_SEC_ITSS_SND_GENMSG_04_BV());
            execute(TC_SEC_ITSS_SND_GENMSG_05_BV());
            execute(TC_SEC_ITSS_SND_GENMSG_06_BV());
            execute(TC_SEC_ITSS_SND_GENMSG_07_BV());
            execute(TC_SEC_ITSS_SND_GENMSG_08_BV());
            
            /**
             * @desc Sending behaviour test cases for certificates profile
             * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.2.7 Encrypted messages profile
             */
            // TODO
            
            /**
             * @desc Sending behaviour test cases for certificates profile
             * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.2.8 Profiles for certificates
             */
            execute(TC_SEC_ITSS_SND_CERT_01_BV());            
        }
        
    } // End of 'control' statement
+2 −4
Original line number Diff line number Diff line
@@ -682,8 +682,7 @@ module TestCodec_ChainOfCertificates {
                                                           ),
                                       m_headerInfo_gn(
                                                       -,
                                                       12345,
                                                       123456
                                                       12345
                                                       )
                                       );
    // Signed it
@@ -729,8 +728,7 @@ module TestCodec_ChainOfCertificates {
                                                           ),
                                       m_headerInfo_gn(
                                                       -,
                                                       12345,
                                                       123456
                                                       12345
                                                       )
                                       );
    // Signed it
+13 −1
Original line number Diff line number Diff line
@@ -1011,11 +1011,23 @@ module TestCodec_GeoNetworking {
                                                                                         m_dummyLongPosVectorNodeB, 
                                                                                         3456, 
                                                                                         m_dummyGeoBroadcastArea1
                                                                                         ))));
                                                                                         ),
                                                                  Lifetime: {multiplier := c_defaultLifetime, ltBase := e_100s}
                                                                  )));
        
        geoNetworkingPort.send(v_gnReq);
        tc_ac.start;
        alt {
          [] geoNetworkingPort.receive(
                                       mw_geoNwInd(
                                                   mw_geoNwPdu(
                                                               mw_geoNwBroadcastPacket
                                                               ))) {
            if (v_got_beacon == false) {
              v_got_beacon := true;
              setverdict(pass);
            }
          }
          [] geoNetworkingPort.receive(
                                       mw_geoNwInd(
                                                   mw_geoNwPdu(
+3 −6
Original line number Diff line number Diff line
@@ -134,8 +134,7 @@ module TestCodec_SecuredMessages {
                                                                                                ),
                                                                            m_headerInfo_gn(
                                                                                            -,
                                                                                            12345,
                                                                                            123456
                                                                                            12345
                                                                                            )
                                                                            ),
                                                           { digest := v_digest },
@@ -194,8 +193,7 @@ module TestCodec_SecuredMessages {
                                                                                        ),
                                                                    m_headerInfo_gn(
                                                                                    -,
                                                                                    12345,
                                                                                    123456
                                                                                    12345
                                                                                    )
                                                                    )));
  v_secured_data := m_etsiTs103097Data_signed(
@@ -207,8 +205,7 @@ module TestCodec_SecuredMessages {
                                                                                        ),
                                                                    m_headerInfo_gn(
                                                                                    -,
                                                                                    12345,
                                                                                    123456
                                                                                    12345
                                                                                    )
                                                                    ),
                                                           { digest := v_digest },