ItsSecurity_TestCases.ttcn3 1.4 MB
Newer Older
garciay's avatar
garciay committed
            /**
             * @desc    Check that IUT discards secured message signed with the not yet valid certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *   when {
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A)
             *              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>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_13_01_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.3
garciay's avatar
garciay committed
             */
            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)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
garciay's avatar
garciay committed
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1301_BO));
garciay's avatar
garciay committed
                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
            
            /**
             * @desc    Check that IUT discards secured message signed with the expired certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *   when {
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A)
             *              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 < START_VALIDITY_AT
             *   } then {
             *       the IUT discards the message
             *   }
             * }
             * </pre>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_13_02_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.3
garciay's avatar
garciay committed
             */
            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)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
garciay's avatar
garciay committed
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1302_BO));
garciay's avatar
garciay committed
                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
            
            /**
             * @desc    Check that IUT discards secured message when IUT location is outside the circular validity restriction of the signing certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *   when {
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A)
             *              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>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_13_03_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.3
garciay's avatar
garciay committed
             */
            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)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
garciay's avatar
garciay committed
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1303_BO));
garciay's avatar
garciay committed
                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
            
            /**
             * @desc    Check that IUT discards secured message when IUT location is outside the rectangular validity restriction of the signing certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *   when {
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A)
             *              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 'polygon'
             *                              and containing polygonal_region
             *                                  indicating REGION
             *                                      not containing the CURRENT_IUT_LOCATION
             *   } then {
             *       the IUT discards the message
             *   }
             * }
             * </pre>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_13_04_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.3
garciay's avatar
garciay committed
             */
            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)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
garciay's avatar
garciay committed
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1304_BO));
garciay's avatar
garciay committed
                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
            
            /**
             * @desc    Check that IUT discards secured message when IUT location is outside the polygonal validity restriction of the signing certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *   when {
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A)
             *              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 'rectangle'
             *                              and containing rectanglar_region
             *                                  indicating REGION
             *                                      not containing the CURRENT_IUT_LOCATION
             *   } then {
             *       the IUT discards the message
             *   }
             * }
             * </pre>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_13_05_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.3
garciay's avatar
garciay committed
             */
            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)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
garciay's avatar
garciay committed
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1305_BO));
garciay's avatar
garciay committed
                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
            
            /**
             * @desc    Check that IUT discards secured message when IUT location is outside the identified validity restriction of the signing certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
             * Config Id: CF01
             * Expected behavior:
             * with {
             *   the IUT being in the 'authorized' state
             *   and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * }
             * ensure that {
             *   when {
             *       the IUT is receiving a SecuredMessage (MSG_SEC_RCV_GENMSG_A)
             *              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>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_13_06_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.3
garciay's avatar
garciay committed
             */
            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)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
garciay's avatar
garciay committed
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf02Up();
                
                // Preamble
                
                // Start components
                v_nodeB := f_getComponent(c_compNodeB);
                v_nodeD := f_getComponent(c_compNodeD);
garciay's avatar
garciay committed
                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1306_BO));
garciay's avatar
garciay committed
                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
garciay's avatar
garciay committed
                    f_prNeighbour();
garciay's avatar
garciay committed
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
garciay's avatar
garciay committed
                    
                    // Test Body
