ItsSecurity_TestCases.ttcn 1.35 MB
Newer Older
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO_nodeB(cc_taCert_AA));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_12_02_BO
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards a Secured GN Message if the signer certificate of the message contains the subject type 'enrolment_authority'
filatov's avatar
filatov committed
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
filatov's avatar
filatov committed
             * Initial conditions:
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * Expected results:
             *   ensure that
             *     when
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A)
filatov's avatar
filatov committed
             *         containing header_fields ['signer_info']
             *           containing signer
             *             containing type
             *               indicating 'certificate'
             *             containing certificate (CERT_TS_A_EA)
             *               containing subject_info.subject_type
             *                 indicating 'enrolment_authority'
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_GENMSG_12_03_BO
             * @reference   ETSI TS 103 097 v1.2.1, clauses 6.3 & 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_12_03_BO() runs on ItsMtc system ItsSecSystem {
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO_nodeB(cc_taCert_EA));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_12_03_BO
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards a Secured GN Message if the signer certificate of the message contains the subject type 'root_ca'
filatov's avatar
filatov committed
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
filatov's avatar
filatov committed
             * Initial conditions:
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * Expected results:
             *   ensure that
             *     when
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A)
filatov's avatar
filatov committed
             *         containing header_fields ['signer_info']
             *           containing signer
             *             containing type
             *               indicating 'certificate'
             *             containing certificate (CERT_TS_ROOT)
             *               containing subject_info.subject_type
             *                 indicating 'root_ca'
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_GENMSG_12_04_BO
             * @reference   ETSI TS 103 097 v1.2.1, clauses 6.3 & 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_12_04_BO() runs on ItsMtc system ItsSecSystem {
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO_nodeB(cc_taCert_CA));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_12_04_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO {
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                 */
                function f_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO_nodeB(
                                                                 in charstring p_taCert
                ) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var GeoNetworkingPdu v_securedGnPdu;
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
                    
                    // Preamble
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    v_securedGnPdu := f_prepareSecuredBeacon(
                        p_taCert, 
                        {
                            m_header_field_signer_info(
                                m_signerInfo_digest(
                                    vc_atCertificate.signer_info.signerInfo.digest
                            )), 
                            m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                            m_header_field_generation_location(
                                valueof(m_threeDLocation(
                                    PX_WGSLATITUDE,
                                    PX_WGSLONGITUDE,
                                    '0000'O
                                ))
                            ),
                            m_header_field_its_aid_Other
                        }, 
                        e_certificate,
                        true
                    ); 
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    
                    // Postamble
                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                    
                } // End of function f_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO_nodeB
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_12_0x_BV
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards secured message signed with the not yet valid certificate
filatov's avatar
filatov committed
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
filatov's avatar
filatov committed
             * Initial conditions:
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is before the time validity period of CERT_TS_MSG_13_01_BO_AT
             * Expected results:
             *   ensure that
             *     when
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A)
filatov's avatar
filatov committed
             *         containing header_fields['signer_info'].signer
             *           containing certificate (CERT_TS_MSG_13_01_BO_AT)
             *             containing validity_restrictions['time_start_and_end']
             *               containing start_validity
             *                 indicating START_VALIDITY_AT > CURRENT_TIME
             *               and containing end_validity
             *                 indicating END_VALIDITY_AT > START_VALIDITY_AT
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_GENMSG_13_01_BO
             * @reference   ETSI TS 103 097 v1.2.1, clause 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_13_01_BO() runs on ItsMtc system ItsSecSystem {
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1301_BO));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_13_01_BO
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards secured message signed with the expired certificate
filatov's avatar
filatov committed
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
filatov's avatar
filatov committed
             * Initial conditions:
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is before the time validity period of CERT_TS_MSG_13_02_BO_AT
             * Expected results:
             *   ensure that
             *     when
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A)
filatov's avatar
filatov committed
             *         containing header_fields['signer_info'].signer
             *           containing certificate (CERT_TS_MSG_13_02_BO_AT)
             *             containing validity_restrictions['time_start_and_end']
             *               containing start_validity
             *                 indicating START_VALIDITY_AT < CURRENT_TIME
             *               and containing end_validity
             *                 indicating END_VALIDITY_AT < CURRENT_TIME
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_GENMSG_13_02_BO
             * @reference   ETSI TS 103 097 v1.2.1, clause 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_13_02_BO() runs on ItsMtc system ItsSecSystem {
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1302_BO));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_13_02_BO
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards secured message when IUT location is outside the circular validity restriction of the signing certificate
filatov's avatar
filatov committed
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
filatov's avatar
filatov committed
             * Initial conditions:
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the validity period of CERT_TS_MSG_13_03_BO_AT
             *     and the IUT current location is set to CURRENT_IUT_LOCATION
             * Expected results:
             *   ensure that
             *     when
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_B)
             *         containing header_fields['signer_info'].signer
             *           containing certificate (CERT_TS_MSG_13_03_BO_AT)
             *             containing validity_restrictions['region']
             *               containing region
             *                 containing region_type
             *                   indicating 'circle'
             *                 and containing circular_region
             *                   indicating REGION
             *                     not containing the CURRENT_IUT_LOCATION
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_GENMSG_13_03_BO
             * @reference   ETSI TS 103 097 v1.2.1, clause 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_13_03_BO() runs on ItsMtc system ItsSecSystem {
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1303_BO));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_13_03_BO
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards secured message when IUT location is outside the rectangular validity restriction of the signing certificate
filatov's avatar
filatov committed
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
filatov's avatar
filatov committed
             * Initial conditions:
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the validity period of CERT_TS_MSG_13_04_BO_AT
             *     and the IUT current location is set to CURRENT_IUT_LOCATION
             * Expected results:
             *   ensure that
             *     when
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_C)
             *         containing header_fields['signer_info'].signer
             *           containing certificate (CERT_TS_MSG_13_04_BO_AT)
             *             containing validity_restrictions['region']
             *               containing region
             *                 containing region_type
             *                   indicating 'rectangle'
             *                 and containing rectangular_regions
             *                   indicating REGION
             *                     not containing the CURRENT_IUT_LOCATION
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_GENMSG_13_04_BO
             * @reference   ETSI TS 103 097 v1.2.1, clause 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_13_04_BO() runs on ItsMtc system ItsSecSystem {
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1304_BO));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_13_04_BO
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards secured message when IUT location is outside the polygonal validity restriction of the signing certificate
filatov's avatar
filatov committed
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
filatov's avatar
filatov committed
             * Initial conditions:
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the validity period of CERT_TS_MSG_13_05_BO_AT
             *     and the IUT current location is set to CURRENT_IUT_LOCATION
             * Expected results:
             *   ensure that
             *     when
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_D)
             *         containing header_fields['signer_info'].signer
             *           containing certificate (CERT_TS_MSG_13_05_BO_AT)
             *             containing validity_restrictions['region']
             *               containing region
             *                 containing region_type
             *                   indicating 'polygon'
             *                 and containing polygonal_region
             *                   indicating REGION
             *                     not containing the CURRENT_IUT_LOCATION
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_GENMSG_13_05_BO
             * @reference   ETSI TS 103 097 v1.2.1, clause 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_13_05_BO() runs on ItsMtc system ItsSecSystem {
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1305_BO));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_13_05_BO
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards secured message when IUT location is outside the identified validity restriction of the signing certificate
filatov's avatar
filatov committed
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
filatov's avatar
filatov committed
             * Initial conditions:
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the validity period of CERT_TS_MSG_13_06_BO_AT
             *     and the IUT current location is set to CURRENT_IUT_LOCATION
             * Expected results:
             *   ensure that
             *     when
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_E)
             *         containing header_fields['signer_info'].signer
             *           containing certificate (CERT_TS_MSG_13_06_BO_AT)
             *             containing validity_restrictions['region']
             *               containing region
             *                 containing region_type
             *                   indicating 'id'
             *                 and containing id_region
             *                   indicating REGION
             *                     not containing the CURRENT_IUT_LOCATION
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_GENMSG_13_06_BO
             * @reference   ETSI TS 103 097 v1.2.1, clause 7.3
             */
            testcase TC_SEC_ITSS_RCV_GENMSG_13_06_BO() runs on ItsMtc system ItsSecSystem {
                
                // Local variables
                var ItsGeoNetworking v_nodeB;
                var ItsGeoNetworking v_nodeD;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1306_BO));
                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
                
                // Synchronization
                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
                
                // Cleanup
                f_cf02Down();
                
            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_13_06_BO
            
            group g_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO {
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                 */
                function f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(
                                                                 in charstring p_taCert
                ) runs on ItsGeoNetworking {
                    
                    // Local variables
                    f_cf01Up();
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendSecuredBeacon(p_taCert, omit, e_certificate);
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    
                    // Postamble
                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                    
                } // End of function f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB
                
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_13_0x_BV
            
        } // End of group recvOtherProfile
        
        /**
         * @desc Receiving behaviour test cases for certificates profile
         * @see ETSI TS 103 096-2 V1.2.2 (2016-01) Clause 5.3.5 Profiles for certificates
         */
        group recvCertificatesProfile {
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards the AT certificate with version 3
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
filatov's avatar
filatov committed
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the time validity period of CERT_TS_01_01_BO_AT
             * Expected results:
             *   ensure that
             *     when the IUT is receiving a SecuredMessage
             *       containing header_fields ['signer_info']
             *         containing signer
             *           containing type
             *             indicating 'certificate'
             *           and containing certificate (CERT_TS_01_01_BO_AT)
             *             containing version
             *               indicating '3'
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_CERT_01_01_BO
             * @reference   ETSI TS 103 097 v1.2.1, clauses 6.1 & 7.4.1
             */
            testcase TC_SEC_ITSS_RCV_CERT_01_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                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
                v_securedGnPdu := f_sendSecuredCam(cc_taCert0101_BO, omit, e_certificate);
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // Empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CERT_01_01_BO
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards the AT certificate with version 1
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
filatov's avatar
filatov committed
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the time validity period of CERT_TS_01_02_BO_AT
             * Expected results:
             *   ensure that
             *     when the IUT is receiving a SecuredMessage
             *       containing header_fields ['signer_info']
             *         containing signer
             *           containing type
             *             indicating 'certificate'
             *           and containing certificate (CERT_TS_01_02_BO_AT)
             *             containing version
             *               indicating '1'
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_CERT_01_02_BO
             * @reference   ETSI TS 103 097 v1.2.1, clauses 6.1 & 7.4.1
             */
            testcase TC_SEC_ITSS_RCV_CERT_01_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                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
                v_securedGnPdu := f_sendSecuredCam(cc_taCert0102_BO, omit, e_certificate);
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // Empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CERT_01_02_BO
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards the AA certificate with version 3
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
filatov's avatar
filatov committed
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the time validity period of CERT_TS_01_03_BO_AT
             * Expected results:
             *   ensure that
             *     when the IUT is receiving a SecuredMessage
             *       containing header_fields ['signer_info']
             *         containing signer
             *           containing type
             *             indicating 'certificate_chain'
             *           and containing certificates[0] (CERT_TS_01_03_BO_AA)
             *             containing version
             *               indicating '3'
             *           and containing certificates[1] (CERT_TS_01_03_BO_AT)
             *             containing signer_info.type
             *               indicating 'certificate_digest_with_sha256'
             *             and containing signer_info.digest
             *               referencing to CERT_TS_01_03_BO_AA
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_CERT_01_03_BO
             * @reference   ETSI TS 103 097 v1.2.1, clauses 6.1 & 7.4.1
             */
            testcase TC_SEC_ITSS_RCV_CERT_01_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                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
                v_securedGnPdu := f_sendSecuredCam(cc_taCert0103_BO, -, e_certificate_chain);
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // Empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CERT_01_03_BO
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards the AA certificate with version 1
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
filatov's avatar
filatov committed
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the time validity period of CERT_TS_01_04_BO_AT
             * Expected results:
             *   ensure that
             *     when the IUT is receiving a SecuredMessage
             *       containing header_fields ['signer_info']
             *         containing signer
             *           containing type
             *             indicating 'certificate_chain'
             *           containing certificates[0] (CERT_TS_01_04_BO_AA)
             *             containing version
             *               indicating '1'
             *           and containing certificates[1] (CERT_TS_01_04_BO_AT)
             *             containing signer_info.digest
             *               referencing to CERT_TS_01_04_BO_AA
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_CERT_01_04_BO
             * @reference   ETSI TS 103 097 v1.2.1, clauses 6.1 & 7.4.1
             */
            testcase TC_SEC_ITSS_RCV_CERT_01_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                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();
                if (PICS_DEBUG_ADDON) {
                    f_sendCertificateAndWaitForCertificateChainRequest(cc_taCert_F, f_generateDefaultCam());
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_sendSecuredCam(cc_taCert0104_BO, -, e_certificate_chain);
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // Empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CERT_01_04_BO
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards a SecuredMessage if the issuer certificate of the authorization ticket certificate contains the subject type 'enrolment_credential'
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
filatov's avatar
filatov committed
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the time validity period of CERT_TS_02_01_BO_AT
             * Expected results:
             *   ensure that
             *     when the IUT is receiving a SecuredMessage
             *       containing header_fields ['signer_info']
             *         containing signer
             *           containing type
             *             indicating 'certificate'
             *           and containing certificate (CERT_TS_02_01_BO_AT)
             *             containing signer_info.type
             *               indicating 'certificate_digest_with_sha256'
             *             and containing signer_info.digest
             *               referencing to certificate (CERT_TS_A_EC)
             *                 containing subject_info.subject_type
             *                   indicating 'enrolment_credential'
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_CERT_02_01_BO
             * @reference   ETSI TS 103 097 v1.2.1, clause 6.3
             */
            testcase TC_SEC_ITSS_RCV_CERT_02_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                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
                v_securedGnPdu := f_sendSecuredCam(cc_taCert0201_BO, omit, e_certificate);
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
                    // Empty on purpose 
                }
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CERT_02_01_BO
            
            /**
filatov's avatar
filatov committed
             * @desc  Check that IUT discards a SecuredMessage if the issuer certificate of the authorization authority certificate contains the subject type 'enrolment_credential'
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
filatov's avatar
filatov committed
             *   with
             *     the IUT being in the 'authorized' state
             *     and the IUT current time is inside the time validity period of CERT_TS_02_02_BO_AT
             * Expected results:
             *   ensure that
             *     when the IUT is receiving a SecuredMessage
             *       containing header_fields ['signer_info']
             *         containing signer
             *           containing type
             *             indicating 'certificate_chain'
             *           and containing certificates[0] (CERT_TS_02_02_BO_AA)
             *             containing signer_info.digest
             *               referencing to certificate CERT_TS_A_EC
             *                 containing subject_info.subject_type
             *                   indicating 'enrolment_credential'
             *           and containing certificates[1] (CERT_TS_02_02_BO_AT)
             *             containing signer_info.digest
             *               referencing to CERT_TS_02_02_BO_AA
             *     then
             *       the IUT discards the message
             * </pre>
filatov's avatar
filatov committed
             * @see         ETSI TS 103 096-2 v1.3.1 TP_SEC_ITSS_RCV_CERT_02_02_BO
             * @reference   ETSI TS 103 097 v1.2.1, clause 6.3
             */
            testcase TC_SEC_ITSS_RCV_CERT_02_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                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