ItsSecurity_TestCases.ttcn 1.6 MB
Newer Older
                        log("*** " & testcasename() & ": FAIL: DEN message retransmission with digest ***"); 
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        //repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected DEN message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_09_BV
            
            /**
             * @desc   Check that IUT sends the secured DENM containing generation location which is inside the identified 
             *         region defined by the validity restriction of the root certificate when subordinate AA and AT 
             *         certificates don't contain any region restriction. 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_CERTIFICATE_SELECTION
             * Config Id: CF01
             * Initial conditions:
             * with {
             *   the IUT is authorized with AT certificate (CERT_IUT_CA2_AT)
             *       containing toBeSigned
             *           not containing region
             *           and issuied by the certificate AA (CERT_IUT_CC_AA)
             *               containing toBeSigned
             *                   containing circularRegion
             *                       indicating REGION
             *               and issuied by the certificate RCA (CERT_IUT_C_RCA)
             *                   containing toBeSigned
             *                       containing circularRegion
             *                           indicating REGION
             * }
             * ensure that {
             *   when {
             *       the IUT is requested to send a DENM
             *   } then {
             *       the IUT sends a SecuredMessage of type EtsiTs103097Data
             *           containing headerInfo
             *               containing generationLocation
             *                   indicating value inside the REGION  
             *   }
             * }
             * </pre>
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_10_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.2
             * @reference   IEEE 1609.2 [2], Clauses 5.2.3.2.2 & 6.4.8 
             */
            testcase TC_SEC_ITSS_SND_DENM_10_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var HeaderInfo       v_headerInfo;
                var SignerIdentifier v_signerIdentifier;
                var Certificate      v_at_certificate;
                var Certificate      v_aa_certificate;
                var ItsDenm          v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_CERTIFICATE_SELECTION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_CERTIFICATE_SELECTION' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_readCertificate(cc_taCert_CA2, v_at_certificate);
                f_readCertificate(cc_taCert_CC_AA, v_aa_certificate);
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                                            v_at_certificate.toBeSigned.appPermissions,
                                                                            v_at_certificate.toBeSigned.verifyKeyIndicator,
                                                                            v_at_certificate.toBeSigned.validityPeriod,
                                                                            omit
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if (f_getMsgHeaderInfo(f_getSecuredMessage(v_geoNwInd.msgIn), v_headerInfo)) {
                            var ThreeDLocation v_location := { v_headerInfo.generationLocation.latitude, v_headerInfo.generationLocation.longitude, v_headerInfo.generationLocation.elevation };                            
                            
                            if (f_isLocationInsideRegion(v_at_certificate.toBeSigned.region, v_location) == true) {
                                log("*** " & testcasename() & ": PASS: DENM contains generation location inside the certificate validity region ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                            } else {
                                log("*** " & testcasename() & ": FAIL: DEN message contains generation location outside the certificate validity region ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            }
                        } else {
                            log("*** " & testcasename() & ": FAIL: IMPOSSIBLE!!! DENM generation location or certificate region restriction header field does not exist ***"); 
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        }
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": FAIL: DEN message retransmission with digest ***"); 
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        //repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected DEN message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
garciay's avatar
garciay committed
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_10_BV
            
            /**
             * @desc    Check that IUT sends the secured DENM containing the 'data' field in signed data payload, 
             *          containing the EtsiTs103097Data of type unsecured, contained the DENM payload
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT) 
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a secured DENM
             *      } then {
             *          the IUT sends a message of type EtsiTs103097Data
             *              contains content
             *                  contains signedData
             *                      containing tbsData
             *                          containing payload
             *                              containing data
             *                                  containing content
             *                                      containing unsecuredData
             *                                          containing not-empty data
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_11_BV
             * @reference    ETSI TS 103 097 [1] Clauses 5.2 & 7.1.2
             */
            testcase TC_SEC_ITSS_SND_DENM_11_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload(
                                                mw_ieee1609Dot2Data(
                                                    mw_ieee1609Dot2Data_unsecured
                                            )),
                                            mw_headerInfo_denm
                                        )
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: DENM received with a well formated payload");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": FAIL: DEN message retransmission with digest ***"); 
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        //repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected DEN message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_11_BV
            
            /**
             * @desc    Check that the IUT sends the secured DENM signed with the certificate containing appPermisions 
             *          allowing to sign DEN messages
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT) 
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a secured DENM
             *      } then {
             *          the IUT sends a message of type EtsiTs103097Data
             *              containing signer
             *                 containing certificate
             *                     containing appPermissions
             *                         containing an item of type PsidSsp
             *                             containing psid = AID_DENM 
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_12_BV
             * @reference    ETSI TS 103 097 [1] Clauses 7.1.2
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_DENM_12_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                   [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_certificate( // containing certificate
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
Yann Garcia's avatar
Yann Garcia committed
                                                    { *, mw_appPermissions(c_its_aid_DENM), * }
                        log("*** " & testcasename() & ": PASS: DEN message received with a well formated certificate ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                        log("*** " & testcasename() & ": INFO: DEN message with digest was received ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: DEN message with certificate not received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_12_BV
            
            /**
             * @desc    Check that IUT sends the secured DENM containing signature;
             *          Check that the signature is calculated over the right fields 
             *          and using right hash algorythm by cryptographically verifying the signature
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (X_CERTIFICATE) 
             *          containing verifyKeyIndicator
             *              containing verificationKey
             *                  containing X_KEY
             *                      indicating KEY
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a secured DENM
             *      } then {
             *          the IUT sends a message of type EtsiTs103097Data
             *              containing signedData
             *                  containing signer
             *                       containing certificate
             *                           indicating X_CERTIFICATE
             *                               containing verifyKeyIndicator
             *                                   containing verificationKey
             *                                       containing X_KEY
             *                                           indicating KEY
             *                  and containing signature
             *                      containing X_SIGNATURE
             *                          verifiable using KEY 
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_13_BV
             * @reference    ETSI TS 103 097 [1] Clauses 5.2 & 7.1.2
             * @reference    IEEE 1609.2 [2], Clauses 5.3.1, 6.3.4, 6.3.29, 6.3.30, 6.3.31

             */
            testcase TC_SEC_ITSS_SND_DENM_13_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var EtsiTs103097Certificate v_certificate;
                var Signature               v_signature;
                var GeoNetworkingInd        v_geoNwInd;
                var ItsDenm                 v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_readCertificate(vc_hashedId8ToBeUsed, v_certificate);
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        PICS_CERTFICATES_FOI[PICS_CERTFICATES_VAR].hashAlgorithm, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_certificate( // or containing containing certificate indicating X_CERTIFICATE
                                            v_certificate
                                        )
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: DEN message with certificate received ***");
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": FAIL: DEN message retransmission with digest ***"); 
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        //repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: DEN message with certificate not received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                // Check that the signature is calculated over the right fields and using right hash algorythm by cryptographically verifying the signature
Yann Garcia's avatar
Yann Garcia committed
                if (f_verifyGnSecuredMessageSignatureWithCertificate(f_getSecuredMessage(v_geoNwInd.msgIn), vc_hashedId8ToBeUsed, v_certificate)) {
                    log("*** " & testcasename() & ": PASS: Signature verified successfully ***");
Yann Garcia's avatar
Yann Garcia committed
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                } else {
                    log("*** " & testcasename() & ": FAIL: Signature not verified successfully ***");
Yann Garcia's avatar
Yann Garcia committed
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_13_BV
                            
            /**
             * @desc    Check that IUT doesn't send secured DENMs if IUT doesn't possess an AT certificate allowing 
             *          sending messages in this location. 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_C1_AT)
             *         containing region
             *             indicating rectangular region
             *                 not containing current IUT position
             *         and the IUT has no other installed AT certificates
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a secured DENM
             *     } then {
             *         the IUT doesn't send DENM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_14_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_DENM_14_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_C1_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured DENMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No DENM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_14_BV
            
            /**
             * @desc    Check that IUT doesn't send the secured DENM if IUT is configured to use an AT certificate 
             *          without region validity restriction and generation location is outside of the region of the 
             *          issuing AA certificate. 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_C3_AT)
             *         not containing region
             *         and issued by the AA certificate (CERT_IUT_C3_AA)
             *             containing region
             *                 indicating rectangular region
             *                     not containing current IUT position
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a secured DENM
             *     } then {
             *         the IUT doesn't send DENM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_15_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_DENM_15_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_C3_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured DENMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No DENM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_15_BV
            
            /**
             * @desc    Check that IUT doesn't send secured DENMs if all AT certificates installed on the IUT are expired. 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_A1_AT)
             *         containing validityPeriod
             *             indicating start + duration < CURRENT_TIME
             *         and the IUT has no other installed AT certificates
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a secured DENM
             *     } then {
             *         the IUT doesn't send DENM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_16_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_DENM_16_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_A1_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured DENMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No DENM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_16_BV
            
            /**
             * @desc    Check that IUT doesn't send secured DENMs if all AT certificates installed on the IUT have the starting time in the future. 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_A2_AT)
             *         containing validityPeriod
             *             indicating start > CURRENT_TIME
             *         and the IUT has no other installed AT certificates
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a secured DENM
             *     } then {
             *         the IUT doesn't send DENM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_17_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_DENM_17_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_A2_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured DENMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No DENM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_17_BV
            
            /**
             * @desc    Check that IUT doesn't send secured DENMs if IUT doesn't possess an AT certificate allowing 
             *          sending DENM by its appPermissions. 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_A4_AT)
             *         containing appPermissions
             *             not containing PsidSSP
             *                 containing psid
             *                     indicating AID_CAM
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a secured DENM
             *     } then {
             *         the IUT doesn't send DENM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_18_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_DENM_18_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var ItsDenm v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_A4_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured DENMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No DENM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_DENM_18_BV
            
        } // End of group denmProfile
         * @desc Sending behaviour test cases for DENM profile
garciay's avatar
garciay committed
         * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.2.6 Generic signed message profile
        group genericSignedMessageProfile {
            
            /**
             * @desc    Check that IUT sends the secured message using signedData container.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT)
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT is requested to send a secured Beacon
             *     } then {
             *         the IUT sends a message of type EtsiTs103097Data
             *             containing content 
             *                 containing signedData 
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_GENMSG_01_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.3
             */
            testcase TC_SEC_ITSS_SND_GENMSG_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var LongPosVector v_longPosVectorIut;
                    
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                v_longPosVectorIut := f_getPosition(c_compIut);
                    
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader)); // Authorize the TA to forward the received beacons
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_gn
                                        )
                                    )
                                )
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: The GN message is secured ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_acTriggerEvent(m_stopPassBeaconing);
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_GENMSG_01_BV
            
            /**
             * @desc    Check that the sent Secured Message contains HeaderField its_aid that is set to other value then AID_CAM and AID_DENM.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT)
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT is requested to send a secured Beacon
             *     } then {
             *         the IUT sends a Ieee1609Dot2Data
             *             containing content
             *                 containing signedData
             *                     containing tbsData
             *                         containing headerInfo
             *                             containing psid
             *                                 indicating 'AID_GNMGMT'
             *     }
             * }
             * </pre>
             *