garciay's avatar
garciay committed
                    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 {
            
            /**
             * @desc    Check that IUT discards the AT certificate with version 3
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  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
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *              containing header_fields['signer_info'].signer
             *                  containing type
             *                      indicating 'certificate'
             *                  and containing certificate (CERT_TS_01_01_BO_AT)
             *                      containing  version
garciay's avatar
garciay committed
             *                          indicating '3'
garciay's avatar
garciay committed
             *      } then {
             *          the IUT discards  the message
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_01_01_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clauses 6.1 & 7.4.1
garciay's avatar
garciay committed
             */
            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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                }
                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
            
            /**
             * @desc    Check that IUT discards the AT certificate with version 1
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  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
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *              containing header_fields['signer_info'].signer
             *                  containing type
             *                      indicating 'certificate'
             *                  and containing certificate (CERT_TS_01_02_BO_AT)
             *                      containing  version
garciay's avatar
garciay committed
             *                          indicating '1'
garciay's avatar
garciay committed
             *      } then {
             *          the IUT discards  the message
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_01_02_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clauses 6.1 & 7.4.1
garciay's avatar
garciay committed
             */
            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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                }
                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
            
            /**
             * @desc    Check that IUT discards the AA certificate with version 3
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  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
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *              containing header_fields['signer_info'].signer
             *                  containing type
             *                      indicating 'certificate_chain'
             *                  and containing certificate[0] (CERT_TS_01_03_BO_AA)
             *                      containing  version
             *                          indicating '3'
             *                  and containing certificate[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>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_01_03_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clauses 6.1 & 7.4.1
garciay's avatar
garciay committed
             */
            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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                }
                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
            
            /**
             * @desc    Check that IUT discards the AA certificate with version 1
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  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
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *              containing header_fields['signer_info'].signer
             *                  containing type
             *                      indicating 'certificate_chain'
             *                  and containing certificate[0] (CERT_TS_01_04_BO_AA)
             *                      containing  version
             *                          indicating '1'
             *                  and containing certificate[1] (CERT_TS_01_04_BO_AT)
             *                      and containing signer_info.digest
             *                          referencing to CERT_TS_01_04_BO_AA
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_01_04_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clauses 6.1 & 7.4.1
garciay's avatar
garciay committed
             */
            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());
                }
garciay's avatar
garciay committed
                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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                }
                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
            
            /**
             * @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:
             *  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
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *              containing header_fields['signer_info'].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>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_02_01_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 6.3
garciay's avatar
garciay committed
             */
            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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                }
                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
            
            /**
             * @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:
             *  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
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *              containing header_fields['signer_info'].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>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_02_02_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 6.3
garciay's avatar
garciay committed
             */
            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
                v_securedGnPdu := f_sendSecuredCam(cc_taCert0202_BO, omit, 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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                }
                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_02_BO
            
            /**
             * @desc    Check that IUT discards a SecuredMessage if the issuer certificate of the authorization ticket certificate contains the subject type 'enrolment_authority'
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT current time is inside the time validity period of CERT_TS_02_03_BO_AT
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *              containing header_fields['signer_info'].signer
             *                  containing type
             *                      indicating 'certificate'
             *                  and containing certificate (CERT_TS_02_03_BO_AT)
             *                      containing signer_info.type
             *                          indicating 'certificate_digest_with_sha256'
             *                  and containing signer_info.digest
             *                          referencing to certificate (CERT_TS_A_EA)
             *                              containing subject_info.subject_type
             *                                  indicating 'enrolment_authority'
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_02_03_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 6.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_RCV_CERT_02_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_taCert0203_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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                }
                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_03_BO
            
            /**
             * @desc    Check that IUT discards a SecuredMessage if the issuer certificate of the authorization authority certificate contains the subject type 'enrolment_authority'
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT current time is inside the time validity period of CERT_TS_02_04_BO_AT
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *              containing header_fields['signer_info'].signer
             *                  containing type
             *                      indicating 'certificate_chain'
             *                  and containing certificates[0] (CERT_TS_02_04_BO_AA)
             *                      containing signer_info.digest
             *                          referencing to certificate CERT_TS_A_EA
             *                              containing subject_info.subject_type
             *                                  indicating 'enrolment_authority'
             *                  and containing certificates[1] (CERT_TS_02_04_BO_AT)
             *                      containing signer_info.digest
             *                          referencing to CERT_TS_02_04_BO_AA
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_02_04_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 6.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_RCV_CERT_02_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();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_sendSecuredCam(cc_taCert0204_BO, omit, 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) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                }
                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 ***");