ItsSecurity_TestCases.ttcn 1.59 MB
Newer Older
 *  @author   ETSI / STF481 / STF507 / STF517 / STF538
 *  @version  $URL$
 *            $Id$
 *  @desc     Testcases  file for Security Protocol
filatov's avatar
filatov committed
 *  @reference   ETSI TS 103 097 v1.2.1
garciay's avatar
garciay committed
 *  @copyright   ETSI Copyright Notification
 *               No part may be reproduced except as authorized by written permission.
 *               The copyright and the foregoing restriction extend to reproduction in all media.
 *               All rights reserved.
module ItsSecurity_TestCases {
    
    // Libcommon
    import from LibCommon_Time all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_Sync all;
    import from LibCommon_BasicTypesAndValues all;
    
    // LibIts
    //import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    import from IEEE1609dot2BaseTypes language "ASN.1:1997" all;
    import from IEEE1609dot2 language "ASN.1:1997" all;
    import from EtsiTs103097Module language "ASN.1:1997" all;
    
    // LibItsCommon
    import from LibItsCommon_TypesAndValues all;
    import from LibItsCommon_Functions all;
    import from LibItsCommon_TypesAndValues all;
    import from LibItsCommon_ASN1_NamedNumbers all;
    
    // LibItsGeoNetworking
    import from LibItsGeoNetworking_TestSystem all;
    import from LibItsGeoNetworking_Functions all;
    import from LibItsGeoNetworking_Templates all;
    import from LibItsGeoNetworking_TypesAndValues all;
    import from LibItsGeoNetworking_Pics all;

    // LibItsCam
    import from LibItsCam_Templates all;
    import from LibItsCam_Functions all;
    import from LibItsCam_Templates all;
    import from LibItsCam_Functions all;
    import from LibItsCam_TestSystem all;
    
    // LibItsDenm
    import from LibItsDenm_Templates all;
    import from LibItsDenm_TestSystem all;
    
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues all;
    import from LibItsSecurity_Templates all;
    import from LibItsSecurity_Functions all;
    import from LibItsSecurity_Pixits all;
    import from LibItsSecurity_Pics all;
    
    // AtsSecurity
    import from ItsSecurity_TestSystem all;
    import from ItsSecurity_Functions all;
    import from ItsSecurity_Templates all;
    import from ItsSecurity_Pics all;
    
    /**
     * @desc Sending behaviour test cases
garciay's avatar
garciay committed
     * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.2 Sending behaviour
     */
    group sendingBehavior {

        /**
         * @desc    Check that ITS-S sends a Ieee1609Dot2Data containing protocol version set to 3.
         * <pre>
         * Pics Selection: PICS_GN_SECURITY
         * Config Id: CF01
         * Initial conditions:
         *  with {
         *      the IUT being in the 'authorized' state
         *  }
         * Expected behaviour:
         * ensure that {
         *     when { 
         *         the IUT is requested to send a Ieee1609Dot2Data
         *     } then {
         *         the IUT sends a Ieee1609Dot2Data
         *             containing protocol_version 
         *                 indicating value '3'
         *     }
         * }
         * </pre>
         *
garciay's avatar
garciay committed
         * @see         ETSI TS 103 096-2 v1.3.2 TP_TC_SEC_ITSS_SND_MSG_01_BV
         * @reference   ETSI TS 103 097 [1] Clause 5.1 
         * @reference   IEEE1609.2[2] Clause 6.3.2
         */
        testcase TC_SEC_ITSS_SND_MSG_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
            // Local variables
            var LongPosVector v_longPosVectorIut;
                
            // Test control
garciay's avatar
garciay committed
            if (not(PICS_GN_SECURITY)) {
                log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                stop;
            }
            
            // Test component configuration
            f_cf01Up();
            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
                ))) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: Security protocol version set to 3 ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                }
            } // End of 'alt' statement
            
            // Postamble
            f_acTriggerEvent(m_stopPassBeaconing);
            f_poNeighbour();
            f_cf01Down();
            
        } // End of testcase TC_SEC_ITSS_SND_MSG_01_BV
        
         * @desc Sending behaviour test cases for CAM profile.
garciay's avatar
garciay committed
         * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.2.4 CAM profile
        group camProfile {
             * @desc    Check that IUT sends the secured CAM 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) 
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a secured CAM
             *     } then {
             *         the IUT sends a message of type EtsiTs103097Data
             *             containing content
             *                 containing signedData
             *     }
             * }
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_01_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
             */
            testcase TC_SEC_ITSS_SND_CAM_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
garciay's avatar
garciay committed
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: The CA message is secured");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_01_BV
            
            /**
             * @desc Check that IUT sends the secured CAM containing the HeaderInfo field psid set to 'AID_CAM'.
             * <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 CAM
             *     } then {
             *         the IUT sends a Ieee1609Dot2Data
             *             containing content
             *                 containing signedData
             *                     containing tbsData
             *                         containing headerInfo
             *                             containing psid
             *                                 indicating 'AID_CAM'
             * </pre>
             *
garciay's avatar
garciay committed
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_02_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
             */
            testcase TC_SEC_ITSS_SND_CAM_02_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;                        
garciay's avatar
garciay committed
                        log("*** " & testcasename() & ": PASS: Correct secured packet received");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_02_BV
            
            /**
garciay's avatar
garciay committed
             * @desc Check that IUT sends the secured CAM with the HeaderInfo containing generationTime 
             *       and doesn't containing expiryTime, generationLocation, encryptionKey, p2pcdLearningRequest, missingCrlIdentifier.
             * <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 CAM
             *     } then {
             *         the IUT sends a Ieee1609Dot2Data
             *             containing content
             *                 containing signedData
             *                     containing tbsData
             *                         containing headerInfo
             *                             containing generationTime
             *                             and not containing expiryTime
             *                             and not containing generationLocation, 
             *                             and not containing encryptionKey
             *                             and not containing p2pcdLearningRequest
             *                             and not containing missingCrlIdentifier
             * </pre>
             *
garciay's avatar
garciay committed
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_03_BV
             * @reference    ETSI TS 103 097 [1] Clauses 5.2 & 7.1.1
             */
            testcase TC_SEC_ITSS_SND_CAM_03_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;                        
garciay's avatar
garciay committed
                        log("*** " & testcasename() & ": PASS: Correct secured packet received");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_03_BV
            
            /**
             * @desc Check that IUT sends the secured CAM containing signer containing either certificate or digest;
             *       Check that signing certificate has permissions to sign CAM 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 CAM
             *     } then {
             *         the IUT sends a Ieee1609Dot2Data
             *             containing content
             *                 containing signedData
             *                     containing signer
             *                         containing digest
             *                         or containing certificate
             *                             containing toBeSigned
             *                                 containing appPermissions
             *                                     containing the item of type PsidSsp
             *                                         containing psid
             *                                             indicating AID_CAM
             * </pre>
             *
garciay's avatar
garciay committed
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_04_BV
             * @reference    ETSI TS 103 097 [1] Clauses 5.2 & 7.1.1
             * @reference    IEEE 1609.2 [2] Clause 6.3.4
             */
            testcase TC_SEC_ITSS_SND_CAM_04_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;                        
garciay's avatar
garciay committed
                        log("*** " & testcasename() & ": PASS: Correct secured packet received, containing digest");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate( // or containing certificate
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    { mw_appPermissions(c_its_aid_CAM) }
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;                        
garciay's avatar
garciay committed
                        log("*** " & testcasename() & ": PASS: Correct secured packet received, containing certificate");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_04_BV
            
            /**
             * @desc Check that IUT calculate the digest of certificate using proper hash algorithm;
             *       Check that IUT canonicalize certificates before hash calculation.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and ((PICS_SEC_SHA256 and (PICS_SEC_NIST_P256 or PICS_SEC_BRAINPOOL_P256R1)) or (PICS_SEC_SHA384 and PICS_SEC_BRAINPOOL_P384R1))
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (X_CERTIFICATE) 
             *     and the IUT is configured to send more than one CAM per second
             *     and the IUT having sent a secured CAM
             *         containing signer
             *             containing certificate
             *                 indicating X_CERTIFICATE
             *                     containing verifyKeyIndicator
             *                         containing verificationKey
             *                             containing X_KEY
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a subsequent secured CAM
             *             containing signer
             *                 containing digest
             *     } then {
             *         the IUT sends a Ieee1609Dot2Data
             *             containing content
             *                 containing signedData
             *                     containing signer
             *                         containing digest
             *                             indicating last 8 bytes of the Hash value calculated using X_HASH algorithm
             * </pre>
             *
garciay's avatar
garciay committed
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_05_BV
             * @reference    ETSI TS 103 097 [1] Clauses 5.2 & 7.1.1
             * @reference    IEEE 1609.2 [2] Clause 6.3.4
             */
            testcase TC_SEC_ITSS_SND_CAM_05_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var EtsiTs103097Certificate v_certificate;
                var HashedId8               v_certificate_digest;
                var ItsCam                  v_component;
                
                // Test control
                if (not(PICS_GN_SECURITY and ((PICS_SEC_SHA256 and (PICS_SEC_NIST_P256 or PICS_SEC_BRAINPOOL_P256R1)) or (PICS_SEC_SHA384 and PICS_SEC_BRAINPOOL_P384R1)))) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and ((PICS_SEC_SHA256 and (PICS_SEC_NIST_P256 or PICS_SEC_BRAINPOOL_P256R1)) or (PICS_SEC_SHA384 and PICS_SEC_BRAINPOOL_P384R1))' 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);
                f_getCertificateDigest(vc_hashedId8ToBeUsed, v_certificate_digest);
                geoNetworkingPort.clear;
                v_component := f_setCamFrequencyGreatherThan1Hz();
                tc_ac.start;
                alt {
                    [PICS_SEC_SHA256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        sha256, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                mw_issuerIdentifier_sha256AndDigest(
                                                    v_certificate.issuer.sha256AndDigest
                                                ),
                                                mw_toBeSignedCertificate_at(
                                                    -,
                                                    v_certificate.toBeSigned.verifyKeyIndicator
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [PICS_SEC_SHA384 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        sha384, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                mw_issuerIdentifier_sha384AndDigest(
                                                    v_certificate.issuer.sha384AndDigest
                                                ),
                                                mw_toBeSignedCertificate_at(
                                                    -,
                                                    v_certificate.toBeSigned.verifyKeyIndicator
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with AT certificate received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with AT certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [PICS_SEC_SHA256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        sha256, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest(
                                            v_certificate_digest
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Correct secured CA message received");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_SHA384 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        sha384, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest(
                                            v_certificate_digest
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Correct secured CA message received");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_05_BV
            
garciay's avatar
garciay committed
            /**
             * @desc    Check that IUT sends the secured CAM containing the signing certificate when over the time of one 
             *          second no other secured CAM contained the certificate was sent.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             * with {
             *     the IUT is authorized with AT certificate (CERT_IUT_A_AT) 
             *     and the IUT is configured to send more then one CAM per second
             *     and the IUT having sent a CAM
             *         containing generationTime
             *             indicating TIME_LAST
             *     }
             * ensure that {
             *     when {
             *         the IUT is sending secured CAM as a message of type EtsiTs103097Data
             *             containing signer
             *                 containing signer
garciay's avatar
garciay committed
             *                     containing certificate
garciay's avatar
garciay committed
             *     } then {
             *         this message
             *             contains headerInfo
             *                 containing generation_time
             *                     indicating TIME (TIME >= TIME_LAST + 1sec)
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_06_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_CAM_06_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var ItsCam v_component;
garciay's avatar
garciay committed
                var Time64 v_time_last;
garciay's avatar
garciay committed
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
garciay's avatar
garciay committed
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                geoNetworkingPort.clear;
                v_component := f_setCamFrequencyGreatherThan1Hz();
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
garciay's avatar
garciay committed
                    ))) -> value v_geoNwInd {
garciay's avatar
garciay committed
                        tc_ac.stop;
                        v_time_last := f_getSecuredMessage(v_geoNwInd.msgIn).content.signedData.tbsData.headerInfo.generationTime;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received, TIME_LAST = ", v_time_last, " ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
garciay's avatar
garciay committed
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
garciay's avatar
garciay committed
                        tc_ac.stop;
                        if (ff_abs(int2float(v_geoNwInd.msgIn.gnPacket.securedMsg.content.signedData.tbsData.headerInfo.generationTime - v_time_last)) <= 0.95) {
                            log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate was within a second ***");
garciay's avatar
garciay committed
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                        } else {
garciay's avatar
garciay committed
                            log("*** " & testcasename() & ": FAIL: Generation of CAM messages including certificate was not within a second ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
garciay's avatar
garciay committed
                        }
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: CA message retransmission with digest ***"); 
garciay's avatar
garciay committed
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_06_BV
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT sends the secured CAM containing the signing certificate when the timeout of one second 
garciay's avatar
garciay committed
             *          has been expired after the previous CAM containing the certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT is configured to send more than one CAM per second
             *      and the IUT having sent a CAM
garciay's avatar
garciay committed
             *          containing signer
             *              containing certificate
             *          and containing generationTime
             *             indicating TIME_LAST
garciay's avatar
garciay committed
             *  }
             *  ensure that {
             *      when {
             *          the IUT is sending a CAM
             *              containing header_fields['generation_time']
             *                  indicating TIME >= TIME_LAST + 1sec
             *      } then {
garciay's avatar
garciay committed
             *     when {
             *         the IUT is sending secured CAM as a message of type EtsiTs103097Data
             *             containing generationTime
             *                 indicating TIME (TIME >= TIME_LAST + 1sec) 
             *     } then {
             *         this message is
             *             containing certificate
garciay's avatar
garciay committed
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_07_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_CAM_07_BV() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Local variables
                const integer c_cntTimeLimit := 10;
garciay's avatar
garciay committed
                const float c_certificateGenerationTime := 1.0;                
garciay's avatar
garciay committed
                timer t_maxTransInterval := c_certificateGenerationTime * 1.15;
                var integer v_cntTime := 0;
                var GeoNetworkingInd v_geoNwInd;
                var ItsCam v_component;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
garciay's avatar
garciay committed
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_component := f_setCamFrequencyGreatherThan1Hz();
                geoNetworkingPort.clear;
garciay's avatar
garciay committed
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        t_maxTransInterval.start;
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
garciay's avatar
garciay committed
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        t_maxTransInterval.stop;
                        v_cntTime := v_cntTime + 1;
                        if (v_cntTime == c_cntTimeLimit) { // Exit message loop
                            log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate was successful ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                            // end of alt
                        }
                        else {
                            t_maxTransInterval.start;
                            log("*** " & testcasename() & ": INFO: CA message retransmission with certificate ***"); 
garciay's avatar
garciay committed
                            repeat;
                        }
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: CA message retransmission with digest ***"); 
garciay's avatar
garciay committed
                        repeat;
                    }
                    [] t_maxTransInterval.timeout {
                        log("*** " & testcasename() & ": FAIL: CA message with certificate was not received in 1 sec after previous one ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_07_BV
            
            /**
             * @desc    Check that IUT sends the secured CAM containing the signing certificate when the IUT received 
             *          a CAM from an unknown ITS-S.
garciay's avatar
garciay committed
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT) 
             *      and the IUT is configured to send more than one CAM per second
             *      and the IUT having already sent CAM
garciay's avatar
garciay committed
             *          containing certificate
             *              at TIME_1
             *      and the IUT having received a Ieee1609Dot2Data
             *          containing signedData
garciay's avatar
garciay committed
             *              containing signer
             *                  containing digest
             *                      indicating HashedId8 value
             *                          referenced to unknown certificate (CERT_TS_B_AT)
             *                              at TIME_2 (TIME_1 < TIME_2 < TIME_1+1sec)
garciay's avatar
garciay committed
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send CAM 
             *              at TIME_3 (TIME_1 < TIME_2 < TIME_3 < TIME_1 + 1sec)
garciay's avatar
garciay committed
             *      } then {
             *          the IUT sends a Ieee1609Dot2Data
             *              containing signedData
             *                  containing type 
             *                      containing signer
             *                          containing certificate
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_08_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_CAM_08_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var ItsCam v_component;
                timer t_maxTransInterval := 0.5;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
garciay's avatar
garciay committed
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_component := f_setCamFrequencyGreatherThan1Hz();
                geoNetworkingPort.clear;
garciay's avatar
garciay committed
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received ***");
garciay's avatar
garciay committed
                        
                        // Send secured message from unknown ITS-S
                        geoNetworkingPort.clear;
                        f_sendSecuredCam(cc_taCert_B, valueof(m_headerInfo_cam(-, f_computeGnTimestamp())), valueof(m_signerIdentifier_digest));
                        
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
garciay's avatar
garciay committed
                    }
                }
                
                // Test Body
                t_maxTransInterval.start;
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop; 
                        t_maxTransInterval.stop;
                        log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate was successful ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        repeat;
                    }
                    [] t_maxTransInterval.timeout {
                        log("*** " & testcasename() & ": FAIL: CA message was transmited w/o unrecognized request header ***"); 
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_08_BV
            
garciay's avatar
garciay committed
            /**
             * @desc    Check that IUT restarts the certificate sending timer when the certificate has been sent.
garciay's avatar
garciay committed
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state (CERT_IUT_A_AT) 
             *      and the IUT is configured to send more then one CAM per second
             *      and the IUT having already sent CAM at TIME_1
             *          containing signer
             *              containing certificate
             *      and the IUT having received a CAM at TIME_2 (TIME_1 + 0.3sec)
             *          containing signer
             *              containing digest
             *                  containing HashedId8 value
             *                      indicating ann unknown certificate
             *      and the IUT having sent CAM at TIME_3 (TIME_3 > TIME_2)
             *          containing signer
             *              containing certificate
             *  }
             *  ensure that {
             *      when {
             *          the IUT is sending the next CAM at TIME_4
             *              containing signer
             *                  containing certificate
             *      } then {
             *          the difference between TIME_4 and TIME_3 is about of 1sec
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_09_TI
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_CAM_09_TI() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                const float c_certificateGenerationTime := 1.0;
                
                timer t_maxTransInterval := c_certificateGenerationTime * 0.9;
                var GeoNetworkingInd v_geoNwInd;
                var SignerIdentifier v_signerIdentifier;
garciay's avatar
garciay committed
                var ItsCam v_component;
                var boolean v_firstCertReceived := false;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ": ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
garciay's avatar
garciay committed
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_component := f_setCamFrequencyGreatherThan1Hz();
                geoNetworkingPort.clear;
garciay's avatar
garciay committed
                tc_ac.start;
                alt {
                    [v_firstCertReceived == false] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        log("*** " & testcasename() & ": INFO: Initial conditions: The first CAM with certificate is received ***");
                        v_firstCertReceived := true;
                        f_sleep(0.3);
                        // Send secured message with request for unrecognized certificate
                        f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier);
garciay's avatar
garciay committed
                        f_sendSecuredCam(
                            cc_taCert_F,
                            valueof(m_headerInfo_cam(-, f_computeGnTimestamp())),
                            valueof(
                                m_signerIdentifier_digest(
                                    f_calculateDigestFromCertificate(
                                        v_signerIdentifier.certificate[0]
garciay's avatar
garciay committed
                                    )
                                )
                            )
                        );
                        repeat;
                    }
                    [v_firstCertReceived == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        // start a timeout of one second to check
                        // that the next cert will be received after this timeout
                        t_maxTransInterval.start;
                        log("*** " & testcasename() & ": INFO: Initial conditions: The requested CAM with certificate is received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
garciay's avatar
garciay committed
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        t_maxTransInterval.stop;
                        log("*** " & testcasename() & ": FAIL: CA message certificate inclusion time wasn't restarted ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: CA message retransmission w/o certificate ***"); 
garciay's avatar
garciay committed
                        repeat;
                    }
                    [] t_maxTransInterval.timeout {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: The CAM certificate inclusion timer has been restarted ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_09_TI
            
            /**
             * @desc    Check that the IUT sends certificate request when it receives secured CAM containing 
             *          digest of unknown certificate as a message signer.  
             * <pre>
             * Pics Selection: PICS_GN_SECURITY, PICS_SEC_P2P_AT_DISTRIBUTION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT)
             *      and the IUT has receiving a EtsiTs103097Data
garciay's avatar
garciay committed
             *          containing signer
             *              containing digest
             *                  indicating HashedId8 value DIGEST_A
             *                      referencing an unknown certificate (CERT_TS_B_AT)
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a secured CAM
             *      } then {
             *          the IUT sends a Ieee1609Dot2Data
             *              containing headerInfo
             *                  containing inlineP2pcdRequest
             *                      containing HashedId3 value
             *                          indicating last 3 octets of DIGEST_A
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_10_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
             *               IEEE 1609.2 [2], Clauses 6.3.9 & 8.2.4.1.2
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_CAM_10_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var HashedId8 v_hashedId8;
                var HashedId3 v_expectedHashedId3;
                var ItsCam v_component;
                timer t_maxTransInterval := 0.5;
garciay's avatar
garciay committed
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_P2P_AT_DISTRIBUTION)) {
                    log("*** " & testcasename() & ": ERROR: 'PICS_GN_SECURITY and PICS_SEC_P2P_AT_DISTRIBUTION' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();  // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
garciay's avatar
garciay committed

                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_getCertificateDigest(
                    cc_taCert_B,
                    v_hashedId8
                );
                v_expectedHashedId3 := f_HashedId3FromHashedId8(v_hashedId8);
                geoNetworkingPort.clear;
                v_component := f_setCamFrequencyGreatherThan1Hz();
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received ***");
                        
                        // Send secured message from unknown ITS-S
                        geoNetworkingPort.clear;
                        f_sendSecuredCam(
                            cc_taCert_B, // SHA-256/NIST P-256
                            valueof(m_headerInfo_cam(-, f_computeGnTimestamp())),
                            valueof(
                                m_signerIdentifier_digest(
                                    v_hashedId8
                                )
                            )
                        );
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                } // End of 'alt' statement
garciay's avatar
garciay committed
                
                // Test Body
                t_maxTransInterval.start;
garciay's avatar
garciay committed
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam(
garciay's avatar
garciay committed
                                                { v_expectedHashedId3 }
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate request was successful ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
garciay's avatar
garciay committed
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        repeat;
                    }
                    [] t_maxTransInterval.timeout {
                        log("*** " & testcasename() & ": FAIL: CAM was transmited w/o unrecognized request header ***"); 
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
garciay's avatar
garciay committed
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
garciay's avatar
garciay committed
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_10_BV
            
            /**
             * @desc    Check that the IUT sends certificate request when it receives secured CAM 
             *          containing certificate signed by unknown AA certificate.  
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_P2P_AT_DISTRIBUTION and (PICS_SEC_SHA256 or PICS_SEC_SHA384)
garciay's avatar
garciay committed
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT)
             *      and the IUT has receiving a CAM
             *          containing signer
             *              containing digest
             *                  indicating HashedId8 value DIGEST_A
             *                      referencing an unknown certificate (CERT_TS_B_AT)
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a secured CAM
             *      } then {
             *          the IUT sends a Ieee1609Dot2Data
             *              containing headerInfo
             *                  containing inlineP2pcdRequest
             *                      containing HashedId3 value
             *                          indicating last 3 octets of DIGEST_A
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_11_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
             *               IEEE 1609.2 [2], Clauses 6.3.9 & 8.2.4.1.2
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_CAM_11_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var HashedId8 v_hashedId8;
                var HashedId3 v_expectedHashedId3;
                var ItsCam v_component;
garciay's avatar
garciay committed
                
                // Test control
                if (not(PICS_GN_SECURITY and PICS_SEC_P2P_AT_DISTRIBUTION and (PICS_SEC_SHA256 or PICS_SEC_SHA384))) {
                    log("*** " & testcasename() & ": ERROR: 'PICS_GN_SECURITY and PICS_SEC_P2P_AT_DISTRIBUTION and (PICS_SEC_SHA256 or PICS_SEC_SHA384)' required for executing the TC ***");
garciay's avatar
garciay committed
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
garciay's avatar
garciay committed

                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                if (PICS_SEC_SHA256 == true) {
garciay's avatar
garciay committed
                    f_getCertificateDigest(
                        cc_taCert_B,
                        v_hashedId8
                    );
                } else if (PICS_SEC_SHA384 == true) {
garciay's avatar
garciay committed
                    f_getCertificateDigest(
                        cc_taCert_B1, // FIXME Create certificate SHA-384 / NIST P-256
                        v_hashedId8
                    );
                }
                v_expectedHashedId3 := f_HashedId3FromHashedId8(v_hashedId8);
                geoNetworkingPort.clear;
                v_component := f_setCamFrequencyGreatherThan1Hz();
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received ***");
                        
                        // Send secured message from unknown ITS-S
                        geoNetworkingPort.clear;
                        f_sendSecuredCam(
                            cc_taCert_B,
                            valueof(m_headerInfo_cam(-, f_computeGnTimestamp())),
                            valueof(
                                m_signerIdentifier_digest(
                                    v_hashedId8
                                )
                            )
                        );
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                } // End of 'alt' statement;
garciay's avatar
garciay committed
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam(
                                                -,
                                                -,
                                                { v_expectedHashedId3 }
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate request was successful ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: CA message retransmission w/o certificate request ***"); 
garciay's avatar
garciay committed
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
garciay's avatar
garciay committed
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_11_BV
            
            /**
             * @desc    Check that IUT sends the secured CAM containing the signing certificate when it received 
             *          a CAM containing a request for unrecognized certificate that matches with the currently 
             *          used AT certificate ID of the IUT.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY, PICS_SEC_P2P_AT_DISTRIBUTION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT) 
             *      and the IUT is configured to send more than one CAM per second
             *      and the IUT having already sent a CAM
             *          containing signer
             *              containing certificate
             *          at TIME_1
             *      and the IUT having received a CAM
             *          containing inlineP2pcdRequest
             *              containing HashedId3 value
             *                  indicating last 3 octets of currently used AT certificate
garciay's avatar
garciay committed
             *          at TIME_2 (TIME_1 < TIME_2 < TIME_1 + 1sec)
garciay's avatar
garciay committed
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a CAM
garciay's avatar
garciay committed
             *              at TIME_3 (TIME_1 < TIME_2 < TIME_3 < TIME_1 + 1sec)
garciay's avatar
garciay committed
             *      } then {
             *          the IUT sends a CAM
garciay's avatar
garciay committed
             *              containing signer
             *               and containing certificate
             *                   referenced by the requested digest 
garciay's avatar
garciay committed
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_12_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
             *               IEEE 1609.2 [2], Clauses 6.3.9 & 8.2.4.2.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_CAM_12_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                const float c_certificateGenerationTime := 1.0;
                
                timer t_maxTransInterval := c_certificateGenerationTime * 0.9;
                var GeoNetworkingInd v_geoNwInd;
                var ItsCam v_component;
                var HashedId8 v_hashedId8;
                                
                // Test control
garciay's avatar
garciay committed
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_P2P_AT_DISTRIBUTION)) {
                    log("*** " & testcasename() & ": ERROR: 'PICS_GN_SECURITY and PICS_SEC_P2P_AT_DISTRIBUTION' required for executing the TC ***");
garciay's avatar
garciay committed
                    stop;
                }
                
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
garciay's avatar
garciay committed
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
garciay's avatar
garciay committed
                f_getCertificateDigest(
                    cc_taCert_A,
                    v_hashedId8
                );
garciay's avatar
garciay committed
                geoNetworkingPort.clear;
                v_component := f_setCamFrequencyGreatherThan1Hz();
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        t_maxTransInterval.start;
                        
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received ***");
garciay's avatar
garciay committed
                                                
                        // Send secured message with request for the currently used AT certificate
                        f_sendSecuredCam(
                            cc_taCert_A,
                            valueof(
                                m_headerInfo_cam(
                                    -, 
                                    f_computeGnTimestamp(),
                                    -,
                                    { f_HashedId3FromHashedId8(v_hashedId8) }
                            )),
                            valueof(
                                m_signerIdentifier_digest(
                                    v_hashedId8
                                )
                            )
                        );
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
garciay's avatar
garciay committed
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        var SignerIdentifier v_signerIdentifier;
                        var SequenceOfCertificate v_certificates;
                        var integer v_certificatesLength;
                        
                        tc_ac.stop; 
                        t_maxTransInterval.stop;
                        // Extract certificate chain
                        f_getMsgSignerIdentifier(v_geoNwInd.msgIn.gnPacket.securedMsg, v_signerIdentifier);
                        v_certificates := v_signerIdentifier.certificate;
                        v_certificatesLength := lengthof(v_certificates);
                        if (v_certificatesLength == 1) {
                            // Check reference
                            if (f_calculateDigestFromCertificate(v_certificates[0]) == v_hashedId8) {
                                log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                            } else {
                                log("*** " & testcasename() & ": FAIL: Wrong certificate reference ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); 
                            }
                        } else {
                            log("*** " & testcasename() & ": FAIL: Unexpected certificate content ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); 
                        }
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: CA message retransmission w/o certificate ***"); 
garciay's avatar
garciay committed
                        repeat;
                    }
                    [] t_maxTransInterval.timeout {
                        tc_ac.stop; 
                        log("*** " & testcasename() & ": FAIL: The certificate chain has not been received during 1 sec ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_12_BV
            
garciay's avatar
garciay committed
            /**
             * @desc    Check that IUT sends the secured CAM containing the AA certificate in the requestedCertificate 
             *          headerInfo field when it received a CAM containing a request for unrecognized certificate that 
             *          matches with the currently used AA certificate ID of the IUT.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY, PICS_SEC_P2P_AT_DISTRIBUTION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT) 
             *          issued by the AA certificate (CERT_IUT_A_AA)
             *      and the IUT is configured to send more than one CAM per second
             *      and the IUT having already sent a CAM
             *          containing signer
             *              containing certificate
             *          at TIME_1
             *      and the IUT having received a CAM
             *          containing inlineP2pcdRequest
             *              containing HashedId3 value
             *                  indicating last 3 octets of the digest of CERT_IUT_A_AA
garciay's avatar
garciay committed
             *          at TIME_2 (TIME_1 < TIME_2 < TIME_1 + 1sec)
garciay's avatar
garciay committed
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a CAM
garciay's avatar
garciay committed
             *              at TIME_3 (TIME_1 < TIME_2 < TIME_3 < TIME_1 + 1sec)
garciay's avatar
garciay committed
             *      } then {
             *          the IUT sends a CAM
             *              containing headerInfo
             *               and containing the requestedCertificate
             *                   indicating requested AA certificate CERT_IUT_A_AA 
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_13_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
             *               IEEE 1609.2 [2], Clauses 6.3.9 & 8.2.4.2.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_CAM_13_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                const float c_certificateGenerationTime := 1.0;
                
                timer t_maxTransInterval := c_certificateGenerationTime * 0.9;
                var GeoNetworkingInd v_geoNwInd;
                var ItsCam v_component;
                var Certificate v_aa_certificate;
                var HashedId8 v_hashedId8;
                                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_P2P_AT_DISTRIBUTION)) {
                    log("*** " & testcasename() & ": ERROR: 'PICS_GN_SECURITY and PICS_SEC_P2P_AT_DISTRIBUTION' 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();
                f_readCertificate(cc_taCert_AA, v_aa_certificate);
                f_getCertificateDigest(
                    cc_taCert_AA,
                    v_hashedId8
                );
                geoNetworkingPort.clear;
                v_component := f_setCamFrequencyGreatherThan1Hz();
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        t_maxTransInterval.start;
                        
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received ***");
garciay's avatar
garciay committed
                                                
                        // Send secured message with request for the currently used AT certificate
                        f_sendSecuredCam(
                            cc_taCert_A,
                            valueof(
                                m_headerInfo_cam(
                                    -, 
                                    f_computeGnTimestamp(),
                                    -,
                                    { f_HashedId3FromHashedId8(v_hashedId8) }
                            )),
                            valueof(
                                m_signerIdentifier_digest(
                                    v_hashedId8
                                )
                            )
                        );
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
garciay's avatar
garciay committed
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam(
                                                -, -, -,
garciay's avatar
garciay committed
                                                v_aa_certificate
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop; 
                        t_maxTransInterval.stop;
                        log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: CA message retransmission w/o certificate ***"); 
garciay's avatar
garciay committed
                        repeat;
                    }
                    [] t_maxTransInterval.timeout {
                        tc_ac.stop; 
                        log("*** " & testcasename() & ": FAIL: The certificate chain has not been received during 1 sec ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_13_BV
            
            /**
             * @desc    Check that IUT sends the secured CAM containing the AA certificate in the requestedCertificate headerInfo 
             *          field when it received a CAM containing a request for unrecognized certificate that matches with the known 
             *          AA certificate ID which is not currently used by the IUT.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY, PICS_SEC_P2P_AA_DISTRIBUTION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT)
             *      and the IUT is configured to send more than one CAM per second
             *      and the IUT is configured to know the AA certificate (CERT_TS_B_AA)
             *      and the IUT having already sent a CAM
             *          containing signer
             *              containing certificate
             *          at TIME_1
             *      and the IUT having received a CAM
             *          containing inlineP2pcdRequest
             *              containing HashedId3 value
             *                  indicating last 3 octets of the digest of CERT_TS_B_AA
             *                      which is not an issuer of currently used AT certificate
garciay's avatar
garciay committed
             *          at TIME_2 (TIME_1 < TIME_2 < TIME_1 + 1sec)
garciay's avatar
garciay committed
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a CAM
garciay's avatar
garciay committed
             *              at TIME_3 (TIME_1 < TIME_2 < TIME_3 < TIME_1 + 1sec)
garciay's avatar
garciay committed
             *      } then {
             *          the IUT sends a SecuredMessage of type EtsiTs103097Data
             *              containing headerInfo
             *                  containing the requestedCertificate
             *                      indicating requested AA certificate CERT_TS_B_AA 
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_14_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
             *               IEEE 1609.2 [2], Clauses 6.3.9 & 8.2.4.2.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_CAM_14_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                const float c_certificateGenerationTime := 1.0;
                
                timer t_maxTransInterval := c_certificateGenerationTime * 0.9;
                var GeoNetworkingInd v_geoNwInd;
                var ItsCam v_component;
                var Certificate v_aa_certificate;
                var HashedId8 v_hashedId8;
                                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_P2P_AA_DISTRIBUTION)) {
                    log("*** " & testcasename() & ": ERROR: 'PICS_GN_SECURITY and PICS_SEC_P2P_AA_DISTRIBUTION' 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();
                f_readCertificate(cc_taCert_B_AA, v_aa_certificate);
                f_getCertificateDigest(
                    cc_taCert_B_AA,
                    v_hashedId8
                );
                geoNetworkingPort.clear;
                v_component := f_setCamFrequencyGreatherThan1Hz();
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        t_maxTransInterval.start;
                        
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received ***");
garciay's avatar
garciay committed
                                                
                        // Send secured message with request for the currently used AT certificate
                        f_sendSecuredCam(
                            cc_taCert_A,
                            valueof(
                                m_headerInfo_cam(
                                    -, 
                                    f_computeGnTimestamp(),
                                    -,
                                    { f_HashedId3FromHashedId8(v_hashedId8) }
                            )),
                            valueof(
                                m_signerIdentifier_digest(
                                    v_hashedId8
                                )
                            )
                        );
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
garciay's avatar
garciay committed
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam(
                                                -, -, -,
garciay's avatar
garciay committed
                                                v_aa_certificate
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop; 
                        t_maxTransInterval.stop;
                        log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] t_maxTransInterval.timeout {
                        tc_ac.stop; 
                        log("*** " & testcasename() & ": FAIL: The certificate chain has not been received during 1 sec ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_14_BV
            
            /**
             * @desc    Check that the IUT doesn't send a secured CAM containing the AA certificate in the requestedCertificate 
             *          headerInfo field when it was previously requested and already received from another ITS-S.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY, PICS_SEC_P2P_AA_DISTRIBUTION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT) 
             *          issued by the AA certificate (CERT_IUT_A_AA)
             *      and the IUT is configured to send more than one CAM per second
             *      and the IUT having already sent a CAM
             *          containing signer
             *              containing certificate
             *          at TIME_1
             *      and the IUT having received a CAM
             *          containing inlineP2pcdRequest
             *              containing HashedId3 value
             *                  indicating last 3 octets of the digest of CERT_IUT_A_AA
garciay's avatar
garciay committed
             *          at TIME_2 (TIME_1 < TIME_2 < TIME_1 + 0.8sec)
garciay's avatar
garciay committed
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a secured CAM
garciay's avatar
garciay committed
             *              at TIME_3 (TIME_1 < TIME_2 < TIME_3 < TIME_1 + 0.9sec)
garciay's avatar
garciay committed
             *      } then {
             *          the IUT sends a SecuredMessage of type EtsiTs103097Data
             *              containing headerInfo
             *                  does not containing requestedCertificate 
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_15_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
             *               IEEE 1609.2 [2], Clauses 6.3.9 & 8.2.4.2.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_CAM_15_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                const float c_certificateGenerationTime := 0.8;
                
                timer t_maxTransInterval := c_certificateGenerationTime * 0.9;
                var GeoNetworkingInd v_geoNwInd;
                var ItsCam v_component;
                var Certificate v_aa_certificate;
                var HashedId8 v_hashedId8;
                                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_P2P_AA_DISTRIBUTION)) {
                    log("*** " & testcasename() & ": ERROR: 'PICS_GN_SECURITY and PICS_SEC_P2P_AA_DISTRIBUTION' 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();
                f_readCertificate(cc_taCert_AA, v_aa_certificate);
                f_getCertificateDigest(
                    cc_taCert_AA,
                    v_hashedId8
                );
                geoNetworkingPort.clear;
                v_component := f_setCamFrequencyGreatherThan1Hz();
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        t_maxTransInterval.start;
                        
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received ***");
garciay's avatar
garciay committed
                                                
                        // Send secured message with request for the currently used AT certificate
                        f_sendSecuredCam(
                            cc_taCert_A,
                            valueof(
                                m_headerInfo_cam(
                                    -, 
                                    f_computeGnTimestamp(),
                                    -,
                                    { f_HashedId3FromHashedId8(v_hashedId8) }
                            )),
                            valueof(
                                m_signerIdentifier_digest(
                                    v_hashedId8
                                )
                            )
                        );
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
garciay's avatar
garciay committed
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop; 
                        t_maxTransInterval.stop;
                        log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] t_maxTransInterval.timeout {
                        tc_ac.stop; 
                        log("*** " & testcasename() & ": FAIL: The certificate chain has not been received during 1 sec ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_15_BV
            
            /**
             * @desc    Check that the IUT doesn't send a secured CAM containing the AA certificate in the requestedCertificate 
             *          headerInfo field when it contains certificate in the signer field.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY, PICS_SEC_P2P_AA_DISTRIBUTION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT) 
             *          issued by the AA certificate (CERT_IUT_A_AA)
             *      and the IUT is configured to send more than one CAM per second
             *      and the IUT having already sent a CAM
             *          containing signer
             *              containing certificate
             *          at TIME_1
             *      and the IUT having received a CAM
             *          containing inlineP2pcdRequest
             *              containing HashedId3 value
             *                  indicating last 3 octets of the digest of CERT_IUT_A_AA
garciay's avatar
garciay committed
             *          at TIME_2 (TIME_1 < TIME_2 < TIME_1 + 0.9sec)
garciay's avatar
garciay committed
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a secured CAM
garciay's avatar
garciay committed
             *              at TIME_3 (TIME_1 < TIME_2 < TIME_3 < TIME_1 + 1sec)
garciay's avatar
garciay committed
             *      } then {
             *          the IUT sends a SecuredMessage of type EtsiTs103097Data
             *              containing headerInfo
             *                  does not containing requestedCertificate 
             *              and containing signer
             *                  containing certificate
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_16_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
             *               IEEE 1609.2 [2], Clauses 6.3.9 & 8.2.4.2.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_CAM_16_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                const float c_certificateGenerationTime := 0.8;
                
                timer t_maxTransInterval := c_certificateGenerationTime * 0.9;
                var GeoNetworkingInd v_geoNwInd;
                var ItsCam v_component;
                var Certificate v_aa_certificate;
                var HashedId8 v_hashedId8;
                                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_P2P_AA_DISTRIBUTION)) {
                    log("*** " & testcasename() & ": ERROR: 'PICS_GN_SECURITY and PICS_SEC_P2P_AA_DISTRIBUTION' 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();
                f_readCertificate(cc_taCert_AA, v_aa_certificate);
                f_getCertificateDigest(
                    cc_taCert_AA,
                    v_hashedId8
                );
                geoNetworkingPort.clear;
                v_component := f_setCamFrequencyGreatherThan1Hz();
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        t_maxTransInterval.start;
                        
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received ***");
garciay's avatar
garciay committed
                                                
                        // Send secured message with request for the currently used AT certificate
                        f_sendSecuredCam(
                            cc_taCert_A,
                            valueof(
                                m_headerInfo_cam(
                                    -, 
                                    f_computeGnTimestamp(),
                                    -,
                                    { f_HashedId3FromHashedId8(v_hashedId8) }
                            )),
                            valueof(
                                m_signerIdentifier_digest(
                                    v_hashedId8
                                )
                            )
                        );
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
garciay's avatar
garciay committed
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop; 
                        t_maxTransInterval.stop;
                        log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: CA message retransmission w/o certificate ***"); 
garciay's avatar
garciay committed
                        repeat;
                    }
                    [] t_maxTransInterval.timeout {
                        tc_ac.stop; 
                        log("*** " & testcasename() & ": FAIL: The certificate chain has not been received during 1 sec ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_16_BV
            
garciay's avatar
garciay committed
            /**
             * @desc    Check that the IUT send a secured CAM containing the AA certificate in the 
             *          requestedCertificate headerInfo field with the next CAM containing digest 
             *          as a signer info.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY, PICS_SEC_P2P_AA_DISTRIBUTION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT) 
             *          issued by the AA certificate (CERT_IUT_A_AA)
             *      and the IUT is configured to send more than one CAM per second
             *      and the IUT having already sent a CAM
             *          containing signer
             *              containing certificate
             *          at TIME_1
             *      and the IUT having received a CAM
             *          containing inlineP2pcdRequest
             *              containing HashedId3 value
             *                  indicating last 3 octets of the digest of CERT_IUT_A_AA
             *          at TIME_2 (TIME_1 < TIME_2 < TIME_1 + 1sec)
             *  }
             *  ensure that {
             *      when {
             *          the IUT is sending a first subsequent secured CAM
             *              containing signer
             *                  containing digest
             *      } then {
             *          this message
             *              containing headerInfo
             *                  containing requestedCertificate 
             *                      indicating requested AA certificate CERT_IUT_A_AA
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_17_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.1
             *               IEEE 1609.2 [2], Clauses 6.3.9 & 8.2.4.2.3
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_CAM_17_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var ItsCam v_component;
                var Certificate v_aa_certificate;
                var HashedId8 v_hashedId8;
                                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_P2P_AA_DISTRIBUTION)) {
                    log("*** " & testcasename() & ": ERROR: 'PICS_GN_SECURITY and PICS_SEC_P2P_AA_DISTRIBUTION' 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();
                f_readCertificate(cc_taCert_AA, v_aa_certificate);
                f_getCertificateDigest(
                    cc_taCert_AA,
                    v_hashedId8
                );
                geoNetworkingPort.clear;
                v_component := f_setCamFrequencyGreatherThan1Hz();
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received ***");
garciay's avatar
garciay committed
                                                
                        // Send secured message with request for the currently used AT certificate
                        f_sendSecuredCam(
                            cc_taCert_A,
                            valueof(
                                m_headerInfo_cam(
                                    -, 
                                    f_computeGnTimestamp(),
                                    -,
                                    { f_HashedId3FromHashedId8(v_hashedId8) }
                            )),
                            valueof(
                                m_signerIdentifier_digest(
                                    v_hashedId8
                                )
                            )
                        );
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
garciay's avatar
garciay committed
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam(
                                                -, -, -,
garciay's avatar
garciay committed
                                                v_aa_certificate
                                            )
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop; 
                        log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_terminateCam(v_component);
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_17_BV
            
            /**
             * @desc   Check that IUT sends the secured CAM containing generation time and this time is inside the validity period of the signing certificate;
             *         Check that message generation time value is realistic 
             * <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 CAM
             *   } then {
             *       the IUT sends a SecuredMessage of type EtsiTs103097Data
             *           containing headerInfo
             *               containing generationTime
             *                   indicating TIME_1 (CUR_TIME - 5min <= TIME_1 <= CUR_TIME + 5min)
             *           and containing signer
             *               containing certificate
             *                   containing toBeSigned
             *                       containing validityPeriod
             *                           containing start
             *                               indicating value X_START_VALIDITY (X_START_VALIDITY <= GEN_TIME)
             *                           and containing duration
             *                               indicating value > GEN_TIME - X_START_VALIDITY 
             *   }
             * }
             * </pre>
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_18_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.1
             * @reference   IEEE 1609.2 [2], Clauses 5.2.3.2.2, 5.2.4.2.2, 5.2.4.2.3  
             */
            testcase TC_SEC_ITSS_SND_CAM_18_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                const integer        c_timeLimit := 5 * 60 * 1000000; // us
                var GeoNetworkingInd v_geoNwInd;
                var HeaderInfo       v_headerInfo;
                var Time64           v_generationTime;
                var Time64           v_curTime;
                var SignerIdentifier v_signerIdentifier;
                var ValidityPeriod   v_validityPeriod;
                var Certificate      v_cert;
                
                // 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();
                geoNetworkingPort.clear;
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CA message with certificate received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        f_getMsgHeaderInfo(f_getSecuredMessage(v_geoNwInd.msgIn), v_headerInfo);
                        v_generationTime := v_headerInfo.generationTime;
                        v_curTime := f_getCurrentTime();
                        v_curTime := v_curTime * 1000; // Time64 is in microseconds 
                        log("v_curTime (us)=", v_curTime);
                        // Check generation time
                        if (not match(v_generationTime, Time64:(v_curTime - c_timeLimit, v_curTime + c_timeLimit))) {
                            log("*** " & testcasename() & ": FAIL: CA message generation time is not in 5 min range");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        } else {
                            // Check certificate validity period
                            f_getMsgSignerIdentifier (f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier);
                            if (not match(v_signerIdentifier.certificate[0].toBeSigned.validityPeriod.start_, Time32:(v_curTime - c_timeLimit, v_curTime + c_timeLimit))) {
                                log("*** " & testcasename() & ": FAIL: CA message certificate validity period is not in 5 min range");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            } else {
                                log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate was successful ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                            }
                        }
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: CA message retransmission with digest ***"); 
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_18_BV
            
            /**
             * @desc    Check that IUT sends the secured CAM containing the 'data' field in signed data payload, 
             *          containing the EtsiTs103097Data of type unsecured, contained the CAM 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 CAM
             *      } 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_CAM_19_BV
             * @reference    ETSI TS 103 097 [1] Clauses 5.2 & 7.1.1
             */
            testcase TC_SEC_ITSS_SND_CAM_19_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload(
                                                mw_ieee1609Dot2Data(
                                                    mw_ieee1609Dot2Data_unsecured
                                            )),
                                            mw_headerInfo_cam
                                        )
                                    )
                                )
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CAM received with a well formated payload ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_19_BV
            
            /**
             * @desc    Check that the IUT sends the secured CAM signed with the certificate containing appPermisions 
             *          allowing to sign CA 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 CAM
             *      } then {
             *          the IUT sends a message of type EtsiTs103097Data
             *              containing signer
             *                 containing certificate
             *                     containing appPermissions
             *                         containing an item of type PsidSsp
             *                             containing psid = AID_CAM 
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_20_BV
             * @reference    ETSI TS 103 097 [1] Clauses 7.2.1
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_CAM_20_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate( // containing certificate
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    { mw_appPermissions(c_its_aid_CAM) }
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CAM 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_cam
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                                )
                    ))) {
                        log("*** " & testcasename() & ": INFO: CA message with digest was received ***");
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
                    }
                    
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_20_BV
            
            /**
             * @desc    Check that IUT sends the secured CAM 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) 
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a secured CAM
             *      } then {
             *          the IUT sends a message of type EtsiTs103097Data
             *              containing signedData
             *                  containing signer
             *                       containing digest
             *                           referencing the certificate X_CERTIFICATE
             *                       or containing certificate
             *                           indicating X_CERTIFICATE
             *                  and containing signature
             *                      containing X_SIGNATURE
             *                          verifiable using KEY 
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_21_BV
             * @reference    ETSI TS 103 097 [1] Clauses 5.2 & 7.1.1
             * @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_CAM_21_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var EtsiTs103097Certificate v_certificate;
                var Signature               v_signature;
                var GeoNetworkingInd        v_geoNwInd;
                
                // 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);
                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_cam
                                        ),
                                        mw_signerIdentifier_digest( // containing digest referencing the certificate X_CERTIFICATE
                                            PICS_CERTFICATES_FOI[PICS_CERTFICATES_VAR].issuer
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: CA message with digest received ***");
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        PICS_CERTFICATES_FOI[PICS_CERTFICATES_VAR].hashAlgorithm, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate( // or containing containing certificate indicating X_CERTIFICATE
                                            v_certificate
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: CA message with certificate received ***");
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(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
                if (f_verifyGnSecuredMessageSignatureWithCertificate(f_getSecuredMessage(v_geoNwInd.msgIn), v_certificate)) {
                    log("*** " & testcasename() & ": PASS: Signature verified successfully ***");
                    f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                } else {
                    log("*** " & testcasename() & ": FAIL: Signature not verified successfully ***");
                    f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_21_BV
            
            /**
             * @desc    Check that IUT sends the secured CAM containing  signature containing the ECC point of type set to 
             *          either compressed_lsb_y_0, compressed_lsb_y_1 or x_coordinate_only.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (X_CERTIFICATE) 
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a secured CAM
             *      } then {
             *          the IUT sends a message of type EtsiTs103097Data
             *              containing signedData
             *                  containing signature
             *                      containing one of the ecdsaNistP256Signature
             *                      or containing ecdsaBrainpoolP256r1Signature
             *                      or containing ecdsaBrainpoolP384r1Signature
             *                          containing rSig
             *                              containing x-only 
             *                              or containing compressed-y-0
             *                              or containing compressed-y-1
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_22_BV
             * @reference    ETSI TS 103 097 [1] Clauses 5.2 & 7.1.1
             * @reference    IEEE 1609.2 [2], Clauses 6.3.30, 6.3.31
             */
            testcase TC_SEC_ITSS_SND_CAM_22_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var GeoNetworkingInd        v_geoNwInd;
                
                // 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();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaNistP256(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_x_only
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CA message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaNistP256(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_compressed_y_0
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CA message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaNistP256(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_compressed_y_1
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CA message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP256r1(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_x_only
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CA message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP256r1(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_compressed_y_0
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CA message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP256r1(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_compressed_y_1
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CA message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP384r1(
                                            mw_ecdsaP384Signature(
                                                mw_eccP384CurvePoint_x_only
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CA message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP384r1(
                                            mw_ecdsaP384Signature(
                                                mw_eccP384CurvePoint_compressed_y_0
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CA message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP384r1(
                                            mw_ecdsaP384Signature(
                                                mw_eccP384CurvePoint_compressed_y_1
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CA message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: CA message with wrong signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CA message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_22_BV
            
            /**
             * @desc    Check that IUT doesn't send secured CAMs if IUT is authorized with AT certificate doesn't 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 CAM
             *     } then {
             *         the IUT doesn't send CAM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_23_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_CAM_23_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_C1_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
garciay's avatar
garciay committed
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured CAMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No CAM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_23_BV
            
            /**
             * @desc    Check that IUT doesn't send the secured CAM 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_CA3_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 CAM
             *     } then {
             *         the IUT doesn't send CAM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_24_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_CAM_24_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_CA3_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
garciay's avatar
garciay committed
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured CAMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No CAM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_24_BV
            
            /**
             * @desc    Check that IUT doesn't send secured CAMs if all AT certificates installed on the IUT was expired.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_CA3_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 CAM
             *     } then {
             *         the IUT doesn't send CAM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_25_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_CAM_25_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_CA3_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
garciay's avatar
garciay committed
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured CAMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No CAM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_25_BV
            
            /**
             * @desc    Check that IUT doesn't send secured CAMs 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 CAM
             *     } then {
             *         the IUT doesn't send CAM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_26_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_CAM_26_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_A2_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
garciay's avatar
garciay committed
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured CAMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No CAM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_26_BV
            
            /**
             * @desc    Check that IUT doesn't send secured CAMs if IUT doesn't possess an AT certificate allowing 
garciay's avatar
garciay committed
             *          sending CAM by its appPermissions. 
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *     the IUT is authorized with AT certificate (CERT_IUT_A3_AT)
             *         containing appPermissions
             *             not containing PsidSSP
             *                 containing psid
             *                     indicating AID_CAM
             *         and the IUT has no other installed AT certificates
             * }
             * ensure that {
             *     when {
             *         the IUT is requested to send a secured CAM
             *     } then {
             *         the IUT doesn't send CAM
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_27_BV
             * @reference    IEEE 1609.2 [2], Clauses 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_CAM_27_BV() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up(); // Initialise IUT with CERT_IUT_A3_AT
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
garciay's avatar
garciay committed
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                )
                    ))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: that IUT shall not send secured CAMs");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No CAM received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } 
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CAM_27_BV
        } // End of group camProfile
         * @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.5 DENM profile
        group denmProfile {
garciay's avatar
garciay committed
            
            /**
             * @desc    Check that secured DENM is signed 
             * <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 content
             *                 containing signedData
             *     }
             * }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_01_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.2
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_DENM_01_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
                                        )
                                    )
                                )
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: The DEN message is secured");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected DEN message not received ***");
garciay's avatar
garciay 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_01_BV
            
            /**
             * @desc Check that IUT sends the secured DENM containing the HeaderInfo field psid set to 'AID_DENM'
             * <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 Ieee1609Dot2Data
             *             containing content
             *                 containing signedData
             *                     containing tbsData
             *                         containing headerInfo
             *                             containing psid
             *                                 indicating 'AID_DENM'
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_02_BV
             * @reference    ETSI TS 103 097 [1] Clause 7.1.2
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_DENM_02_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_geoNwBroadcastPacket
garciay's avatar
garciay committed
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": PASS: Correct secured packet received");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected DEN message not received ***");
garciay's avatar
garciay 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_02_BV
            
            /**
             * @desc Check that IUT sends the secured DENM with the HeaderInfo containing generationTime and generationLocation 
             *       and doesn't containing expiryTime, encryptionKey, p2pcdLearningRequest, missingCrlIdentifier, 
garciay's avatar
garciay committed
             *       inlineP2pcdRequest, requestedCertificate.
             * <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 Ieee1609Dot2Data
             *             containing content
             *                 containing signedData
             *                     containing tbsData
             *                         containing headerInfo
             *                             containing generationTime
             *                             and containing generationLocation, 
             *                             and not containing expiryTime
             *                             and not containing encryptionKey
             *                             and not containing p2pcdLearningRequest
             *                             and not containing missingCrlIdentifier
             *                             and not containing inlineP2pcdRequest
             *                             and not containing requestedCertificate
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_03_BV
             * @reference    ETSI TS 103 097 [1] Clauses 5.2 & 7.1.2
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_DENM_03_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_geoNwBroadcastPacket
garciay's avatar
garciay committed
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": PASS: Correct secured packet received");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected DEN message not received ***");
garciay's avatar
garciay 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_03_BV
            
            /**
             * @desc Check that IUT sends the secured DENM containing signer containing certificate.
             * <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 Ieee1609Dot2Data
             *             containing content
             *                 containing signedData
             *                     containing signer
             *                         containing certificate
             *                             containing toBeSigned
             *                                 containing appPermissions
             *                                     containing the item of type PsidSsp
             *                                         containing psid
             *                                             indicating AID_DENM
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_04_BV
             * @reference    ETSI TS 103 097 [1] Clauses 5.2 & 7.1.2
             * @reference    IEEE 1609.2 [2] Clause 6.3.4
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_DENM_04_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( // or containing certificate
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    { mw_appPermissions(c_its_aid_DENM) }
                                                )
                                            )
                                        )
garciay's avatar
garciay committed
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": PASS: Correct secured packet received, containing 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 // containing digest
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
garciay's avatar
garciay committed
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": FAIL: Incorrect secured packet received, containing digest");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected DEN message not received ***");
garciay's avatar
garciay 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_04_BV
            
            /**
             * @desc   Check that IUT sends the secured DENM containing generation time 
             *         and this time is inside the validity period of the signing certificate;
             *         Check that message generation time value is realistic.
 
             * <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 DENM
             *   } then {
             *       the IUT sends a SecuredMessage of type EtsiTs103097Data
             *           containing headerInfo
             *               containing generationTime
             *                   indicating TIME_1 (CUR_TIME - 10min <= TIME_1 <= CUR_TIME + 10min)
             *           and containing signer
             *               containing certificate
             *                   containing toBeSigned
             *                       containing validityPeriod
             *                           containing start
             *                               indicating value X_START_VALIDITY (X_START_VALIDITY <= GEN_TIME)
             *                           and containing duration
             *                               indicating value > GEN_TIME - X_START_VALIDITY 
             *   }
             * }
             * </pre>
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_05_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.2
             * @reference   IEEE 1609.2 [2], Clauses 5.2.3.2.2, 5.2.4.2.2, 5.2.4.2.3  
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_DENM_05_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                const integer        c_timeLimit := 10 * 60 * 1000000; // us
                var GeoNetworkingInd v_geoNwInd;
                var HeaderInfo       v_headerInfo;
                var Time64           v_generationTime;
                var Time64           v_curTime;
                var SignerIdentifier v_signerIdentifier;
                var ValidityPeriod   v_validityPeriod;
                var Certificate      v_cert;
                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();
                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_geoNwBroadcastPacket
garciay's avatar
garciay committed
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First DEN message with certificate received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, 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
garciay's avatar
garciay committed
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": FAIL: DEN message retransmission with digest ***"); 
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_error);
                        //repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: DEN message with certificate not received ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // 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_geoNwBroadcastPacket
garciay's avatar
garciay committed
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        f_getMsgHeaderInfo(f_getSecuredMessage(v_geoNwInd.msgIn), v_headerInfo);
                        v_generationTime := v_headerInfo.generationTime;
                        v_curTime := f_getCurrentTime();
                        v_curTime := v_curTime * 1000; // Time64 is in microseconds 
                        log("v_curTime (us)=", v_curTime);
                        // Check generation time
                        if (not match(v_generationTime, Time64:(v_curTime - c_timeLimit, v_curTime + c_timeLimit))) {
                            log("*** " & testcasename() & ": FAIL: DEN message generation time is not in 5 min range");
garciay's avatar
garciay committed
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        } else {
                            // Check certificate validity period
                            f_getMsgSignerIdentifier (f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier);
                            if (not match(v_signerIdentifier.certificate[0].toBeSigned.validityPeriod.start_, Time32:(v_curTime - c_timeLimit, v_curTime + c_timeLimit))) {
                                log("*** " & testcasename() & ": FAIL: DEN message certificate validity period is not in 5 min range");
garciay's avatar
garciay committed
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            } else {
                                log("*** " & testcasename() & ": PASS: Generation of DENM messages including certificate was successful ***");
                                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
garciay's avatar
garciay committed
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": FAIL: DEN message retransmission with digest ***"); 
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        //repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected DEN message not received ***");
garciay's avatar
garciay 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_05_BV
            
            /**
             * @desc   Check that IUT sends the secured DENM containing generation location when signing certificate 
             *         chain doesn't have any region restriction.
garciay's avatar
garciay committed
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             * with {
             *   the IUT is authorized with AT certificate (CERT_IUT_A_AT) 
             *       containing toBeSigned
             *           not containing region
             *       and issuied by the certificate AA (CERT_IUT_A_AA)
             *           containing toBeSigned
             *               not containing region
             *       and issuied by the certificate RCA (CERT_IUT_A_RCA)
             *           containing toBeSigned
             *               not containing 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 
garciay's avatar
garciay committed
             *   }
             * }
             * </pre>
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_DENM_06_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.2
             * @reference   IEEE 1609.2 [2], Clauses 5.2.3.2.2  
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_DENM_06_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var HeaderInfo       v_headerInfo;
                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(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -, 
                                mw_geoNwBroadcastPacket
garciay's avatar
garciay committed
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        f_getMsgHeaderInfo(f_getSecuredMessage(v_geoNwInd.msgIn), v_headerInfo);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
garciay's avatar
garciay committed
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": FAIL: DEN message retransmission with digest ***"); 
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        //repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected DEN message not received ***");
garciay's avatar
garciay 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_06_BV
            
            /**
             * @desc   Check that IUT sends the secured DENM containing generation location which is inside the circular region 
             *         defined by the validity restriction of the certificate pointed by the message signer.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_CERTIFICATE_SELECTION
             * Config Id: CF01
             * Initial conditions:
             * with {
             *   the IUT is authorized with AT certificate (X_AT_CERTIFICATE) 
             *       containing toBeSigned
             *           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_07_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.2
             * @reference   IEEE 1609.2 [2], Clauses 5.2.3.2.2  
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_DENM_07_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var HeaderInfo       v_headerInfo;
                var SignerIdentifier v_signerIdentifier;
                var Certificate      v_cert;
                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;
garciay's avatar
garciay committed
                f_cf01Up();
                
                // 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(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -,
                                                    ?
                                                )
                                mw_geoNwBroadcastPacket
garciay's avatar
garciay committed
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if (f_getMsgHeaderInfo(f_getSecuredMessage(v_geoNwInd.msgIn), v_headerInfo) and f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier)) {
                            var ThreeDLocation v_location := { v_headerInfo.generationLocation.latitude, v_headerInfo.generationLocation.longitude, v_headerInfo.generationLocation.elevation };                            
                            var integer v_counter;
                            
                            for (v_counter := 0; v_counter < lengthof(v_signerIdentifier.certificate); v_counter := v_counter + 1) {                 
                                if (f_isLocationInsideRegion(v_signerIdentifier.certificate[v_counter].toBeSigned.region, v_location) == false) {
                                    break;
                                }
                            } // End of of for statement
                            if (v_counter == lengthof(v_signerIdentifier.certificate)) {
                                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 ***");
garciay's avatar
garciay committed
                                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
garciay's avatar
garciay committed
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": FAIL: DEN message retransmission with digest ***"); 
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        //repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected DEN message not received ***");
garciay's avatar
garciay 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_07_BV
            
            /**
             * @desc   Check that IUT sends the secured DENM containing generation location which is inside the region 
             *         defined by the validity restriction of the certificate pointed by the message signer . 
garciay's avatar
garciay committed
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and not PICS_SEC_CERTIFICATE_SELECTION
garciay's avatar
garciay committed
             * Config Id: CF01
             * Initial conditions:
             * with {
             *   the IUT is authorized with AT certificate (X_AT_CERTIFICATE) 
             *       containing toBeSigned
             *           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_08_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.2
             * @reference   IEEE 1609.2 [2], Clauses 5.2.3.2.2  
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_SND_DENM_08_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var HeaderInfo       v_headerInfo;
                var SignerIdentifier v_signerIdentifier;
                var Certificate      v_cert;
                var ItsDenm          v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY) or PICS_SEC_CERTIFICATE_SELECTION) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and not PICS_SEC_CERTIFICATE_SELECTION' required for executing the TC ***");
garciay's avatar
garciay committed
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
garciay's avatar
garciay committed
                f_cf01Up();
                
                // 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(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
garciay's avatar
garciay committed
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if (f_getMsgHeaderInfo(f_getSecuredMessage(v_geoNwInd.msgIn), v_headerInfo) and f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier)) {
                            var ThreeDLocation v_location := { v_headerInfo.generationLocation.latitude, v_headerInfo.generationLocation.longitude, v_headerInfo.generationLocation.elevation };                            
                            var integer v_counter;
                            
                            for (v_counter := 0; v_counter < lengthof(v_signerIdentifier.certificate); v_counter := v_counter + 1) {                 
                                if (f_isLocationInsideRegion(v_signerIdentifier.certificate[v_counter].toBeSigned.region, v_location) == false) {
                                    break;
                                }
                            } // End of of for statement
                            if (v_counter == lengthof(v_signerIdentifier.certificate)) {
                                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 ***");
garciay's avatar
garciay committed
                                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
garciay's avatar
garciay committed
                    ))) {
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": FAIL: DEN message retransmission with digest ***"); 
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        //repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected DEN message not received ***");
garciay's avatar
garciay 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_08_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 AA certificate used to sign the certificate 
             *         pointed by the message signer doesn't containing 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_CA1_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_09_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_09_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_CA1, 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
                
                // 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(
                                                    { 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 ***");
                        f_selfOrClientSyncAndVerdictPreamble(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 ***");
                        f_selfOrClientSyncAndVerdictPreamble(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
                if (f_verifyGnSecuredMessageSignatureWithCertificate(f_getSecuredMessage(v_geoNwInd.msgIn), v_certificate)) {
                    log("*** " & testcasename() & ": PASS: Signature verified successfully ***");
                    f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                } else {
                    log("*** " & testcasename() & ": FAIL: Signature not verified successfully ***");
                    f_selfOrClientSyncAndVerdictPreamble(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>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_GENMSG_02_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.3
             */
            testcase TC_SEC_ITSS_SND_GENMSG_02_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var LongPosVector v_longPosVectorIut;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ITS_AID_OTHER)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER' 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_02_BV
            
            /**
             * @desc    Check that IUT sends the secured GeoNetworking message with the headerInfo containing generationTime.
             * <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 generationTime
             *                             and not containing expiryTime
             *                             and not containing generationLocation, 
             *                             and not containing encryptionKey
             *                             and not containing p2pcdLearningRequest
             *                             and not containing missingCrlIdentifier
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_GENMSG_03_BV
             * @reference   ETSI TS 103 097 [1] Clauses 5.2 & 7.1.3
             */
            testcase TC_SEC_ITSS_SND_GENMSG_03_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var LongPosVector v_longPosVectorIut;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ITS_AID_OTHER)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER' 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_03_BV
            
            /**
             * @desc    Check that IUT sends the secured GeoNetworking message containing certificate or digest as a signer.
             * <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 signer
             *                         containing digest
             *                         or containing certificate
             *                             containing toBeSigned
             *                                 containing appPermissions
             *                                     containing the item of type PsidSsp
             *                                         containing psid
             *                                             indicating AID_GNMGMT
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_GENMSG_04_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.3
             * @reference   IEEE 1609.2 [2] Clause 6.3.4
             */
            testcase TC_SEC_ITSS_SND_GENMSG_04_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var LongPosVector v_longPosVectorIut;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ITS_AID_OTHER)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER' 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
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                )
                    ))) {
                        log("*** " & testcasename() & ": INFO: Correct secured packet received, containing digest ***");
                        repeat;
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_gn
                                        ),
                                        mw_signerIdentifier_certificate( // or containing certificate
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    { mw_appPermissions(c_its_aid_GN) }
                                                )
                                            )
                                        )
                                    )
                                )
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Correct secured packet received, containing digest ***");
                        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_04_BV
            
            /**
             * @desc    Check that IUT sends the secured GeoNetworking message containing generation time 
             *          and this time is inside the validity period of the signing certificate;
             *          Check that message generation time value is realistic.
             * <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
             *             containing certificate
             *     } then {
             *          the IUT sends a SecuredMessage of type EtsiTs103097Data
             *              containing headerInfo
             *                  containing generationTime
             *                      indicating TIME_1 (CUR_TIME - 10min <= TIME_1 <= CUR_TIME + 10min)
             *              and containing signer
             *                  containing certificate
             *                      containing toBeSigned
             *                          containing validityPeriod
             *                              containing start
             *                                  indicating value X_START_VALIDITY (X_START_VALIDITY <= GEN_TIME)
             *                              and containing duration
             *                                  indicating value > GEN_TIME - X_START_VALIDITY 
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_GENMSG_05_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.3
             * @reference   IEEE 1609.2 [2] Clause 6.3.4
             */
            testcase TC_SEC_ITSS_SND_GENMSG_05_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                const integer        c_timeLimit := 10 * 60 * 1000000; // us
                var LongPosVector v_longPosVectorIut;
                var GeoNetworkingInd v_geoNwInd;
                var HeaderInfo       v_headerInfo;
                var Time64           v_generationTime;
                var Time64           v_curTime;
                var SignerIdentifier v_signerIdentifier;
                var ValidityPeriod   v_validityPeriod;
                var Certificate      v_cert;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ITS_AID_OTHER)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER' 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
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_gn
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                )
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First GN message with certificate received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: GN message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_gn
                                        ),
                                        mw_signerIdentifier_certificate // containing certificate
                                    )
                                )
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        f_getMsgHeaderInfo(f_getSecuredMessage(v_geoNwInd.msgIn), v_headerInfo);
                        v_generationTime := v_headerInfo.generationTime;
                        v_curTime := f_getCurrentTime();
                        v_curTime := v_curTime * 1000; // Time64 is in microseconds 
                        log("v_curTime (us)=", v_curTime);
                        // Check generation time
                        if (not match(v_generationTime, Time64:(v_curTime - c_timeLimit, v_curTime + c_timeLimit))) {
                            log("*** " & testcasename() & ": FAIL: GN generation time is not in 5 min range");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        } else {
                            // Check certificate validity period
                            f_getMsgSignerIdentifier (f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier);
                            if (not match(v_signerIdentifier.certificate[0].toBeSigned.validityPeriod.start_, Time32:(v_curTime - c_timeLimit, v_curTime + c_timeLimit))) {
                                log("*** " & testcasename() & ": FAIL: GN certificate validity period is not in 5 min range");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            } else {
                                log("*** " & testcasename() & ": PASS: Generation of GN messages including certificate was successful ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                            }
                        }
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_gn
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                )
                    ))) {
                        log("*** " & testcasename() & ": PASS: Correct secured packet received, containing digest ***");
                        repeat;
                    }
                    [] 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_05_BV
            
            /**
             * @desc    Check that IUT sends the secured message using the 'data' field in signed data payload, 
             *          containing the EtsiTs103097Data of type unsecured, 
             *          containing the data payload or using the extDataHash field containing the SHA256 hash of data payload.
             * <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 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_GENMSG_06_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.3
             */
            testcase TC_SEC_ITSS_SND_GENMSG_06_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var LongPosVector v_longPosVectorIut;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ITS_AID_OTHER)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER' 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_ieee1609Dot2Data(
                                                    mw_ieee1609Dot2Data_unsecured
                                            )),
                                            mw_headerInfo_gn
                                        )
                                    )
                                )
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: GN received with a well formated payload ***");
                        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_06_BV
            
            /**
             * @desc    Check that the IUT sends the secured messages signed with the certificate 
             *          containing appPermisions allowing to sign these messages.
             * <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 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_GENMSG_07_BV
             * @reference   ETSI TS 103 097 [1] Clauses 7.1.3
             * @reference   IEEE 1609.2 [2] Clause 5.2.3.2.2
             */
            testcase TC_SEC_ITSS_SND_GENMSG_07_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var LongPosVector v_longPosVectorIut;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ITS_AID_OTHER)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER' 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
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                )
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Correct secured packet received, containing digest ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload(
                                                mw_ieee1609Dot2Data(
                                                    mw_ieee1609Dot2Data_unsecured
                                            )),
                                            mw_headerInfo_gn
                                        )
                                    )
                                )
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: received with a well formated payload ***");
                        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_07_BV
                        
            /**
             * @desc    Check that IUT sends the secured GeoNetworking message 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 and PICS_SEC_ITS_AID_OTHER
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (X_CERTIFICATE) 
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a secured beacon
             *      } then {
             *          the IUT sends a message of type EtsiTs103097Data
             *              containing signedData
             *                  containing signer
             *                       containing digest
             *                           referencing the certificate X_CERTIFICATE
             *                       or containing certificate
             *                           indicating X_CERTIFICATE
             *                  and containing signature
             *                      containing X_SIGNATURE
             *                          verifiable using KEY 
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_GENMSG_08_BV
             * @reference   ETSI TS 103 097 [1], Clauses 5.2 & 7.1.3
             * @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_GENMSG_08_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var LongPosVector           v_longPosVectorIut;
                var EtsiTs103097Certificate v_certificate;
                var Signature               v_signature;
                var GeoNetworkingInd        v_geoNwInd;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ITS_AID_OTHER)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ITS_AID_OTHER' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                    
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_readCertificate(vc_hashedId8ToBeUsed, v_certificate);
                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(
                                        PICS_CERTFICATES_FOI[PICS_CERTFICATES_VAR].hashAlgorithm, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_gn
                                        ),
                                        mw_signerIdentifier_digest( // containing digest referencing the certificate X_CERTIFICATE
                                            PICS_CERTFICATES_FOI[PICS_CERTFICATES_VAR].issuer
                                        )
                                    )
                                )
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: GN message with digest received ***");
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        PICS_CERTFICATES_FOI[PICS_CERTFICATES_VAR].hashAlgorithm, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_gn
                                        ),
                                        mw_signerIdentifier_certificate( // or containing containing certificate indicating X_CERTIFICATE
                                            v_certificate
                                        )
                                    )
                                )
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: GN message with certificate received ***");
                    }
                    [] 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_08_BV
                        
        } // End of group genericSignedMessageProfile
         * @desc Sending behaviour test cases for certificates profile
         * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.2.7 Encrypted messages profile
        group encryptedMessagesProfile {
            
            /**
             * @desc    Check that the IUT can generate encrypted message.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY AND PICS_SEC_ENCRYPTION_SUPPORT
             * 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 an encrypted message
             *     } then {
             *         the IUT sends a message of type EtsiTs103097Data
             *             containing encryptedData
             *                 containing recipients
             *                     containing at least one item of type RecipientInfo
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_ENC_01_BV
             * @reference   ETSI TS 103 097 [1], Clauses 5.3
             */
            testcase TC_SEC_ITSS_SND_ENC_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ENCRYPTION_SUPPORT)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ENCRYPTION_SUPPORT' 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();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_encrypted(
                                    mw_encryptedData(
                                        -,
                                        mw_SymmetricCiphertext_aes128ccm
                    ))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: IUT sends encrypted data successfully ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_ENC_01_BV
            
            /**
             * @desc    Check that the IUT can generate encrypted message.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY AND PICS_SEC_ENCRYPTION_SUPPORT
             * 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 an encrypted message
             *     } then {
             *         the IUT sends a message of type EtsiTs103097Data
             *             containing encryptedData
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_ENC_02_BV
             * @reference   IEEE 1609.2 [2] Clause 6.3.31
             */
            testcase TC_SEC_ITSS_SND_ENC_02_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var GeoNetworkingInd      v_geoNwInd;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ENCRYPTION_SUPPORT)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ENCRYPTION_SUPPORT' 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();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_encrypted(
                                    mw_encryptedData(
                                        -,
                                        mw_SymmetricCiphertext_aes128ccm
                    ))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if (lengthof(f_getSecuredMessage(v_geoNwInd.msgIn).content.encryptedData.recipients) >= 1) {
                            log("*** " & testcasename() & ": PASS: IUT sends encrypted data successfully ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                        } else {
                            log("*** " & testcasename() & ": FAIL: RecipientInfo list is empty ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_ENC_02_BV
            
            /**
             * @desc    Check that the IUT can generate encrypted message.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY AND PICS_SEC_ENCRYPTION_SUPPORT
             * 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 an encrypted message
             *     } then {
             *         the IUT sends a message of type EtsiTs103097Data
             *             containing encryptedData
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_ENC_03_BV
             * @reference   IEEE 1609.2 [2] Clause 6.3.31
             */
            testcase TC_SEC_ITSS_SND_ENC_03_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var GeoNetworkingInd      v_geoNwInd;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ENCRYPTION_SUPPORT)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ENCRYPTION_SUPPORT' 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();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_encrypted(
                                    mw_encryptedData(
                                        { 
                                            mw_recipientInfo_certRecipInfo(
                                                mw_pKRecipientInfo(
                                                    -,
                                                    mw_encryptedDataEncryptionKey_eciesNistP256(
                                                        mw_evciesP256EncryptedKey
                                                    )
                                                )
                                            )
                                        },
                                        mw_SymmetricCiphertext_aes128ccm
                    ))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: IUT sends encrypted data successfully ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_encrypted(
                                    mw_encryptedData(
                                        { 
                                            mw_recipientInfo_certRecipInfo(
                                                mw_pKRecipientInfo(
                                                    -,
                                                    mw_encryptedDataEncryptionKey_eciesBrainpoolP256r1(
                                                        mw_evciesP256EncryptedKey
                                                    )
                                                )
                                            )
                                        },
                                        mw_SymmetricCiphertext_aes128ccm
                    ))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: IUT sends encrypted data successfully ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_ENC_03_BV
            
            /**
             * @desc    Check that the ciphertext of encrypted message contains encrypted EtsiTs103097Data structure.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY AND PICS_SEC_ENCRYPTION_SUPPORT
             * 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 an encrypted message
             *     } then {
             *         the IUT sends a message of type EtsiTs103097Data
             *             containing encryptedData
             *                 containing ciphertext
             *                     containing encrypted data
             *                        containing COER encoded data
             *                           containing structure of type EtsiTs103097Data
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_ENC_04_BV
             * @reference   IEEE 1609.2 [2], clauses 6.3.31
             * @reference   ETSI TS 103 097 [1] Clause 7.1.4
             */
            testcase TC_SEC_ITSS_SND_ENC_04_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var EtsiTs103097Data      v_decryptedMsg;
                var GeoNetworkingInd      v_geoNwInd;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ENCRYPTION_SUPPORT)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ENCRYPTION_SUPPORT' 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();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_encrypted(
                                    mw_encryptedData(
                                        -,
                                        mw_SymmetricCiphertext_aes128ccm(
                                            mw_aesCcmCiphertext
                    )))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        
                        if (f_decrypt(vc_encryptPrivateKey, f_getSecuredMessage(v_geoNwInd.msgIn), v_decryptedMsg) == false) {
                            log("*** " & testcasename() & ": FAIL: Unable to process encryption data ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        } else if (match(v_decryptedMsg, mw_etsiTs103097Data) == false) {
                            log("*** " & testcasename() & ": FAIL: Unable to parse EtsiTs103097Data data ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        } else {
                            log("*** " & testcasename() & ": PASS: IUT sends signed and encrypted message ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_ENC_04_BV
            
            /**
             * @desc    Check that when the IUT sends SignedAndEncrypted message then it sends the 
             *          EtsiTs103097Data-Encrypted message containing the EtsiTs103097Data-Signed 
             *          structure as the ToBeSignedDataContent.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY AND PICS_SEC_ENCRYPTION_SUPPORT
             * 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 an encrypted and signed message
             *     } then {
             *         the IUT sends a message of type EtsiTs103097Data
             *             containing encryptedData
             *                 containing ciphertext
             *                     containing encrypted data
             *                        containing COER encoded data
             *                           containing structure of type EtsiTs103097Data
             *                               containing signedData
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_ENC_05_BV
             * @reference   IEEE 1609.2 [2], clauses 6.3.31
             * @reference   ETSI TS 103 097 [1] Clause 7.1.5
             */
            testcase TC_SEC_ITSS_SND_ENC_05_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var EtsiTs103097Data      v_decryptedMsg;
                var GeoNetworkingInd      v_geoNwInd;
                    
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_ENCRYPTION_SUPPORT)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_ENCRYPTION_SUPPORT' 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();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_encrypted(
                                    mw_encryptedData(
                                        -,
                                        mw_SymmetricCiphertext_aes128ccm(
                                            mw_aesCcmCiphertext
                    )))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        
                        if (f_decrypt(vc_encryptPrivateKey, f_getSecuredMessage(v_geoNwInd.msgIn), v_decryptedMsg) == false) {
                            log("*** " & testcasename() & ": FAIL: Unable to process encryption data ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        } else if (match(v_decryptedMsg, mw_etsiTs103097Data_signed) == false) {
                            log("*** " & testcasename() & ": FAIL: Unable to parse signed data ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        } else {
                            // TODO Check signature?
                            log("*** " & testcasename() & ": PASS: IUT sends signed and encrypted message ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_ENC_05_BV
            
        } // End of group encryptedMessagesProfile
        
        /**
         * @desc Sending behaviour test cases for certificates profile
         * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.2.8 Profiles for certificates
         */
        group profileForCertificates {
            /**
             * @desc    Check that IUT certificate is explicit and has version 3.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the AA is issued the certificate
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing version
             *                 indicating 3
             *             and containing type
             *                 indicating 'explicit'
             *             and containing toBeSigned
             *                 containing verifyKeyIndicator
             *                     containing verificationKey
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_01_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6
             * @reference   IEEE 1609.2 [2] Clause 6.4.3
             */
            testcase TC_SEC_ITSS_SND_CERT_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                    
                // 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();
                log("*** " & testcasename() & ": INFO: Wait for certificate and ask for AA certificate  ***");
                f_askForCertificateChain(f_generateDefaultCam()); // TODO Rename f_askForCertificateChain into f_askForCertificateAA
                tc_ac.stop;
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        mw_toBeSignedData(
                                            mw_ieee1609Dot2_headerInfo_request_certificate(
                                                mw_etsiTs103097Certificate(
                                                    -,
                                                    mw_toBeSignedCertificate_aa
                    )))))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Security protocol version set to 3 ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_01_BV
            
            /**
             * @desc    Check that IUT certificate is conformed to ETSI TS 103 097 clause 6.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the AA is issued the certificate
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing toBeSigned
             *                 containing id
             *                     indicating 'none'
             *                     or indicating 'name'
             *                 and containing cracaId
             *                     indicating '000000'H
             *                 and containing crlSeries
             *                     indicating '0'D
             *                 and not containing certRequestPermissions
             *                 and not containing canRequestRollover
             *                 and containing signature
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_02_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6
             */
            testcase TC_SEC_ITSS_SND_CERT_02_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                    
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                
                // Test component configuration
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                    
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                log("*** " & testcasename() & ": INFO: Wait for certificate and ask for AA certificate ***");
                tc_ac.start;
                f_askForCertificateChain(f_generateDefaultCam());
                tc_ac.stop;
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -,
                                        mw_toBeSignedData(
                                            -,
                                            mw_ieee1609Dot2_headerInfo_request_certificate(
                                                -,
                                                mw_etsiTs103097Certificate(
                                                    -,
                                                    mw_toBeSignedCertificate_aa(
                                                        mw_certificateId_name
                    ))))))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: AA certificate is conformed to ETSI TS 103 097 clause 6, with named id ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -,
                                        mw_toBeSignedData(
                                            -,
                                            mw_ieee1609Dot2_headerInfo_request_certificate(
                                                -,
                                                mw_etsiTs103097Certificate(
                                                    -,
                                                    mw_toBeSignedCertificate_aa(
                                                        mw_certificateId_none
                    ))))))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: AA certificate is conformed to ETSI TS 103 097 clause 6, with none id ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_02_BV
            
            /**
             * @desc    Check that the certificate issuer of certificates is referenced using digest;
             *          Check that right digest field is used to reference to the certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (X_CERTIFICATE) 
             *  }
             *  ensure that {
             *      when {
             *          the CA is issued the certificate
             *      } then {
             *          this certificate is of type EtsiTs103097Certificate
             *              containing signedData
             *                  containing self
             *                  or containing X_DIGEST
             *                      indicating last 8 bytes of the hash of the certificate calculated using X_ALGORITHM
             *                          referenced to certificate
             *                              containing toBeSigned
             *                                  containing verifyKeyIndicator
             *                                      containing verificationKey
             *                                          containing X_KEY
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_03_BV
             * @reference   ETSI TS 103 097 [1], Clauses 5.2 & 7.1.3
             * @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_CERT_03_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var EtsiTs103097Certificate v_ca_certificate;
                var EtsiTs103097Certificate v_aa_certificate;
                var EtsiTs103097Certificate v_at_certificate;
                var HashedId8               v_ca_hashedId8;
                var HashedId8               v_aa_hashedId8;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                
                // Test component configuration
                    
                // Test adapter configuration
                
                // Preamble
                f_readCertificate(cc_taCert_CA1, v_ca_certificate); // TODO Use PIXIT as array of strings to change 
                                                                    // certificates to be checked
                f_readCertificate(cc_taCert_CC_AA, v_aa_certificate);
                f_readCertificate(cc_iutCert_A, v_at_certificate);
                f_getCertificateDigest(cc_taCert_CC_AA, v_ca_hashedId8);
                f_getCertificateDigest(cc_taCert_CC_AA, v_aa_hashedId8);
                
                // Test Body
                // 1. Check certificate format
                if (match(
                          v_ca_certificate,
                          mw_etsiTs103097Certificate(
                                                     mw_issuerIdentifier_self,
                                                     mw_toBeSignedCertificate_ca
                )) == true) {
                    log("*** " & testcasename() & ": INFO: CA certificate are well formatted ***");
                } else {
                    log("*** " & testcasename() & ": FAIL: Invalid CA certificate ***");
                    setverdict(fail);
                } // End of 'alt' statement
                if (match(
                          v_aa_certificate,
                          mw_etsiTs103097Certificate(
                                                     ?,
                                                     mw_toBeSignedCertificate_aa
                )) == true) {
                    log("*** " & testcasename() & ": INFO: AA certificate are well formatted ***");
                } else {
                    log("*** " & testcasename() & ": FAIL: Invalid AA certificate ***");
                    setverdict(fail);
                } // End of 'alt' statement
                if (match(
                          v_at_certificate,
                          mw_etsiTs103097Certificate(
                                                     ?,
                                                     mw_toBeSignedCertificate_at
                )) == true) {
                    log("*** " & testcasename() & ": INFO: AT sertificate are well formatted ***");
                } else {
                    log("*** " & testcasename() & ": Invalid AT certificate ***");
                    setverdict(fail);
                } // End of 'alt' statement
                // 2. Check issuers
                if (v_ca_certificate.issuer.self_ == sha256) {
                    if (match(v_ca_hashedId8, v_aa_certificate.issuer.sha256AndDigest) == true) {
                        log("*** " & testcasename() & ": INFO: AA certificate is issued from CA certificate ***");
                    } else {
                        log("*** " & testcasename() & ": FAIL: Invalid AA certificate ***");
                        setverdict(fail);
                    } // End of 'alt' statement
                    if (match(v_aa_hashedId8, v_at_certificate.issuer.sha256AndDigest) == true) {
                        log("*** " & testcasename() & ": INFO: AT certificate is issued from CA certificate ***");
                        setverdict(pass, "Certificates are well-formated and issuer chain is correct");
                    } else {
                        log("*** " & testcasename() & ": FAIL: Invalid AA certificate ***");
                        setverdict(fail);
                    } // End of 'alt' statement
                } else if (v_ca_certificate.issuer.self_ == sha384) {
                    if (match(v_ca_hashedId8, v_aa_certificate.issuer.sha384AndDigest) == true) {
                        log("*** " & testcasename() & ": INFO: AA certificate is issued from CA certificate ***");
                    } else {
                        log("*** " & testcasename() & ": FAIL: Invalid AA certificate ***");
                        setverdict(fail);
                    } // End of 'alt' statement
                    if (match(v_aa_hashedId8, v_at_certificate.issuer.sha384AndDigest) == true) {
                        log("*** " & testcasename() & ": INFO: AT certificate is issued from CA certificate ***");
                        setverdict(pass, "Certificates are well-formated and issuer chain is correct");
                    } else {
                        log("*** " & testcasename() & ": FAIL: Invalid AA certificate ***");
                        setverdict(fail);
                    } // End of 'alt' statement
                } else {
                    log("*** " & testcasename() & ": FAIL: Invalid CA certificate issuer ***");
                    setverdict(fail);
                }
                
                // Postamble
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_03_BV
            
            /**
             * @desc    Check that the rectangular certificate validity region of the subordinate certificate is well formed 
             *          and inside the validity region of the issuing certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_RECTANGULAR_REGION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the CA is authorized with AA certificate 
             *          containing toBeSigned
             *              containing region
             *                  indicating REGION
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT issued the AT certificate 
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing toBeSigned
             *                 containing region
             *                     containing rectangularRegion
             *                         containing items of type RectangularRegion
             *                             containing northwest
             *                                 indicating a point inside the REGION
             *                             and containing southeast
             *                                 indicating a point on the south from northwest
             *             and inside the REGION
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_04_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6
             */
            testcase TC_SEC_ITSS_SND_CERT_04_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var SequenceOfCertificate v_aa_certificate;
                var SignerIdentifier      v_signerIdentifier;
                var GeoNetworkingInd      v_geoNwInd;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_RECTANGULAR_REGION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_RECTANGULAR_REGION' 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();
                log("*** " & testcasename() & ": INFO: Wait for certificate and ask for AA certificate ***");
                tc_ac.start;
                f_askAndWaitForCertificateChain(v_aa_certificate, f_generateDefaultCam());
                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_cam
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -,
                                                    mw_geographicRegion_rectangular
                    )))))))) -> value v_geoNwInd {
                        if (f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier)) {
                            var integer v_counter;
                            
                            for (v_counter := 0; v_counter < lengthof(v_signerIdentifier.certificate); v_counter := v_counter + 1) {
                                if (f_areRectanglesInside(v_signerIdentifier.certificate[v_counter].toBeSigned.region.rectangularRegion, v_aa_certificate[0].toBeSigned.region.rectangularRegion) == false) {
                                    break;
                                }
                            } // End of of for statement
                            if (v_counter == lengthof(v_signerIdentifier.certificate)) {
                                log("*** " & testcasename() & ": PASS: AT certificate is inside the validity region of the issuing certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                            } else {
                                log("*** " & testcasename() & ": FAIL: AT certificate is not inside the validity region of the issuing certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            }
                        } else {
                            log("*** " & testcasename() & ": FAIL: IMPOSSIBLE!!! CAM 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_cam
                                        mw_signerIdentifier_digest // containing digest
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_04_BV
             * @desc    Check that the IUT supports at least 8 entries in the rectangular certificate validity 
             *          region in the AT certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_RECTANGULAR_REGION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_C_AT_8)
             *          containing toBeSigned
             *              containing region
             *                  containing rectangularRegion
             *                      containing 8 entries
             *                          containing one entry (ENTRY)
             *                              containing current IUT position
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT is requested to send a secured DENM 
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing headerInfo
             *                 containing generationLocation
             *                     indicating position inside the ENTRY 
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_05_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6.4.17
             */
            testcase TC_SEC_ITSS_SND_CERT_05_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var HeaderInfo       v_headerInfo;
                var SignerIdentifier v_signerIdentifier;
                var Certificate      v_cert;
                var ItsDenm          v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_RECTANGULAR_REGION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_RECTANGULAR_REGION' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := cc_iutCert_A; // FIXME Review certificate to be used
                f_cf01Up();
                    
                // 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(
                                            mw_etsiTs103097Certificate(
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -,
                                                    mw_geographicRegion_rectangular
                                                )
                                            )
                                        )
                                     )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) -> value v_geoNwInd {
                        if (f_getMsgHeaderInfo(f_getSecuredMessage(v_geoNwInd.msgIn), v_headerInfo) and f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier)) {
                            var ThreeDLocation v_location := { v_headerInfo.generationLocation.latitude, v_headerInfo.generationLocation.longitude, v_headerInfo.generationLocation.elevation }; 
                            var integer v_counter;
                            
                            for (v_counter := 0; v_counter < lengthof(v_signerIdentifier.certificate); v_counter := v_counter + 1) {
                                if (f_isLocationInsideRegion(v_signerIdentifier.certificate[v_counter].toBeSigned.region, v_location) == false) {
                                    break;
                                }
                            } // End of of for statement
                            if (v_counter == lengthof(v_signerIdentifier.certificate)) {
                                log("*** " & testcasename() & ": PASS: AT certificate is inside the validity region of the issuing certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                            } else {
                                log("*** " & testcasename() & ": FAIL: AT certificate is not inside the validity region of the issuing certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            }
                        } else {
                            log("*** " & testcasename() & ": FAIL: IMPOSSIBLE!!! CAM 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 // containing digest
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected 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_CERT_05_BV
7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114
            /**
             * @desc    Check that the rectangular certificate validity region of the subordinate certificate is well formed 
             *          and inside the validity region of the issuing certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_POLYGONAL_REGION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the CA is authorized with AA certificate 
             *          containing toBeSigned
             *              containing region
             *                  indicating REGION
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT issued the AT certificate 
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing toBeSigned
             *                 containing region
             *                     containing polygonalRegion
             *                         containing more than 2 items of type TwoDLocation
             *                             indicating points inside the REGION
             *                             and indicating unintercepting segments
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_06_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6.4.21, 6.4.17,5.1.2.4
             */
            testcase TC_SEC_ITSS_SND_CERT_06_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var SequenceOfCertificate v_aa_certificate;
                var SignerIdentifier      v_signerIdentifier;
                var GeoNetworkingInd      v_geoNwInd;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_POLYGONAL_REGION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_POLYGONAL_REGION' 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();
                // Wait for the message with the certificate to retrieve the AA digest.
                // Ask for the chain, containing AT and AA certificate
                // Check AA Certificate
                log("*** " & testcasename() & ": INFO: Wait for certificate and ask for AA certificate ***");
                f_askAndWaitForCertificateChain(v_aa_certificate, f_generateDefaultCam());
                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_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -,
                                                    mw_geographicRegion_polygonal
                    )))))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if (f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier)) {
                            var integer v_counter;
                            
                            for (v_counter := 0; v_counter < lengthof(v_signerIdentifier.certificate); v_counter := v_counter + 1) {
                                if (f_arePolygonsInside(v_signerIdentifier.certificate[v_counter].toBeSigned.region.polygonalRegion, v_aa_certificate[0].toBeSigned.region.polygonalRegion) == false) {
                                    break;
                                }
                            } // End of of for statement
                            if (v_counter == lengthof(v_signerIdentifier.certificate)) {
                                log("*** " & testcasename() & ": PASS: AT certificate is inside the validity region of the issuing certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                            } else {
                                log("*** " & testcasename() & ": FAIL: AT certificate is not inside the validity region of the issuing certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            }
                        } else {
                            log("*** " & testcasename() & ": FAIL: IMPOSSIBLE!!! CAM 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_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                )
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_06_BV
            
            /**
             * @desc    Check that the IUT supports at least 8 entries in the polygonal certificate validity 
             *          region in the AT certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_POLYGONAL_REGION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_D_AT_8)
             *          containing toBeSigned
             *              containing region
             *                  containing polygonalRegion
             *                      containing 8 entries
             *                          indicating polygon P
             *          and the IUT’s position is inside the polygon P
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT is requested to send a secured DENM 
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing headerInfo
             *                 containing generationLocation
             *                     indicating position inside the P 
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_07_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6.4.17
             */
            testcase TC_SEC_ITSS_SND_CERT_07_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var HeaderInfo       v_headerInfo;
                var SignerIdentifier v_signerIdentifier;
                var Certificate      v_cert;
                var ItsDenm          v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_POLYGONAL_REGION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_POLYGONAL_REGION' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := cc_iutCert_A; // FIXME Review certificate to be used
                f_cf01Up();
                    
                // 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(
                                            mw_etsiTs103097Certificate(
                                                ?,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -,
                                                    mw_geographicRegion_polygonal
                                                )
                                            )
                                        )
                                     )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if (f_getMsgHeaderInfo(f_getSecuredMessage(v_geoNwInd.msgIn), v_headerInfo) and f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier)) {
                            var ThreeDLocation v_location := { v_headerInfo.generationLocation.latitude, v_headerInfo.generationLocation.longitude, v_headerInfo.generationLocation.elevation }; 
                            var integer v_counter;
                            
                            for (v_counter := 0; v_counter < lengthof(v_signerIdentifier.certificate); v_counter := v_counter + 1) {
                                if (f_isLocationInsideRegion(v_signerIdentifier.certificate[v_counter].toBeSigned.region, v_location) == false) {
                                    break;
                                }
                            } // End of of for statement
                            if (v_counter == lengthof(v_signerIdentifier.certificate)) {
                                log("*** " & testcasename() & ": PASS: AT certificate is inside the validity region of the issuing certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                            } else {
                                log("*** " & testcasename() & ": FAIL: AT certificate is not inside the validity region of the issuing certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            }
                        } else {
                            log("*** " & testcasename() & ": FAIL: IMPOSSIBLE!!! CAM 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 // containing digest
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected 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_CERT_07_BV
            
            /**
             * @desc    Check that the identified certificate validity region contains values that correspond 
             *          to numeric country codes as defined by United Nations Statistics Division [6] in October 2013.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_IDENTIFIED_REGION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT issued the certificate 
             *          containing toBeSigned
             *              containing region
             *                  containing identifiedRegion
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT issued the AT certificate 
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing toBeSigned
             *                 containing region
             *                     containing identifiedRegion
             *                         containing 1 entry of type IdentifiedRegion
             *                             containing countryOnly
             *                                 indicating integer representation of the identifier of country or area
             *                             or containing countryAndRegions
             *                                 containing countryOnly
             *                                     indicating integer representation of the identifier of country or area
             *                             or containing countryAndSubregions
             *                                 containing country
             *                                     indicating integer representation of the identifier of country or area
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_08_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6.4.23
             */
            testcase TC_SEC_ITSS_SND_CERT_08_BV() runs on ItsGeoNetworking system ItsSecSystem {                    
                    
                // Local variables
                var SequenceOfCertificate v_aa_certificate;
                var SignerIdentifier      v_signerIdentifier;
                var GeoNetworkingInd      v_geoNwInd;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_IDENTIFIED_REGION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_IDENTIFIED_REGION' 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();
                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_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -,
                                                    mw_geographicRegion_identified
                    )))))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        // FIXME To be continued
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                )
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_08_BV
            
            /**
             * @desc    Check that the IUT supports at least 8 points in the polygonal certificate validity region 
             *          in the AT certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_IDENTIFIED_REGION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_E_AT_8)
             *          containing toBeSigned
             *              containing region
             *                  containing polygonalRegion
             *                      containing 8 entries
             *                          containing one of the items (I)
             *                              containing current IUT position
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT is requested to send a secured DENM 
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing headerInfo
             *                 containing generationLocation
             *                     indicating position inside I 
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_09_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6.4.17
             */
            testcase TC_SEC_ITSS_SND_CERT_09_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var HeaderInfo       v_headerInfo;
                var SignerIdentifier v_signerIdentifier;
                var Certificate      v_cert;
                var ItsDenm          v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_IDENTIFIED_REGION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_IDENTIFIED_REGION' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := cc_iutCert_A; // FIXME Review certificate to be used
                f_cf01Up();
                    
                // 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(
                                            mw_etsiTs103097Certificate(
                                                ?,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -,
                                                    mw_geographicRegion_polygonal
                                                )
                                            )
                                        )
                                     )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if (f_getMsgHeaderInfo(f_getSecuredMessage(v_geoNwInd.msgIn), v_headerInfo) and f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier)) {
                            var ThreeDLocation v_location := { v_headerInfo.generationLocation.latitude, v_headerInfo.generationLocation.longitude, v_headerInfo.generationLocation.elevation }; 
                            var integer v_counter;
                            
                            for (v_counter := 0; v_counter < lengthof(v_signerIdentifier.certificate); v_counter := v_counter + 1) {
                                if (f_isLocationInsideRegion(v_signerIdentifier.certificate[v_counter].toBeSigned.region, v_location) == false) {
                                    break;
                                }
                            } // End of of for statement
                            if (v_counter == lengthof(v_signerIdentifier.certificate)) {
                                log("*** " & testcasename() & ": PASS: AT certificate is inside the validity region of the issuing certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                            } else {
                                log("*** " & testcasename() & ": FAIL: AT certificate is not inside the validity region of the issuing certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            }
                        } else {
                            log("*** " & testcasename() & ": FAIL: IMPOSSIBLE!!! CAM 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 // containing digest
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected 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_CERT_09_BV
            
            // TODO TP_SEC_ITSS_SND_CERT_10_BV
            
            /**
             * @desc    Check that the validityPeriod of the subordinate certificate is inside the validityPeriod 
             *          of the issuing certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the CA is authorized with AA certificate 
             *          containing toBeSigned
             *              containing validityPeriod
             *                  containing start
             *                      indicating X_START_VALIDITY_AA
             *                  and containing duration
             *                      indicating X_START_DURATION_AA
             *  }
             *  ensure that {
             *      when {
             *          the IUT issued the certificate 
             *      } then {
             *          this certificate is of type EtsiTs103097Certificate
             *              containing signedData
             *                  containing validityPeriod
             *                      containing start
             *                          indicating X_START_VALIDITY_AT ( X_START_VALIDITY_AT >= X_START_VALIDITY_AA )
             *                      and containing duration
             *                          X_DURATION_AT <= X_START_VALIDITY_AA + X_DURATION_AA
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_11_BV
             * @reference   ETSI TS 103 097 [1], Clauses 5.2 & 7.1.3
             * @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_CERT_11_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var EtsiTs103097Certificate v_aa_certificate;
                var EtsiTs103097Certificate v_at_certificate;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                    
                // Test adapter configuration
                
                // Preamble
                f_readCertificate(cc_taCert_CC_AA, v_aa_certificate); // TODO Use PIXIT as array of strings to change 
                                                                      // certificates to be checked
                f_readCertificate(cc_iutCert_A, v_at_certificate);
                
                // Test Body
                // 1. Check certificate format
                if (
                    (v_aa_certificate.toBeSigned.validityPeriod.start_ >= v_at_certificate.toBeSigned.validityPeriod.start_) and 
                    (f_duration2time(v_at_certificate.toBeSigned.validityPeriod.duration) <= (v_aa_certificate.toBeSigned.validityPeriod.start_ + f_duration2time(v_aa_certificate.toBeSigned.validityPeriod.duration)))
                ) {
                    log("*** " & testcasename() & ": PASS: Validity periods are correct ***");
                    setverdict(pass);
                } else {
                    log("*** " & testcasename() & ": FAIL: Invalid validity period ***");
                    setverdict(fail);
                } // End of 'alt' statement
                                
                // Postamble
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_11_BV
            
            /**
             * @desc    Check that the certificate signature contains ECC point of type set to 
             *          either compressed_lsb_y_0, compressed_lsb_y_1 or x_coordinate_only.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (X_CERTIFICATE) 
             *  }
             *  ensure that {
             *      when {
             *          the IUT issued the certificate 
             *      } then {
             *          this certificate is of type EtsiTs103097Certificate
             *              containing signature
             *                  containing X_SIGNATURE
             *                       containing rSig
             *                           containing x-only
             *                           or containing compressed-y-0
             *                           or containing compressed-y-1
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_12_BV
             * @reference    IEEE 1609.2 [2], Clauses 6.3.29, 6.3.30, 6.3.31
             */
            testcase TC_SEC_ITSS_SND_CERT_12_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var GeoNetworkingInd        v_geoNwInd;
                
                // 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_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaNistP256(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_x_only
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaNistP256(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_compressed_y_0
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaNistP256(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_compressed_y_1
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP256r1(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_x_only
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP256r1(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_compressed_y_0
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP256r1(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_compressed_y_1
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP384r1(
                                            mw_ecdsaP384Signature(
                                                mw_eccP384CurvePoint_x_only
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP384r1(
                                            mw_ecdsaP384Signature(
                                                mw_eccP384CurvePoint_compressed_y_0
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP384r1(
                                            mw_ecdsaP384Signature(
                                                mw_eccP384CurvePoint_compressed_y_1
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Message with wrong signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CERT_12_BV
            
            /**
             * @desc    Check that the certificate verification key contains ECC point of type set to either 
             *          compressed_lsb_y_0, compressed_lsb_y_1 or uncompressed.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *  }
             *  ensure that {
             *      when {
             *          the IUT issued the certificate 
             *      } then {
             *          this certificate is of type EtsiTs103097Certificate
             *              containing toBeSigned 
             *                  containing verifyKeyIndicator
             *                       containing verificationKey
             *                           containing uncompressed
             *                           or containing compressed-y-0
             *                           or containing compressed-y-1
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_13_BV
             * @reference    IEEE 1609.2 [2], Clauses 6.3.29, 6.3.30, 6.3.31
             */
            testcase TC_SEC_ITSS_SND_CERT_13_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var GeoNetworkingInd        v_geoNwInd;
                
                // 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;
8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaNistP256(
                                                            mw_eccP256CurvePoint_uncompressed
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaNistP256(
                                                            mw_eccP256CurvePoint_compressed_y_0
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaNistP256(
                                                            mw_eccP256CurvePoint_compressed_y_1
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaBrainpoolP256(
                                                            mw_eccP256CurvePoint_uncompressed
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaBrainpoolP256(
                                                            mw_eccP256CurvePoint_compressed_y_0
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaBrainpoolP256(
                                                            mw_eccP256CurvePoint_compressed_y_1
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaBrainpoolP384(
                                                            mw_eccP384CurvePoint_uncompressed
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaBrainpoolP384(
                                                            mw_eccP384CurvePoint_compressed_y_0
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaBrainpoolP384(
                                                            mw_eccP384CurvePoint_compressed_y_1
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at
                                    )
                                )
                    ))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Message with wrong signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CERT_13_BV
            
            /**
             * @desc    Check that the certificate encryption key contains ECC point of type set to 
             *          either compressed_lsb_y_0, compressed_lsb_y_1 or uncompressed.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *       
             *  }
             *  ensure that {
             *      when {
             *          the IUT issued the certificate 
             *      } then {
             *          this certificate is of type EtsiTs103097Certificate
             *              containing toBeSigned 
             *                  containing encryptionKey
             *                       containing publicKey
             *                           containing uncompressed
             *                           or containing compressed-y-0
             *                           or containing compressed-y-1
             *      }
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_14_BV
             * @reference    IEEE 1609.2 [2], Clauses 6.4.38
            testcase TC_SEC_ITSS_SND_CERT_14_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var GeoNetworkingInd        v_geoNwInd;
                
                // 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_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -, -, -,
                                                    mw_encryptionKey(
                                                        -,
                                                        mw_publicEncryptionKey_ecdsaNistP256(
                                                            mw_eccP256CurvePoint_uncompressed
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -, -, -,
                                                    mw_encryptionKey(
                                                        -,
                                                        mw_publicEncryptionKey_ecdsaNistP256(
                                                            mw_eccP256CurvePoint_compressed_y_0
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -, -, -,
                                                    mw_encryptionKey(
                                                        -,
                                                        mw_publicEncryptionKey_ecdsaNistP256(
                                                            mw_eccP256CurvePoint_compressed_y_1
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -, -, -,
                                                    mw_encryptionKey(
                                                        -,
                                                        mw_publicEncryptionKey_eciesBrainpoolP256r1(
                                                            mw_eccP256CurvePoint_uncompressed
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -, -, -,
                                                    mw_encryptionKey(
                                                        -,
                                                        mw_publicEncryptionKey_eciesBrainpoolP256r1(
                                                            mw_eccP256CurvePoint_compressed_y_0
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -, -, -,
                                                    mw_encryptionKey(
                                                        -,
                                                        mw_publicEncryptionKey_eciesBrainpoolP256r1(
                                                            mw_eccP256CurvePoint_compressed_y_1
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Message with wrong signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CERT_14_BV
            
            /**
             * @desc    Check the certificate signature.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the CA is authorized with AA certificate 
             *          containing toBeSigned
             *              containing verifyKeyIndicator
             *                  containing verificationKey
             *                      containing X_KEY
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT issued the AT certificate 
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing issuer
             *                referencing the certificate
             *                    containing toBeSigned
             *                        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_CERT_15_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6
             */
            testcase TC_SEC_ITSS_SND_CERT_15_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var SequenceOfCertificate v_aa_certificate;
                var SignerIdentifier      v_signerIdentifier;
                var GeoNetworkingInd      v_geoNwInd;
                
                // 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();
                log("*** " & testcasename() & ": INFO: Wait for certificate and ask for AA certificate ***");
                tc_ac.start;
                f_askAndWaitForCertificateChain(v_aa_certificate, f_generateDefaultCam());
                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_cam
                                        ),
                                        mw_signerIdentifier_certificate( // Get the AT certificate
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at
                    ))))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if (f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier)) {
                            if (f_verifyCertificateSignatureWithIssuingCertificate(v_signerIdentifier.certificate[0], v_aa_certificate[0]) == true) {
                                log("*** " & testcasename() & ": PASS: AT certificate is signed by AA certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                            } else {
                                log("*** " & testcasename() & ": FAIL: AT/AA certificate signature mismatch ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            }
                        } else {
                            log("*** " & testcasename() & ": FAIL: IMPOSSIBLE!!! CAM 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_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                )
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_15_BV
            
            /**
             * @desc    Check the certificate signature.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the CA is authorized with AA certificate 
             *          containing toBeSigned
             *              containing verifyKeyIndicator
             *                  containing verificationKey
             *                      containing X_KEY
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT issued the AT certificate 
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing issuer
             *                referencing the certificate
             *                    containing toBeSigned
             *                        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_CERT_16_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6
             */
            testcase TC_SEC_ITSS_SND_CERT_16_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var SequenceOfCertificate v_aa_certificate;
                var SignerIdentifier      v_signerIdentifier;
                var GeoNetworkingInd      v_geoNwInd;
                
                // 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();
                log("*** " & testcasename() & ": INFO: Wait for certificate and ask for AA certificate ***");
                tc_ac.start;
                f_askAndWaitForCertificateChain(v_aa_certificate, f_generateDefaultCam());
                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_cam
                                        ),
                                        mw_signerIdentifier_certificate( // Get the AT certificate
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at
                    ))))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if (f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier)) {
                            var integer v_counter;
                            var charstring v_psid;
                            var template charstring v_found_pattern; // Used in regex to verify that 'v_psid' was not found before
                            
                            // Check in AA certificate
                            var charstring v_psid_found_aa := ";"; // Used to build the list of the Psid already processed
                            
                            for (v_counter := 0; v_counter < lengthof(v_aa_certificate[0].toBeSigned.appPermissions); v_counter := v_counter + 1) {
                                v_psid := int2str(v_aa_certificate[0].toBeSigned.appPermissions[v_counter].psid);
                                v_found_pattern := pattern "*({v_psid})*";
                                if (regexp(v_psid_found_aa, v_found_pattern, 0) == v_psid) {
                                    break; // v_psid exist at least 2 times, uniqueness is not verified
                                }
                                v_psid_found_aa := v_psid_found_aa & v_psid & ";";
                            } // End of 'for' statement
                            if (v_counter == lengthof(v_aa_certificate[0].toBeSigned.appPermissions)) {
                                var charstring v_psid_found_at := ";"; // Used to build the list of the Psid already processed
                                
                                for (v_counter := 0; v_counter < lengthof(v_signerIdentifier.certificate[0].toBeSigned.appPermissions); v_counter := v_counter + 1) {
                                    v_psid := int2str(v_signerIdentifier.certificate[0].toBeSigned.appPermissions[v_counter].psid);
                                    v_found_pattern := pattern "*({v_psid})*";
                                    if (regexp(v_psid_found_at, v_found_pattern, 0) == v_psid) {
                                        log("*** " & testcasename() & ": FAIL: AT certificate contains duplicated Psid ***"); 
                                        break; // v_psid exist at least 2 times, uniqueness is not verified
                                    } else if (regexp(v_psid_found_aa, v_found_pattern, 0) == v_psid) {
                                        log("*** " & testcasename() & ": FAIL: AT certificate contains a Psid not contained in AA certificate ***"); 
                                        break;
                                    }
                                    v_psid_found_at := v_psid_found_at & v_psid & ";";
                                } // End of 'for' statement
                                if (v_counter == lengthof(v_signerIdentifier.certificate[0].toBeSigned.appPermissions)) {
                                    log("*** " & testcasename() & ": PASS: Psid are unique in certificates ***"); 
                                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                                } else {
                                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                                }
                            } else {
                                log("*** " & testcasename() & ": FAIL: AA certificate contains duplicated Psid ***"); 
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            }
                        } else {
                            log("*** " & testcasename() & ": FAIL: IMPOSSIBLE!!! CAM 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_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                )
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_16_BV
            
            /**
             * @desc    Check that IUT supports at least 8 items in the appPermissions component of the certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT_A8)
             *          containing toBeSigned
             *              containing appPermissions
             *                  containing 8 entries
             *                      indicating the last item
             *                          containing psid
             *                              indicating the ‘AID_CAM’
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT is requested to send a secured CAM
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing containing content
             *                containing signedData
             *                    containing tbsData
             *                        containing headerInfo
             *                            containing psid
             *                                indicating 'AID_CAM'
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_17_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6
             */
            testcase TC_SEC_ITSS_SND_CERT_17_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT; // FIXME
                f_cf01Up();
                    
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                    ))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: ATS_AID was received ***"); 
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_17_BV
            
            /**
             * @desc    Check that all PSID entries of the certIssuePermissions component of the certificate are unique.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT issued the certificate 
             *             containing toBeSigned
             *                 containing certIssuePermissions
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing toBeSigned
             *                 containing certIssuePermissions
             *                     containing items of type PsidGroupPermissions
             *                     and containing subjectPermissions
             *                         containing explicit
             *                             containing items of type PsidSspRange
             *                                 containing psid
             *                                     indicating unique values in this sequence
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_18_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6.4.28 & 5.1.2.4
             */
            testcase TC_SEC_ITSS_SND_CERT_18_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var SequenceOfCertificate v_aa_certificate;
                var integer v_counter;
                var integer v_counter1;
                var charstring v_psid;
                var charstring v_psid_found_aa := ";"; // Used to build the list of the Psid already processed
                var template charstring v_found_pattern; // Used in regex to verify that 'v_psid' was not found before
                
                // 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();
                log("*** " & testcasename() & ": INFO: Wait for certificate and ask for AA certificate ***");
                tc_ac.start;
                f_askAndWaitForCertificateChain(v_aa_certificate, f_generateDefaultCam());
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                if (not(ispresent(v_aa_certificate[0].toBeSigned.certIssuePermissions))) {
                    log("*** " & testcasename() & ": FAIL: PsidGroupPermissions required in AA certificate ***"); 
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                } else {
                    for (v_counter := 0; v_counter < lengthof(v_aa_certificate[0].toBeSigned.certIssuePermissions); v_counter := v_counter + 1) {
                        if (match(v_aa_certificate[0].toBeSigned.certIssuePermissions[v_counter], mw_psidGroupPermissions(mw_subjectPermissions_explicit)) == false){
                            break;
                        }
                        for (v_counter1 := 0; v_counter1 < lengthof(v_aa_certificate[0].toBeSigned.certIssuePermissions[v_counter].subjectPermissions.explicit); v_counter1 := v_counter1 + 1) {
                            v_psid := int2str(v_aa_certificate[0].toBeSigned.certIssuePermissions[v_counter].subjectPermissions.explicit[v_counter1].psid);
                            v_found_pattern := pattern "*({v_psid})*";
                            if (regexp(v_psid_found_aa, v_found_pattern, 0) == v_psid) {
                                break; // v_psid exist at least 2 times, uniqueness is not verified
                            }
                            v_psid_found_aa := v_psid_found_aa & v_psid & ";";
                        } // End of 'for' statement
                        if (v_counter < lengthof(v_aa_certificate[0].toBeSigned.certIssuePermissions[v_counter].subjectPermissions.explicit)) {
                            break;
                        }
                    } // End of 'for' statement
                    if (v_counter == lengthof(v_aa_certificate[0].toBeSigned.certIssuePermissions)) {
                        log("*** " & testcasename() & ": PASS: Psid are unique in certificates ***"); 
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    } else {
                        log("*** " & testcasename() & ": FAIL: Wrong PsidGroupPermissions in AA certificate ***"); 
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_18_BV
            
            /**
             * @desc    Check that IUT supports at least 8 items in the certIssuePermissions component of the certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_A_AT_A8)
             *          containing appPermissions
             *              conformed to the certIssuePermissions
             *          issued by AA certificate (CERT_IUT_A_AA_C8)
             *              containing toBeSigned
             *                  containing certIssuePermissions
             *                      containing 8 entries
             *                          indicating the last item
             *                              containing psid
             *                                  indicating the ‘AID_CAM’
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT is requested to send a secured CAM
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing containing content
             *                containing signedData
             *                    containing tbsData
             *                        containing headerInfo
             *                            containing psid
             *                                indicating 'AID_CAM'
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_19_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6.4.8
             */
            testcase TC_SEC_ITSS_SND_CERT_19_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT; // FIXME
                f_cf01Up();
                    
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                    ))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: ATS_AID was received ***"); 
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_19_BV
             * @desc    Check that all PSID entries of the appPermissions component of the certificate are also 
             *          contained in the certIssuePermissions component in the issuing certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT issued the certificate 
             *             containing toBeSigned
             *                 containing certIssuePermissions
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing issuer
             *                 referenced to the certificate
             *                     containing toBeSigned
             *                         containing certIssuePermissions
             *                             containing items of type PsidGroupPermissions
             *                                 containing eeType
             *                                     indicating app(0)
             *                                 and containing subjectPermissions
             *                                     containing explicit
             *                                         containing items of type PsidSspRange
             *                                             indicating X_PSID_RANGE_LIST
             *                                     or containing all
             *             and containing toBeSigned
             *                 containing appPermissions
             *                    containing items of type PsidSsp
             *                        containing psid
             *                            contained in the X_PSID_RANGE_LIST
             *                                as a psid
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_20_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6.4.28 & 5.1.2.4
            testcase TC_SEC_ITSS_SND_CERT_20_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var SequenceOfCertificate v_aa_certificate;
                var SignerIdentifier      v_signerIdentifier;
                var GeoNetworkingInd      v_geoNwInd;
                
                // 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();
                log("*** " & testcasename() & ": INFO: Wait for certificate and ask for AA certificate ***");
                tc_ac.start;
                f_askAndWaitForCertificateChain(v_aa_certificate, f_generateDefaultCam());
                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_cam
                                        ),
                                        mw_signerIdentifier_certificate( // Get the AT certificate
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at
                    ))))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if (f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier)) {
                            var integer v_counter;
                            var integer v_counter1;
                            var charstring v_psid;
                            var charstring v_psid_found_aa := ";"; // Used to build the list of the Psid already processed
                            var template charstring v_found_pattern; // Used in regex to verify that 'v_psid' was not found before
                            
                            // Check in AA certificate
                            if (not(ispresent(v_aa_certificate[0].toBeSigned.certIssuePermissions))) {
                                log("*** " & testcasename() & ": FAIL: PsidGroupPermissions required in AA certificate ***"); 
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            } else {
                                for (v_counter := 0; v_counter < lengthof(v_aa_certificate[0].toBeSigned.certIssuePermissions); v_counter := v_counter + 1) {
                                    if (match(v_aa_certificate[0].toBeSigned.certIssuePermissions[v_counter], mw_psidGroupPermissions(mw_subjectPermissions_explicit)) == false){
                                        break;
                                    }
                                    for (v_counter1 := 0; v_counter1 < lengthof(v_aa_certificate[0].toBeSigned.certIssuePermissions[v_counter].subjectPermissions.explicit); v_counter1 := v_counter1 + 1) {
                                        v_psid := int2str(v_aa_certificate[0].toBeSigned.certIssuePermissions[v_counter].subjectPermissions.explicit[v_counter1].psid);
                                        v_found_pattern := pattern "*({v_psid})*";
                                        if (regexp(v_psid_found_aa, v_found_pattern, 0) == v_psid) {
                                            break; // v_psid exist at least 2 times, uniqueness is not verified
                                        }
                                        v_psid_found_aa := v_psid_found_aa & v_psid & ";";
                                    } // End of 'for' statement
                                    if (v_counter < lengthof(v_aa_certificate[0].toBeSigned.certIssuePermissions[v_counter].subjectPermissions.explicit)) {
                                        break;
                                    }
                                } // End of 'for' statement
                                if (v_counter == lengthof(v_aa_certificate[0].toBeSigned.certIssuePermissions)) {
                                    /*var charstring v_psid_found_at := ";"; // Used to build the list of the Psid already processed
                                    
                                    for (v_counter := 0; v_counter < lengthof(v_signerIdentifier.certificate[0].toBeSigned.appPermissions); v_counter := v_counter + 1) {
                                        v_psid := int2str(v_signerIdentifier.certificate[0].toBeSigned.appPermissions[v_counter].psid);
                                        v_found_pattern := pattern "*({v_psid})*";
                                        if (regexp(v_psid_found_at, v_found_pattern, 0) == v_psid) {
                                            log("*** " & testcasename() & ": FAIL: AT certificate contains duplicated Psid ***"); 
                                            break; // v_psid exist at least 2 times, uniqueness is not verified
                                        } else if (regexp(v_psid_found_aa, v_found_pattern, 0) == v_psid) {
                                            log("*** " & testcasename() & ": FAIL: AT certificate contains a Psid not contained in AA certificate ***"); 
                                            break;
                                        }
                                        v_psid_found_at := v_psid_found_at & v_psid & ";";
                                    } // End of 'for' statement
                                    if (v_counter == lengthof(v_signerIdentifier.certificate[0].toBeSigned.appPermissions)) {
                                        log("*** " & testcasename() & ": PASS: Psid are unique in certificates ***"); 
                                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                                    } else {
                                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                                    }*/

                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    log("*** " & testcasename() & ": PASS: Psid are unique in certificates ***"); 
                                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                                } else {
                                    log("*** " & testcasename() & ": FAIL: Wrong PsidGroupPermissions in AA certificate ***"); 
                                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                                }
                            }
                        } else {
                            log("*** " & testcasename() & ": FAIL: IMPOSSIBLE!!! CAM 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_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                )
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_20_BV
             * @desc    Check that SSP field in each entry of the appPermissions component of the AT certificate is 
             *          equal to or a subset of the SSP Range in the corresponding issuing entry.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT issued the certificate 
             *             containing toBeSigned
             *                 containing certIssuePermissions
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing issuer
             *                 referenced to the certificate
             *                     containing toBeSigned
             *                         containing certIssuePermissions
             *                             containing items of type PsidGroupPermissions
             *                                 containing eeType
             *                                     indicating app(0)
             *                                 and containing explicit
             *                                     containing psid
             *                                         indicating X_PSID_AA
             *                                     and containing sspRange
             *                                         indicating X_SSP_AA [ X_PSID_AA ]
             *                                 or containing all
             *             and containing toBeSigned
             *                 containing appPermissions
             *                    containing items of type PsidSsp
             *                        containing psid
             *                            indicating value equal to X_PSID_AA
             *                        and containing ssp
             *                            indicating value permitted by X_SSP_AA [ X_PSID_AA ]
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_21_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6.4.28 & 5.1.2.4
            testcase TC_SEC_ITSS_SND_CERT_21_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var SequenceOfCertificate v_aa_certificate;
                var SignerIdentifier      v_signerIdentifier;
                var GeoNetworkingInd      v_geoNwInd;
                
                // 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();
                log("*** " & testcasename() & ": INFO: Wait for certificate and ask for AA certificate ***");
                tc_ac.start;
                f_askAndWaitForCertificateChain(v_aa_certificate, f_generateDefaultCam());
                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_cam
                                        ),
                                        mw_signerIdentifier_certificate( // Get the AT certificate
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at
                    ))))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if (f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier)) {
                            // Check in AA certificate
                            if (not(ispresent(v_aa_certificate[0].toBeSigned.certIssuePermissions))) {
                                log("*** " & testcasename() & ": FAIL: PsidGroupPermissions required in AA certificate ***"); 
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            } else { // Parse AT SSP and compared it in AA
                                for (var integer v_counter := 0; v_counter < lengthof(v_signerIdentifier.certificate[0].toBeSigned.appPermissions); v_counter := v_counter + 1) {
                                    var Psid v_psid := v_signerIdentifier.certificate[0].toBeSigned.appPermissions[v_counter].psid;
                                    var ServiceSpecificPermissions v_ssp := v_signerIdentifier.certificate[0].toBeSigned.appPermissions[v_counter].ssp;
                                    for (var integer v_counter1 := 0; v_counter1 < lengthof(v_aa_certificate[0].toBeSigned.certIssuePermissions); v_counter1 := v_counter1 + 1) {
                                        var SequenceOfPsidSspRange v_psidSsps;
                                        var integer v_counter2;
                                        if (match(v_aa_certificate[0].toBeSigned.certIssuePermissions[v_counter], mw_psidGroupPermissions(mw_subjectPermissions_explicit)) == false){
                                            log("*** " & testcasename() & ": FAIL: AA  certificate field certIssuePermissions does not match ***");
                                            f_setVerdict(e_error);
                                            break;
                                        }
                                        v_psidSsps := v_aa_certificate[0].toBeSigned.certIssuePermissions[v_counter1].subjectPermissions.explicit;
                                        for (v_counter2 := 0; v_counter2 < lengthof(v_psidSsps); v_counter2 := v_counter2 + 1) {
                                            if (v_psidSsps[v_counter2].psid == v_psid) {
                                                if (ispresent(v_psidSsps[v_counter2].sspRange)) {
                                                    var SspRange v_sspRange := v_psidSsps[v_counter2].sspRange;
                                                    // Compare SSps
                                                    log(" Compare '", v_sspRange, "' with '", v_ssp, "'");
                                                    if (not(ischosen(v_sspRange.all_))) {
                                                        if (ischosen(v_sspRange.opaque) and ischosen(v_ssp.opaque)) {
                                                            // TODO How to compare values?
                                                        } else if (ischosen(v_sspRange.bitmapSspRange) and ischosen(v_ssp.bitmapSsp)) {
                                                            // TODO How to compare values?
                                                        } else {
                                                            log("*** " & testcasename() & ": FAIL: SSPs do not match ***");
                                                            f_setVerdict(e_error);
                                                            break;
                                                        }
                                                    } // else All rights are sey, nothing to check
                                                } else {
                                                    log("*** " & testcasename() & ": FAIL: AA certificate field SspRange field is missging ***");
                                                    f_setVerdict(e_error);
                                                    break;
                                                }
                                                break;
                                            }
                                        } // End of 'for' statement
                                        if (v_counter2 == lengthof(v_psidSsps)) { // Psid not found
                                            log("*** " & testcasename() & ": FAIL: psid ", v_psid, " not found in AT certificate ***");
                                            f_setVerdict(e_error);
                                            break;
                                        }
                                    } // End of 'for' statement
                                } // End of 'for' statement
                                if (getverdict == fail) {
                                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                                } else {
                                    log("*** " & testcasename() & ": PASS: SSP rage are well configured ***"); 
                                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                                }                                
                            }
                        } else {
                            log("*** " & testcasename() & ": FAIL: IMPOSSIBLE!!! CAM 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_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                )
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_21_BV
//            /**
//             * @desc Sending behaviour test cases for AA certificate profil
garciay's avatar
garciay committed
//             * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.2.7.7 AA certificate profile
//             */
//            group AA_Certificates {
//                
//                /**
//                 * @desc Check that the subject_type of the AA certificate is set to authorization_authority
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *   the IUT being in the 'authorized' state
//                 *   the IUT being requested to include certificate chain in the next CAM
//                 * } ensure that {
//                 *    when {
//                 *     the IUT is requested to send a CAM
//                 *   } then {
//                 *     the IUT sends a Ieee1609Dot2Data
//                 *       containing header_fields['signer_info'].signer
//                 *         containing type
//                 *           indicating 'certificate_chain'
//                 *         containing certificates[last-1]
//                 *           containing subject_info.subject_type
//                 *             indicating 'authorization_authority' (2)
//                 *   }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AA_01_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clause 7.4.4
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AA_01_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var SequenceOfCertificate         v_chain;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
//                    tc_ac.start;
//                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (lengthof(v_chain) < 2) {
//                        log("*** " & testcasename() & ": FAIL: Certificate chain is too short ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
//                    }
//                    if (not match(v_chain[lengthof(v_chain) - 2], mw_aa_certificate)) {
//                        log("*** " & testcasename() & ": FAIL: AA certificate not found in the chain[last-1] ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    log("*** " & testcasename() & ": PASS: AA certificate was found in the chain ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AA_01_01_BV
//                
//                /**
//                 * @desc Check that the AA certificsate subject_name variable-length vector contains 32 bytes maximum
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *   the IUT being in the 'authorized' state
//                 *   the IUT being requested to include certificate chain in the next CAM
//                 * } ensure that {
//                 *    when {
//                 *     the IUT is requested to send a CAM
//                 *   } then {
//                 *     the IUT sends a Ieee1609Dot2Data
//                 *       containing header_fields['signer_info'].signer
//                 *         containing type
//                 *           indicating 'certificate_chain'
//                 *         containing certificates[last-1]
//                 *           containing subject_info.subject_name
//                 *             indicating length <= 32 bytes
//                 *   }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AA_02_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clause 6.2
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AA_02_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var SequenceOfCertificate         v_chain;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
//                    tc_ac.start;
//                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (lengthof(v_chain) < 2) {
//                        log("*** " & testcasename() & ": FAIL: Certificate chain is too short ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
//                    }
//                    // Verified automatically on decoding
//                    if (lengthof(v_chain[lengthof(v_chain) - 2].subject_info.subject_name) > 32 ) {
//                        log("*** " & testcasename() & ": FAIL: Subject name of the AA certificate is too long ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    log("*** " & testcasename() & ": PASS: Subject name of the AA certificate is good ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AA_02_01_BV
//                
//                /**
//                 * @desc Check that signer_info type of AA certificates is set to 'certificate_digest_with_sha256'
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *   the IUT being in the 'authorized' state
//                 *   the IUT being requested to include certificate chain in the next CAM
//                 * } ensure that {
//                 *    when {
//                 *     the IUT is requested to send a CAM
//                 *   } then {
//                 *     the IUT sends a Ieee1609Dot2Data
//                 *       containing header_fields['signer_info'].signer
//                 *         containing type
//                 *           indicating 'certificate_chain'
//                 *         containing certificates[last-1]
//                 *           containing signer_info
//                 *             containing type
//                 *               indicating 'certificate_digest_with_sha256'
//                 *   }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AA_03_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clause 7.4.4
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AA_03_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var SequenceOfCertificate         v_chain;
//                    var Certificate              v_aa_cert;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
//                    tc_ac.start;
//                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (lengthof(v_chain) < 2) {
//                        log("*** " & testcasename() & ": FAIL: Certificate chain is too short ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
//                    }
//                    v_aa_cert := v_chain[lengthof(v_chain) - 2];
//                    if (not match(v_aa_cert, mw_aa_certificate(mw_signerIdentifier_digest))) {
//                        log("*** " & testcasename() & ": FAIL: AA certificate not signed by digest ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    log("*** " & testcasename() & ": PASS: AA certificate is signed by digest ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AA_03_01_BV
//                
//                /**
//                 * @desc Check that AA certificate is signed by Root CA or other authority
//                 * @remark There is no clear specification that AA cert shall be signed by the Root CA only
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *   the IUT being in the 'authorized' state
//                 *   the IUT being requested to include certificate in the next CAM
//                 * } ensure that {
//                 *    when {
//                 *     the IUT is requested to send a CAM
//                 *   } then {
//                 *     the IUT sends a Ieee1609Dot2Data
//                 *       containing header_fields['signer_info'].signer
//                 *         containing type
//                 *           indicating 'certificate_chain'
//                 *         containing certificates
//                 *           containing certificates[last-1]
//                 *             containing signer_info
//                 *               containing type
//                 *                 indicating 'certificate_digest_with_ecdsap256'
//                 *               and containing digest
//                 *                 referencing to the trusted certificate
//                 *                   containing subject_info.subject_type
//                 *                     indicating 'root_ca'
//                 *                     or indicating 'authorisation_authority'
//                 *   }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AA_04_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clauses 6.3
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AA_04_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var SequenceOfCertificate    v_chain;
//                    var Certificate         v_aa_cert, v_ca_cert;
//                    var SignerInfo          v_si;
//                    var HashedId8           v_ca_digest;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
//                    tc_ac.start;
//                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    v_aa_cert := v_chain[lengthof(v_chain) - 2];
//                    // Process signerInfo field
//                    if ( true != f_getCertificateSignerInfo(v_aa_cert, v_si)) {
//                        log("*** " & testcasename() & ": FAIL: AA certificate must contain SignerInfo fields ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    if (v_si.type_ == e_certificate_digest_with_sha256) {
//                        log("*** " & testcasename() & ": FAIL: AA certificate must contain SignerInfo field containing a certificate_digest_with_ecdsap256 ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    f_readCertificate(cc_taCert_CA, v_ca_cert);
//                    v_ca_digest := f_calculateDigestFromCertificate(v_ca_cert); 
//                    
//                    if (not match(v_aa_cert, mw_aa_certificate(mw_signerIdentifier_digest(v_ca_digest)))) {
//                        log("*** " & testcasename() & ": FAIL: AA certificate signer info doesn't reference the CA certificate from the chain ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    if (not f_verifyCertificateSignatureWithIssuingCertificate(v_aa_cert, v_ca_cert)) {
//                        log("*** " & testcasename() & ": FAIL: AT certificate signature verification failed ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    log("*** " & testcasename() & ": PASS: AA certificate was signed by the CA certificate from the given chain ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AA_04_01_BV
//                
//                /**
//                 * @desc Check that all neccesary subject attributes are present and arranged in accesing order
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *   the IUT being in the 'authorized' state
//                 *   the IUT being requested to include certificate chain in the next CAM
//                 * } ensure that {
//                 *    when {
//                 *     the IUT is requested to send a CAM
//                 *   } then {
//                 *     the IUT sends a Ieee1609Dot2Data
//                 *       containing header_fields['signer_info'].signer
//                 *         containing type
//                 *           indicating 'certificate_chain'
//                 *         containing certificates[last-1]
//                 *           containing subject_attributes [0..N]
//                 *             indicating subject_attributes[n].type < subject_attributes[n+ 1].type
//                 *             containing subject_attributes['verification_key']
//                 *             containing subject_attributes['assurance_level']
//                 *             containing subject_attributes['its_aid_list']
//                 *   }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AA_05_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clauses 6.1, 7.4.1 and 7.4.4
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AA_05_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var SequenceOfCertificate         v_chain;
//                    var SubjectAttributes        v_attrs;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
//                    tc_ac.start;
//                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (lengthof(v_chain) < 2) {
//                        log("*** " & testcasename() & ": FAIL: Certificate chain is too short ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
//                    }
//                    if (not match(v_chain[lengthof(v_chain) - 2], 
//                                 mw_aa_certificate(?,
//                                        superset(mw_subject_attribute_verification_key,
//                                                 mw_subject_attribute_assurance_level,
//                                                 mw_subject_attribute_its_aid_list)))
//                     ) {
//                        log("*** " & testcasename() & ": FAIL: Required subject attribute of AA certificate is not found ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    v_attrs := v_chain[lengthof(v_chain) - 2].subject_attributes;
//                    for (var integer v_counter := 1; v_counter < lengthof(v_attrs); v_counter := v_counter + 1 ) {
//                        if (v_attrs[v_counter].type_ <= v_attrs[v_counter-1].type_) {
//                            log("*** " & testcasename() & ": FAIL: AA certificate subject attributes are not arranged in accening order ***");
//                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                        }
//                    }
//                    
//                    log("*** " & testcasename() & ": PASS: All required AA certificate subject attributes are presents ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AA_05_01_BV
//                
//                /**
//                 * @desc Check that all AIDs containing in the its_aid_list in AA certificate are unique
//                 *       Check that AID list contains not more then 31 items
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *   the IUT being in the 'authorized' state
//                 *   the IUT being requested to include certificate chain in the next CAM
//                 * } ensure that {
//                 *    when {
//                 *     the IUT is requested to send a CAM
//                 *   } then {
//                 *     the IUT sends a Ieee1609Dot2Data
//                 *       containing header_fields['signer_info'].signer
//                 *         containing type
//                 *           indicating 'certificate_chain'
//                 *         containing certificates[last-1]
//                 *           containing subject_attributes['its_aid_list']
//                 *             containing its_aid_list[0..N]
//                 *               containing no more then 31 unique item
//                 *   }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AA_08_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clauses 7.4.4
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AA_08_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var SequenceOfCertificate         v_chain;
//                    var Certificate              v_aa_cert;
//                    var SubjectAttribute         v_sa;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
//                    tc_ac.start;
//                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (lengthof(v_chain) < 2) {
//                        log("*** " & testcasename() & ": FAIL: Certificate chain is too short ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
//                    }
//                    v_aa_cert := v_chain[lengthof(v_chain) - 2];
//                    if (f_getCertificateSubjectAttribute(v_aa_cert, e_its_aid_list, v_sa)) {
//                        
//                        if (lengthof(v_sa.attribute.its_aid_list) > 31) {
//                            log("*** " & testcasename() & ": FAIL: ITS-AID list contains " & int2str(lengthof(v_sa.attribute.its_aid_list)) & " items (>31) ***");
//                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                        }
//                        
//                        for (var integer v_counter :=0; v_counter < lengthof(v_sa.attribute.its_aid_list); v_counter := v_counter + 1) {
//                            for (var integer j :=0; j < lengthof(v_sa.attribute.its_aid_list); j := j + 1) {
//                                if (v_counter != j and v_sa.attribute.its_aid_list[v_counter] == v_sa.attribute.its_aid_list[j]) {
//                                    log("*** " & testcasename() & ": FAIL: ITS-AID " & int2str(v_sa.attribute.its_aid_list[j]) & " is duplicated in AA certificate ***");
//                                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                                }
//                            }
//                        } // End of 'for' statement
//                    } else {
//                        log("*** " & testcasename() & ": FAIL: AA certificate does not contain its_aid_list subject attribute ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    log("*** " & testcasename() & ": PASS: Time validity restriction of the AA certificate is good ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AA_08_01_BV
//                
//                /**
//                 * @desc Check that all mandatory validity restrictions are present and arranged in ascending order
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *   the IUT being in the 'authorized' state
//                 *   the IUT being requested to include certificate chain in the next CAM
//                 * } ensure that {
//                 *    when {
//                 *     the IUT is requested to send a CAM
//                 *   } then {
//                 *     the IUT sends a Ieee1609Dot2Data
//                 *       containing header_fields['signer_info'].signer
//                 *           containing type
//                 *               indicating 'certificate_chain'
//                 *           and containing certificates
//                 *               containing certificates[last-1]
//                 *                   containing validity_restrictions[0..N]
//                 *                       indicating validity_restrictions[n].type < validity_restrictions[n+1].type
//                 *                       and containing validity_restrictions['time_start_and_end']
//                 *                       and not containing validity_restrictions['time_end']
//                 *                       and not containing validity_restrictions['time_start_and_duration']
//                 *   }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AA_10_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clauses 6.1, 6.7 and 7.4.1
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AA_10_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    
//                    // Local variables
//                    var SequenceOfCertificate v_chain;
//                    var Certificate v_cert;
//                    var integer v_previousValidityRestrictionType;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
//                    tc_ac.start;
//                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    
//                    // Test Body
//                    // Process certificate[last - 1]
//                    v_cert := v_chain[lengthof(v_chain) - 2];
//                    if (match(
//                              v_cert.validity_restrictions, 
//                                  superset(
//                                      mw_validity_restriction_time_end,
//                                      mw_validity_restriction_time_start_and_duration
//                                  )
//                    )) {
//                        log("*** " & testcasename() & ": FAIL: certificate[last-2] must not contain time_end and time_start_and_duration restrictions ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    for (var integer v_counter := 1; v_counter < lengthof(v_cert.validity_restrictions); v_counter := v_counter + 1) {
//                        // Check forbidden header
//                        if (v_cert.validity_restrictions[v_counter].type_ != e_time_start_and_end) { // FIXME To be reviewed
//                            log("*** " & testcasename() & ": FAIL: Forbidden header present");
//                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                        } 
//                        
//                        if (v_counter > 1 ) {
//                            // Check that headers are ordered
//                            if (enum2int(v_cert.validity_restrictions[v_counter].type_) <= v_previousValidityRestrictionType) {
//                                // Check that header is duplicated
//                                if (enum2int(v_cert.validity_restrictions[v_counter].type_) == v_previousValidityRestrictionType) {
//                                    log("*** " & testcasename() & ": FAIL: multiple instances of same header");
//                                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                                } else {
//                                    log("*** " & testcasename() & ": FAIL: headers not in correct order");
//                                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                                }
//                            }
//                        }
//                        v_previousValidityRestrictionType := enum2int(v_cert.validity_restrictions[v_counter].type_);
//                    } // End of 'for' statement
//                    
//                    log("*** " & testcasename() & ": PASS: Time validity restriction of the certificate[last-2] is good ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AA_10_01_BV
//                
//                /**
//                 * @desc Check that time_start_and_end is included in the AA certificate validation restrictions;
//                 *       Check that end_validity is greater than start_validity
//                 *       Check that validity restriction of AA certificate is inside the validity restriction of its issuing certificate
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *   the IUT being in the 'authorized' state
//                 *   the IUT being requested to include certificate chain in the next CAM
//                 * } ensure that {
//                 *    when {
//                 *     the IUT is requested to send a CAM
//                 *   } then {
//                 *     the IUT sends a Ieee1609Dot2Data
//                 *       containing header_fields['signer_info'].signer
//                 *         containing type
//                 *           indicating 'certificate_chain'
//                 *         containing certificates[last-1] {
//                 *           containing validity_restrictions
//                 *             containing validity_restrictions['time_start_and_end']
//                 *               containing start_validity
//                 *                 indicating START_AA_VALIDITY
//                 *               containing end_validity
//                 *                 indicating END_AA_VALIDITY >=START_AA_VALIDITY
//                 *             and containing signer_info
//                 *               containing digest
//                 *                 referenced to the trusted certificate
//                 *                   containing validity_restrictions['time_end']
//                 *                     containing end_validity
//                 *                       indicating value > AA_END_VALIDITY
//                 *                   or containing validity_restrictions['time_start_and_end']
//                 *                     containing start_validity
//                 *                       indicating value <= AA_START_VALIDITY
//                 *                     and containing end_validity
//                 *                       indicating value > AA_END_VALIDITY
//                 *                   or containing validity_restrictions['time_start_and_duration']
//                 *                     containing start_validity
//                 *                       indicating X_START_VALIDITY <= AA_START_VALIDITY
//                 *                     and containing duration
//                 *                       indicating value > AA_END_VALIDITY - X_START_VALIDITY
//                 *   }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AA_11_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clauses 7.4.4
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AA_11_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var SequenceOfCertificate         v_chain;
//                    var Certificate              v_aa_cert;
//                    var ValidityRestriction      v_vr;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
//                    tc_ac.start;
//                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (lengthof(v_chain) < 2) {
//                        log("*** " & testcasename() & ": FAIL: Certificate chain is too short ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
//                    }
//                    v_aa_cert := v_chain[lengthof(v_chain) - 2];
//                    if (match (v_aa_cert.validity_restrictions, superset(mw_validity_restriction_time_end,
//                                                                          mw_validity_restriction_time_start_and_duration))
//                    ) {
//                        log("*** " & testcasename() & ": FAIL: AA certificate must not contain time_end and time_start_and_duration restrictions ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    if ( true != f_getCertificateValidityRestriction(v_aa_cert, e_time_start_and_end, v_vr)) {
//                        log("*** " & testcasename() & ": FAIL: AA certificate must contain time_start_and_end restrictions ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    if (v_vr.validity.time_start_and_end.start_validity > v_vr.validity.time_start_and_end.end_validity ) {
//                        log("*** " & testcasename() & ": FAIL: start validity mus not be greater then end validity in the validity restrictions of AA certificate ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    log("*** " & testcasename() & ": PASS: Time validity restriction of the AA certificate is good ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AA_11_01_BV
//                
//            } // End of group AA_Certificates 
//            
//            /**
//             * @desc Sending behaviour test cases for AT certificate profil
garciay's avatar
garciay committed
//             * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.2.7.8 AT certificate profile
//             */
//            group AT_Certificates {
//                
//                /**
//                 * @desc Check that the subject_type of the AT certificate is set to 'authorization_ticket'
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *     the IUT being in the 'authorized' state
//                 *     the IUT being requested to include certificate in the next CAM
//                 * } ensure that {
//                 *      when {
//                 *          the IUT is requested to send a CAM
//                 *     } then {
//                 *         the IUT sends a Ieee1609Dot2Data
//                 *             containing header_fields['signer_info'].signer
//                 *                 containing type
garciay's avatar
garciay committed
//                 *                     containing certificate
//                 *                 and containing certificate
//                 *                     containing subject_info.subject_type
//                 *                         indicating 'authorization_ticket' (1)
//                 *     }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AT_01_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clause 7.4.2
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AT_01_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var Certificate         v_at_cert;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Waiting for the message containing certificate  ***");
//                    tc_ac.start;
//                    if (not f_waitForCertificate(v_at_cert)) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (not match(v_at_cert, mw_at_certificate)) {
//                        log("*** " & testcasename() & ": FAIL: Message wasn't signed by AT certificate ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    log("*** " & testcasename() & ": PASS: AT certificate has the 'authorization_ticket' subject_type  ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AT_01_01_BV
//                
//                /**
//                 * @desc Check that the subject_name variable-length vector is empty for AT certificates
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *     the IUT being in the 'authorized' state
//                 *     the IUT being requested to include certificate in the next CAM
//                 * } ensure that {
//                 *      when {
//                 *          the IUT is requested to send a CAM
//                 *      } then {
//                 *          the IUT sends a Ieee1609Dot2Data
//                 *              containing header_fields['signer_info'].signer
//                 *                  containing type
garciay's avatar
garciay committed
//                 *                      containing certificate
//                 *                  and containing certificates
//                 *                      containing subject_info.subject_name
//                 *                          indicating length = 0
//                 *     }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AT_02_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clause 7.4.2
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AT_02_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var Certificate         v_at_cert;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Waiting for the message containing certificate  ***");
//                    tc_ac.start;
//                    if (not f_waitForCertificate(v_at_cert)) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (0 != lengthof(v_at_cert.subject_info.subject_name)) {
//                        log("*** " & testcasename() & ": FAIL: Subject name of the AT certificate is not empty ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    log("*** " & testcasename() & ": PASS: Subject name of the AT certificate is empty ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AT_02_01_BV
//                
//                /**
//                 * @desc Check that signer_info type of AT certificates is set to 'certificate_digest_with_sha256' 
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *     the IUT being in the 'authorized' state
//                 *     the IUT being requested to include certificate in the next CAM
//                 * } ensure that {
//                 *      when {
//                 *          the IUT is requested to send a CAM
//                 *      } then {
//                 *          the IUT sends a Ieee1609Dot2Data
//                 *              containing header_fields['signer_info'].signer
//                 *                  containing type
garciay's avatar
garciay committed
//                 *                      containing certificate
//                 *                  and containing certificate
//                 *                      containing signer_info
//                 *                          containing type
//                 *                              indicating 'certificate_digest_with_sha256'
//                 *      }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AT_03_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clauses 7.4.2
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AT_03_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var Certificate         v_at_cert;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Waiting for the message containing certificate  ***");
//                    tc_ac.start;
//                    if (not f_waitForCertificate(v_at_cert)) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (
//                        not match(v_at_cert, mw_certificate(mw_signerIdentifier_digest))
//                    ) {
//                        log("*** " & testcasename() & ": FAIL: AT certificate doesn't contain a digest of issuing cert ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    log("*** " & testcasename() & ": PASS: The signer info of AT certificate is a digest ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AT_03_01_BV
//                
//                /**
//                 * @desc Check that subject attributes are present and arranged in ascending order
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *     the IUT being in the 'authorized' state
//                 *     the IUT being requested to include certificate in the next CAM
//                 * } ensure that {
//                 *     when {
//                 *         the IUT is requested to send a CAM
//                 *     } then {
//                 *         the IUT sends a Ieee1609Dot2Data
//                 *             containing header_fields['signer_info'].signer
//                 *                 containing type
garciay's avatar
garciay committed
//                 *                     containing certificate
//                 *             containing certificate
//                 *                 containing subject_attributes [0..N]
//                 *                     indicating subject_attributes[n].type < subject_attributes[n+ 1].type
//                 *                 containing subject_attributes['verification_key']
//                 *                 containing subject_attributes['assurance_level']
//                 *                 containing subject_attributes['its_aid_ssp_list']
//                 *     }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AT_04_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clauses 7.4.1 and 7.4.2
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AT_04_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var Certificate         v_at_cert;
//                    var SubjectAttributes   v_attrs;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Waiting for the message containing certificate  ***");
//                    tc_ac.start;
//                    if (not f_waitForCertificate(v_at_cert)) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (not match(
//                        v_at_cert, 
//                            mw_at_certificate(
//                                ?,
//                                superset(
//                                    mw_subject_attribute_verification_key,
//                                    mw_subject_attribute_assurance_level,
//                                    mw_subject_attribute_its_aid_ssp_list
//                     )))) {
//                        log("*** " & testcasename() & ": FAIL: Required subject attribute of AT certificate is not found ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    v_attrs := v_at_cert.subject_attributes;
//                    for (var integer v_counter := 1; v_counter < lengthof(v_attrs); v_counter := v_counter + 1 ) {
//                        if (v_attrs[v_counter].type_ <= v_attrs[v_counter-1].type_) {
//                            log("*** " & testcasename() & ": FAIL: AT certificate subject attributes are not arranged in ascending order ***");
//                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                        }
//                    } // End of 'for' statement
//                    
//                    log("*** " & testcasename() & ": PASS: All required AT certificate subject attributes are presents and arranged in ascending order ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AT_04_01_BV
//                
//                /**
//                 * @desc Check that time_start_and_end is included in the AT certificate validation restrictions
//                 *       Check that time_start_and_end is inside the AA certificate time restrictions
//                 *       Check that validity restriction of AT certificate is inside the validity restriction of its issuing certificate 
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *   the IUT being in the 'authorized' state
//                 *   the IUT being requested to include certificate chain in the next CAM
//                 * } ensure that {
//                 *    when {
//                 *     the IUT is requested to send a CAM
//                 *   } then {
//                 *     the IUT sends a Ieee1609Dot2Data
//                 *       containing header_fields['signer_info'].signer
//                 *         containing type
//                 *           indicating 'certificate_chain'
//                 *         containing certificates[last] 
//                 *           containing subject_info.subject_type
//                 *             indicating 'authorization_ticket' (1)
//                 *           not containing validity_restrictions['time_end']
//                 *           and not containing validity_restrictions['time_start_and_duration']
//                 *           and containing validity_restrictions['time_start_and_end'] 
//                 *             containing start_validity
//                 *               indicating START_AT_VALIDITY
//                 *             and containing end_validity
//                 *               indicating END_AT_VALIDITY
//                 *         and containing certificates[last-1] 
//                 *           containing validity_restrictions['time_end']
//                 *             containing end_validity
//                 *               indicating value > AT_END_VALIDITY
//                 *           or containing validity_restrictions['time_start_and_end']
//                 *             containing start_validity
//                 *               indicating value <= AT_START_VALIDITY
//                 *             containing end_validity
//                 *               indicating value > AT_END_VALIDITY
//                 *           or containing validity_restrictions['time_start_and_duration']
//                 *             containing start_validity
//                 *               indicating X_START_VALIDITY <= AT_START_VALIDITY
//                 *             and containing duration
//                 *               indicating value > AT_END_VALIDITY - X_START_VALIDITY
//                 *   }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AT_05_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clause 7.4.2
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AT_05_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var SequenceOfCertificate         v_chain;
//                    var Certificate              v_aa_cert, v_at_cert;
//                    var ValidityRestriction      v_vr, v_aa_vr;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
//                    tc_ac.start;
//                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (lengthof(v_chain) < 2) {
//                        log("*** " & testcasename() & ": FAIL: Certificate chain is too short ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
//                    }
//                    v_aa_cert := v_chain[lengthof(v_chain) - 2];
//                    v_at_cert := v_chain[lengthof(v_chain) - 1];
//                    if (match (
//                        v_at_cert.validity_restrictions, 
//
//                            superset(
//                                mw_validity_restriction_time_end,
//                                mw_validity_restriction_time_start_and_duration
//                            )
//                    )) {
//                        log("*** " & testcasename() & ": FAIL: AT certificate must not contain time_end and time_start_and_duration restrictions ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    if ( true != f_getCertificateValidityRestriction(v_at_cert, e_time_start_and_end, v_vr)) {
//                        log("*** " & testcasename() & ": FAIL: AT certificate must contain time_start_and_end restrictions ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    if (v_vr.validity.time_start_and_end.start_validity > v_vr.validity.time_start_and_end.end_validity ) {
//                        log("*** " & testcasename() & ": FAIL: start validity must not be greater then end validity in the validity restrictions of AT certificate ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    if (true == f_getCertificateValidityRestriction(v_aa_cert, e_time_start_and_end, v_aa_vr)) {
//                        if (
//                            (v_vr.validity.time_start_and_end.start_validity < v_aa_vr.validity.time_start_and_end.start_validity) or 
//                            (v_vr.validity.time_start_and_end.end_validity > v_aa_vr.validity.time_start_and_end.end_validity)
//                        ) {
//                            log("*** " & testcasename() & ": FAIL: AT certificate time validity restriction must be inside the AA certificate time validity restriction ***"); 
//                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                        }
//                    } else if (true == f_getCertificateValidityRestriction(v_aa_cert, e_time_end, v_aa_vr)) {
//                        if (v_vr.validity.time_start_and_end.end_validity > v_aa_vr.validity.end_validity) {
//                            log("*** " & testcasename() & ": FAIL: AT certificate time validity restriction must be inside the AA certificate time validity restriction ***"); 
//                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                        }
//                    } else if (true == f_getCertificateValidityRestriction(v_aa_cert, e_time_start_and_duration, v_aa_vr)) {
//                        var Time64 v_end := v_aa_vr.validity.time_start_and_duration.start_validity + f_duration2time(v_aa_vr.validity.time_start_and_duration.duration_);
//                        if (
//                            (v_vr.validity.time_start_and_end.start_validity < v_aa_vr.validity.time_start_and_duration.start_validity) or 
//                            (v_vr.validity.time_start_and_end.end_validity > v_end)
//                        ) {
//                            log("*** " & testcasename() & ": FAIL: AT certificate time validity restriction must be inside the AA certificate time validity restriction ***"); 
//                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                        }
//                    } else {
//                        log("*** " & testcasename() & ": FAIL: Wrong AA certificate time restrictions ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    log("*** " & testcasename() & ": PASS: Time validity restriction of the AT certificate is good ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AT_05_01_BV
//                
//                /**
//                 * @desc Check that all AIDs containing in the its_aid_ssp_list in AT certificate are unique 
//                 *       Check that all AIDs containing in the its_aid_ssp_list in AT certificate are also containing in the 
//                 *       its_aid_list in the correspondent AA certificate
//                 *       Check that the length of SSP of each AID is 31 octet maximum
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *   the IUT being in the 'authorized' state
//                 *   the IUT being requested to include certificate chain in the next CAM
//                 * } ensure that {
//                 *    when {
//                 *     the IUT is requested to send a CAM
//                 *   } then {
//                 *     the IUT sends a Ieee1609Dot2Data
//                 *       containing header_fields['signer_info'].signer
//                 *         containing type
//                 *           indicating 'certificate_chain'
//                 *         containing certificates[last-1] 
//                 *           containing subject_info.subject_type
//                 *             indicating 'authorization_authority' (2)
//                 *           containing subject_attributes['its_aid_list']
//                 *             containing its_aid_list[0..N]
//                 *               indicating ITS_AID_LIST_AA
//                 *         containing certificates[last] 
//                 *           containing subject_info.subject_type
//                 *             indicating 'authorization_ticket' (1)
//                 *           containing subject_attributes['its_aid_ssp_list']
//                 *             containing its_aid_ssp_list[0..N] 
//                 *               containing its_aid_ssp_list[n]
//                 *                 containing its_aid
//                 *                   indicating unique value containing in the  ITS_AID_LIST_AA
//                 *                 containing service_specific_permissions
//                 *                   indicating length <= 31 octet
//                 *   }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AT_07_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clauses 6.9 and 7.4.2
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AT_07_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var SequenceOfCertificate         v_chain;
//                    var Certificate              v_aa_cert, v_at_cert;
//                    var SubjectAttribute         v_sa;
//                    var IntXs                    v_aid_list;
//                    var ItsAidSsps               v_aid_ssp_list;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
//                    tc_ac.start;
//                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (lengthof(v_chain) < 2) {
//                        log("*** " & testcasename() & ": FAIL: Certificate chain is too short ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
//                    }
//                    v_aa_cert := v_chain[lengthof(v_chain) - 2];
//                    v_at_cert := v_chain[lengthof(v_chain) - 1];
//                    if (not f_getCertificateSubjectAttribute(v_aa_cert, e_its_aid_list, v_sa)) {
//                        log("*** " & testcasename() & ": FAIL: AA certificate does not contain its_aid_list subject attribute ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    v_aid_list := v_sa.attribute.its_aid_list;
//                    
//                    if (not f_getCertificateSubjectAttribute(v_at_cert, e_its_aid_ssp_list, v_sa)) {
//                        log("*** " & testcasename() & ": FAIL: AA certificate does not contain its_aid_list subject attribute ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    v_aid_ssp_list := v_sa.attribute.its_aid_ssp_list;
//                    
//                    for (var integer v_counter :=0; v_counter < lengthof(v_aid_ssp_list); v_counter := v_counter + 1) {
//                        // Check unique
//                        for (var integer j :=0; j < lengthof(v_aid_ssp_list); j := j + 1) {
//                            if (v_counter != j and v_aid_ssp_list[v_counter].its_aid == v_aid_ssp_list[j].its_aid) {
//                                log("*** " & testcasename() & ": FAIL: ITS-AID " & int2str(v_aid_ssp_list[v_counter].its_aid) & " is duplicated in AT certificate ***");
//                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                            }
//                        } // End of 'for' statement
////                          if (not match(v_aid_ssp_list[v_counter], (all from v_aid_list))) {
////                              log("*** " & testcasename() & ": FAIL: ITS-AID " & int2str(v_aid_ssp_list[v_counter].its_aid) & " is not exist in AA certificate ***");
////                              f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
////                          }
//                        // TODO Not possible due to typing To be removed
////                          if (lengthof(v_aid_ssp_list[v_counter].service_specific_permissions.sspContainer) > 31) {
////                              log("*** " & testcasename() & ": FAIL: ITS-AID " & int2str(v_aid_ssp_list[v_counter].its_aid) & " has too long service_specific_permissions ***");
////                              f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
////                          }
//                    } // End of 'for' statement
//                    
//                    log("*** " & testcasename() & ": PASS: The ITS_AID_SSP list of the AT certificate is good ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AT_07_01_BV
//                
//                /**
//                 * @desc Check that AT certificate is signed by AA cert
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *   the IUT being in the 'authorized' state
//                 *   the IUT being requested to include certificate chain in the next CAM
//                 * } ensure that {
//                 *    when {
//                 *     the IUT is requested to send a CAM
//                 *   } then {
//                 *     the IUT sends a Ieee1609Dot2Data
//                 *       containing header_fields['signer_info'].signer
//                 *         containing type
//                 *           indicating 'certificate_chain'
//                 *         containing certificates[last-1] (CERT_AA)
//                 *           containing subject_info.subject_type
//                 *             indicating 'authorization_authority' (2)
//                 *           and containing subject_attributes['verification key'] (KEY)
//                 *         containing certificates[last] 
//                 *           containing subject_info.subject_type
//                 *             indicating 'authorization_ticket' (1)
//                 *           and containing signer_info[0]
//                 *             containing type
//                 *               indicating 'certificate_digest_with_sha256'
//                 *             containing digest
//                 *               referencing to CERT_AA
//                 *           and containing signature
//                 *             verifiable using KEY
//                 *   }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AT_08_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clause 6.3
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AT_08_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var SequenceOfCertificate         v_chain;
//                    var Certificate              v_aa_cert, v_at_cert;
//                    var HashedId8                v_aa_digest;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
//                    tc_ac.start;
//                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (lengthof(v_chain) < 2) {
//                        log("*** " & testcasename() & ": FAIL: Certificate chain is too short ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
//                    }
//                    v_at_cert := v_chain[lengthof(v_chain) - 1];
//                    v_aa_cert := v_chain[lengthof(v_chain) - 2];
//                    v_aa_digest := f_calculateDigestFromCertificate(v_aa_cert); 
//                    
//                    if (not match(v_at_cert, mw_at_certificate(mw_signerIdentifier_digest(v_aa_digest)))) {
//                        log("*** " & testcasename() & ": FAIL: AT certificate signer info doesn't reference the  AA certificate from the chain ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    if (not f_verifyCertificateSignatureWithIssuingCertificate(v_at_cert, v_aa_cert)) {
//                        log("*** " & testcasename() & ": FAIL: AT certificate signature verification failed ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    
//                    log("*** " & testcasename() & ": PASS: AT certificate was signed by the AA certificate from the given chain ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AT_08_01_BV
//                
//                /**
//                 * @desc Check that all necessary validity restrictions are present and arranged in ascending order 
//                 * <pre>
//                 * Pics Selection: PICS_GN_SECURITY
//                 * Config Id: CF01
//                 * with {
//                 *   the IUT being in the 'authorized' state
//                 *   the IUT being requested to include certificate in the next CAM
//                 * } ensure that {
//                 *    when {
//                 *     the IUT is requested to send a CAM
//                 *   } then {
//                 *     the IUT sends a Ieee1609Dot2Data
//                 *       containing header_fields['signer_info'].signer
//                 *         containing type
garciay's avatar
garciay committed
//                 *           containing certificate
//                 *         containing certificate
//                 *           containing subject_attributes [0..N]
//                 *             indicating subject_attributes[n].type < subject_attributes[n+ 1].type
//                 *             containing subject_attributes['verification_key']
//                 *             containing subject_attributes['assurance_level']
//                 *             containing subject_attributes['its_aid_ssp_list']
//                 *   }
//                 * }
//                 * </pre>
garciay's avatar
garciay committed
//                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AT_10_01_BV
//                 * @reference   ETSI TS 103 097 [1] Clauses 6.1
//                 */
//                testcase TC_SEC_ITSS_SND_CERT_AT_10_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                    var Certificate             v_at_cert;
//                    var ValidityRestriction     v_vr;
//                    var ValidityRestrictions    v_vrs;
//                    
//                    // Test control
//                    if (not(PICS_GN_SECURITY)) {
//                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                        stop;
//                    }
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    log("*** " & testcasename() & ": INFO: Waiting for the message containing certificate  ***");
//                    tc_ac.start;
//                    if (not f_waitForCertificate(v_at_cert)) {
//                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
//                    }
//                    tc_ac.stop;
//                    if (not match(
//                        v_at_cert, 
//                            mw_at_certificate(
//                                mw_signerIdentifier_certificate
//                     ))) {
//                    }
//                    
//                    if (true != f_getCertificateValidityRestriction(v_at_cert.signer_info.signerInfo.certificate, e_time_start_and_end, v_vr)) {
//                        log("*** " & testcasename() & ": FAIL: Required 'time_start_and_end' validity_restriction attribute of AT certificate is not found ***");
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                    }
//                    v_vrs := v_at_cert.signer_info.signerInfo.certificate.validity_restrictions;
//                    for (var integer v_counter := 1; v_counter < lengthof(v_vrs); v_counter := v_counter + 1 ) {
//                        if (v_vrs[v_counter].type_ <= v_vrs[v_counter-1].type_) {
//                            log("*** " & testcasename() & ": FAIL: AT certificate subject attributes are not arranged in ascending order ***");
//                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                        }
//                    } // End of 'for' statement
//                    
//                    log("*** " & testcasename() & ": PASS: All required AT certificate subject attributes are presents and arranged in ascending order ***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase TC_SEC_ITSS_SND_CERT_AT_10_01_BV
//                
//            } // End of group AT_Certificates 
        } // End of group profileForCertificates
    
    } // End of group sendingBehavior
    
    /**
     * @desc Receiver behaviour test cases
garciay's avatar
garciay committed
     * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.3 Receiver behaviour
     */
    group receiverBehavior {
         * @desc Receiving behaviour test cases for CAM profile
garciay's avatar
garciay committed
         * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.3.2 CAM Profile
        group recvCamProfile {
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured CAM containing certificate in signer_info
//             * <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_A_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing protocol_version 
//             *                  indicating value '2'
//             *              and containing header_fields[0]
//             *                  containing type 
//             *                      indicating 'signer_info'
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_AT_A)
//             *                          containing subject_info.subject_type
//             *                              indicating 'authorization_ticket' (2)
//             *                          and containing subject_attributes['verification key'] (KEY)
//             *              and containing header_fields [1]
//             *                  containing type
//             *                      indicating 'generation_time'
//             *                  containing generation_time
//             *                      indicating CURRENT_TIME
//             *              and containing header_fields[2] 
//             *                  containing type
//             *                      indicating 'its_aid'
//             *                  containing its_aid
//             *                      indicating 'AID_CAM'
//             *              and not containing any other header fields
//             *              and containing payload_field 
//             *                  containing type
//             *                      indicating 'signed'
//             *                  containing data
//             *                      indicating length > 0
//             *                      containing CAM payload
//             *              and containing trailer_fields 
//             *                  containing single instance of type TrailerField
//             *                      containing type
//             *                          indicating 'signature'
//             *                      containing signature
//             *                          verifiable using KEY
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_01_01_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_01_01_BV() 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_taCert_A, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_01_01_BV
//            
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured CAM containing certificate digest of the known certificate in signer_info
//             * <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_A_AT
//             *      and the IUT already sent a Secured message containing certificate (CERT_TS_A_AT)
//             *          containing subject_info.subject_type
//             *              indicating 'authorization_ticket' (2)
//             *          and containing subject_attributes['verification key'] (KEY)
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing protocol_version 
//             *                  indicating value '2'
//             *              and containing header_fields[0]
//             *                  containing type 
//             *                      indicating 'signer_info'
//             *                  and containing signer
//             *                      containing type
//             *                          indicating 'certificate_digest_with_sha256'
//             *                      and containing digest
//             *                          referencing to certificate (CERT_TS_A_AT)
//             *              and containing header_fields [1]
//             *                  containing type
//             *                      indicating 'generation_time'
//             *                  containing generation_time
//             *                      indicating CURRENT_TIME
//             *              and containing header_fields[2]
//             *                  containing type
//             *                      indicating 'its_aid'
//             *                  containing its_aid
//             *                      indicating 'AID_CAM'
//             *              and not containing any other header fields
//             *              and containing payload_field 
//             *                  containing type
//             *                      indicating 'signed'
//             *                  containing data
//             *                      indicating length > 0
//             *                      containing CAM payload
//             *              and containing trailer_fields
//             *                  containing single instance of type TrailerField
//             *                      containing type
//             *                          indicating 'signature'
//             *                      containing signature
//             *                          verifiable using KEY
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_01_02_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_01_02_BV() 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_taCert_A, omit, e_certificate_digest_with_sha256);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_01_02_BV
//            
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured CAM containing certificate chain in signer_info
//             * <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_A_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing protocol_version 
//             *                  indicating value '2'
//             *              and containing header_fields[0]
//             *                  containing type 
//             *                      indicating 'signer_info'
//             *                  and containing signer
//             *                      containing type
//             *                          indicating 'certificate_chain'
//             *                      and containing certificates
//             *                          containing certificate (CERT_TS_A_AA) at index 0 
//             *                              containing subject_info.subject_type
//             *                                  indicating 'authorization_authority'
//             *                              and containing subject_attributes['verification key'] (KEY_TS_AA)
//             *                          and containing certificate (CERT_TS_A_AT) at index 1 
//             *                              containing subject_info.subject_type
//             *                                  indicating 'authorization_ticket'
//             *                              and containing signer_info 
//             *                                  containing type
//             *                                      indicating 'certificate_digest_with_sha256'
//             *                                  containing digest
//             *                                      referencing to the CERT_TS_A_AA
//             *                              and containing signature
//             *                                  verifiable using KEY_TS_AA
//             *                              and containing subject_attributes['verification key'] (KEY_TS_AT)
//             *              and containing header_fields [1] 
//             *                  containing type
//             *                      indicating 'generation_time'
//             *                  containing generation_time
//             *                      indicating CURRENT_TIME
//             *              and containing header_fields[2] 
//             *                  containing type
//             *                      indicating 'its_aid'
//             *                  containing its_aid
//             *                      indicating 'AID_CAM'
//             *              and not containing any other header fields
//             *              and containing payload_field 
//             *                  containing type
//             *                      indicating 'signed'
//             *                  containing data
//             *                      indicating length > 0
//             *                      containing CAM payload
//             *              and containing trailer_fields 
//             *                  containing single instance of type TrailerField 
//             *                      containing type
//             *                          indicating 'signature'
//             *                      containing signature
//             *                          verifiable using KEY_TC_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_01_03_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_01_03_BV() 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_taCert_A, -, e_certificate_chain);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                 
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_01_03_BV
//            
//            /**
//             * @desc    Check that IUT discards a Secured CAM containing protocol version set to a value less then 2
//             * <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_A_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *              containing protocol_version 
//             *                  indicating 1
//             *      } then {
//             *          the IUT discards a Ieee1609Dot2Data
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_02_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 5.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_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_Bo(cc_taCert_A, PX_WRONG_PROTOCOL_VERSION);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_02_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured CAM containing protocol version set to a value greater then 2
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * Config Id: CF01
//             * Initial conditions:
//             *  with {
//             *      the IUT being in the 'authorized' state
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *              containing protocol_version 
//             *                  indicating 3
//             *      } then {
//             *          the IUT discards a Ieee1609Dot2Data
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_02_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 5.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_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_Bo(cc_taCert_A, PX_WRONG_PROTOCOL_VERSION); // Change PX_WRONG_PROTOCOL_VERSION to 3
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_02_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured CAM if the header_fields contains more than one element of header field type: signer_info
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[3]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_CAM'
//             *          and not containing other header fields
//             *  } 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_CAM_04_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )), 
//                        m_header_info_signer_info(
//                            m_signerIdentifier_certificate(
//                                vc_atCertificate
//                        )), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured CAM if the header_fields does not contain the header field type: signer_info
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01) 
//             *          containing header_fields[0].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[1]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_CAM'
//             *          and not containing other header fields
//             *  } 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_CAM_04_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_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();
//                if (PICS_DEBUG_ADDON) {
//                    f_sendCertificateAndWaitForCertificateChainRequest(cc_taCert_F, f_generateDefaultCam());
//                }
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_02_BO
//            
//            /**
//             * @desc    Check that IUT is able to receive a secured CAM if the signer_info header field is not encoded first
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *    the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *      containing header_fields[0].type
//             *        indicating 'signer_info'
//             *      and containing header_fields[1].type
//             *        indicating 'generation_time'
//             *      and containing header_fields[2].type
//             *        indicating 'signer_info'
//             *      and containing header_fields[3]
//             *        containing type
//             *          indicating 'its_aid'
//             *        containing its_aid
//             *          indicating 'AID_CAM'
//             *      and not containing other header fields
//             *  } 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_CAM_04_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM,
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        ))
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_03_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured CAM if the header_fields doesn't contain the element of header field of type: generation_time
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_CAM'
//             *       and not containing other header fields
//             *  } 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_CAM_04_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )), 
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_04_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured CAM if the header_fields does not contain the header field type: generation_time
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_CAM'
//             *          and not containing other header fields
//             *  } 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_CAM_04_05_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_05_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )), 
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_05_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured CAM if the header_fields contain more than one element of header field of type: its_aid
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_CAM'
//             *          and containing header_fields[3]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_DENM'
//             *       and not containing other header fields
//             *  } 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_CAM_04_06_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_06_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM,
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_06_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured CAM if the header_fields contain more than one element of header field of type: its_aid
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *       and not containing other header fields
//             *  } 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_CAM_04_06a_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_06a_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()) // In us
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_06a_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured CAM if the header fields are not in the ascending order according to the numbering of the enumeration
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_CAM'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_time'
//             *       and not containing other header fields
//             *  } 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_CAM_04_07_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_07_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )), 
//                        m_header_info_its_aid_CAM,
//                        m_header_info_generation_time(1000 * f_getCurrentTime()) // In us
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_07_BO
//            
//            /**
//             * @desc    Check that IUT ignores the HeaderInfo generation_time_standard_deviation of received Secured CAM
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *                  indicating TIME_1 inside the validity period of the signer certificate
//             *          and containing header_fields[2].type
//             *              indicating 'generation_time_with_standard_deviation'
//             *                  indicating TIME_2 inside the validity period of the signer certificate
//             *          and containing header_fields[3]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_CAM'
//             *       and not containing other header fields
//             *  } 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_CAM_04_08_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_08_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_time_with_standard_deviation(
//                            m_time64WithStandardDeviation(
//                                1000, // In us
//                                0
//                        )), 
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_08_BO
//            
//            /**
//             * @desc    Check that IUT ignores the HeaderInfo generation_time_standard_deviation of received Secured CAM
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *                  indicating TIME_1 outside the validity period of the signer certificate
//             *          and containing header_fields[2].type
//             *              indicating 'generation_time_with_standard_deviation'
//             *                  indicating TIME_2 inside the validity period of the signer certificate
//             *          and containing header_fields[3]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_CAM'
//             *       and not containing other header fields
//             *  } 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_CAM_04_09_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_09_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_time_with_standard_deviation(
//                            m_time64WithStandardDeviation(
//                                1000 * f_getCurrentTime(), // In us
//                                0
//                        )), 
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_09_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured CAM containing the expiry_time HeaderInfo
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *                  indicating CURRENT_TIME
//             *          and containing header_fields[2]
//             *              containing type
//             *                  indicating 'expiration'
//             *              and containing expiry_time
//             *                  indicating CURRENT_TIME + 1h
//             *          and containing header_fields[3]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_CAM'
//             *       and not containing other header fields
//             *  } 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_CAM_04_10_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_10_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )), 
//                        m_header_info_generation_time(
//                            1000 * f_getCurrentTime()
//                        ), // In us
//                        m_header_info_expiry_time(
//                            f_getCurrentTime() - 3600/*1h*/
//                        ), 
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_10_BO
//            
//            /**
//             * @desc    Check that IUT ignores the HeaderInfo generation_location of received Secured CAM
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *              and containing signer
//             *                  containing type
//             *                      indicating certificate
//             *                  and containing certificate (CERT_TS_AT_B)
//             *                      containing validity_restrictions['region']
//             *                          containing region (X_CERT_REGION)
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2]
//             *              containing type
//             *                  indicating 'generation_location'
//             *              and containing generation_location
//             *                  indicating position outside of the validity restriction of X_CERT_REGION
//             *          and containing header_fields[3]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_CAM'
//             *       and not containing other header fields
//             *  } 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_CAM_04_11_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_11_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_prepareSecuredCam(
//                    cc_taCert_B, 
//                    {
//                        m_header_info_generation_time(1000 * (f_getCurrentTime())), // In us
//                        m_header_info_generation_location(
//                            m_threeDLocation(
//                                PX_WGSLONGITUDE,
//                                PX_WGSLATITUDE,
//                                int2oct(0, 2)
//                            )
//                        ), 
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate,
//                    true
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_11_BO
//            
//            /**
//             * @desc    Check that IUT accepts the Secured CAM containing additional non-standard HeaderInfo
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_CAM'
//             *          and containing header_fields[3]
//             *              containing type
//             *                  indicating non-standard header field type (200)
//             *              and containing other_header
//             *                  indicating non-empty data
//             *          and not containing other header fields
//             *  } 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_CAM_04_12_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_12_BV() 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_prepareSecuredCam(
//                    cc_taCert_B, 
//                    {
//                        m_header_info_generation_time(1000 * (f_getCurrentTime())), // In us
//                        m_header_info_generation_location(
//                            m_threeDLocation(
//                                PX_WGSLONGITUDE,
//                                PX_WGSLATITUDE,
//                                int2oct(0, 2)
//                            )
//                        ), 
//                        m_header_info_its_aid_CAM,
//                        m_header_info_unspecify
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    true
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_04_12_BV
//            
//            /**
//             * @desc    Check that IUT discards the Secured CAM containing the header field 'encryption_parameter and recipient_info'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when {  
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_CAM'
//             *          and containing header_fields[3]
//             *              containing type
//             *                  indicating 'encryption_parameters'
//             *              and containing enc_params
//             *                  containing symm_algorithm
//             *                      indicating 'aes_128_ccm'
//             *                  and containing nonce
//             *              and containing header_fields[4]
//             *                  containing type
//             *                      indicating 'recipient_info'
//             *                  and containing recipients
//             *                      containing recipients[0]
//             *                          containing cert_id
//             *                              referencing to CERT_IUT_A_AT
//             *                          and containing pk_encryption
//             *                              indicating 'ecies_nistp256'
//             *                          and containing enc_key
//             *          and not containing other header fields
//             *  } 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_CAM_04_13_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_04_13_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var Certificate v_iutATCertificate;
//                var SubjectAttribute v_encryption_key;
//                
//                // 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
//                if (
//                    (f_readCertificate(cc_iutCert_A, v_iutATCertificate) == false) or 
//                    (f_getCertificateSubjectAttribute(v_iutATCertificate, e_encryption_key, v_encryption_key) == false)
//                    ) {
//                    f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout); // Set verdict to inconc
//                } else {
//                    v_securedGnPdu := f_prepareSecuredCam(
//                        cc_taCert_B, 
//                        {
//                            m_header_info_generation_time(1000 * (f_getCurrentTime())), // In us
//                            m_header_info_generation_location(
//                                m_threeDLocation(
//                                    PX_WGSLONGITUDE,
//                                    PX_WGSLATITUDE,
//                                    int2oct(0, 2)
//                                )
//                            ), 
//                            m_header_info_its_aid_CAM,                                 // containing header_fields[2].type
//                                                                                        //     indicating 'its_aid'
//                            m_header_info_enc_params(                                  // containing header_fields[3].type.enc_params
//                                m_encryptionParameters_aes_128_ccm(                     //      indicating 'aes_128_ccm'
//                                    PX_ENCRYPTIONPARAMETERS_AES_128_CCM_NONCE           // and containing nonce
//                                )
//                            ),
//                            m_header_info_multiple_recipients(                         // containing header_fields[4].type
//                                {                                                       //     indicating 'encryption_parameters'
//                                    m_recipientInfo_ecies_enc_key(
//                                        v_iutATCertificate.signer_info.signerInfo.digest,
//                                        e_ecies_nistp256,                               // containing symm_algorithm
//                                                                                        //     indicating 'aes_128_ccm'
//                                        m_eciesEncryptedKey_aesccm(
//                                            v_encryption_key.attribute.rv,
//                                            '00000000000000000000000000000000'O, // FIXME Where to find these values
//                                            '00000000000000000000000000000000'O
//                                        )
//                                    )
//                                }
//                            )
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        true
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    
//                    f_sleep(PX_TNOAC);
//                    v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                    for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                        // Empty on purpose 
//                    } // End of 'for' statement
//                    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_CAM_04_13_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured CAM if the header_fields contains a signer of type 'self'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *                  containing signer.type
//             *                      indicating 'self'
//             *  } 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_CAM_05_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_05_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();
//                if (PICS_DEBUG_ADDON) {
//                    f_sendCertificate(cc_taCert_F, f_generateDefaultCam());
//                }
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_signerIdentifier_self
//                        ), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_self,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_05_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured CAM if the header_fields contains a signer of type certificate_digest_with_other_algorithm
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_02) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *                  containing signer.type
//             *                      indicating 'certificate_digest_with_other_algorithm'
//             *  } 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_CAM_05_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_05_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();
//                if (PICS_DEBUG_ADDON) {
//                    f_sendCertificate(cc_taCert_F, f_generateDefaultCam());
//                }
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_signerIdentifier_other_certificates(
//                                m_certificateWithAlgo_ecdsa(
//                                    PX_OTHER_CERT_DIGEST
//                        ))), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate_digest_with_other_algorithm,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_05_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured CAM if the header_fields contains a signer of type certificate_chain and the chain is empty
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_02) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *                  containing signer.type
//             *                      indicating 'certificate_chain'
//             *                  and containing certificates
//             *                      indicating length = 0
//             *  } 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_CAM_05_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_05_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();
//                if (PICS_DEBUG_ADDON) {
//                    f_sendCertificate(cc_taCert_F, f_generateDefaultCam());
//                }
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_signerIdentifier_certificates(
//                                { }
//                        )), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate_chain,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_05_03_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured CAM if the header_fields contains a signer of type certificate_chain and the chain contains only one certificate
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_03) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *                  containing signer.type
//             *                      indicating 'certificate_chain'
//             *                  and containing certificates
//             *                      indicating length = 1
//             *  } 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_CAM_05_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_05_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_signerIdentifier_certificates(
//                                { vc_atCertificate }
//                        )), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate_chain,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_05_04_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured CAM if the header_fields contains a signer info of unknown or reserved type
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_02) 
//             *          containing header_fields['signer_info']
//             *                  containing signer.type
//             *                      indicating X_UNKNOWN_SIGNERINFO_TYPE
//             *  } 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_CAM_05_05_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_05_05_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_signerIdentifier_unknown(
//                                'CAFFEEDECA'O
//                        )), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_unknown,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_05_05_BO
//            
//            /**
//             * @desc    Check that IUT discards message containing generation_time before the certificate validity period
//             * <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_A_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *              and containing header_fields['signer_info'].signer 
//             *                  containing certificate (CERT_TS_MSG_06_01_BO_AT)
//             *                      containing validity_restrictions['time_start_and_end']
//             *                          containing start_validity
//             *                              indicating START_VALIDITY_AT
//             *                          and containing end_validity
//             *                              indicating END_VALIDITY_AT
//             *              and containing header_fields ['generation_time']
//             *                  containing generation_time
//             *                      indicating GEN_TIME < 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_CAM_06_01_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 5.4 and 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_06_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var ValidityRestriction v_timeValidity;
//                
//                // 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
//                f_getCertificateValidityRestriction(vc_atCertificate, e_time_start_and_end, v_timeValidity);
//                v_securedGnPdu := f_prepareSecuredCam(
//                    cc_taCert0601_BO, 
//                    {
//                        m_header_info_generation_time( 
//                            (v_timeValidity.validity.time_start_and_end.start_validity - 3600) * 1000
//                        ) // In us
//                    },
//                    e_certificate
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_06_01_BO
//            
//            /**
//             * @desc    Check that IUT discards message containing generation_time after the certificate validity period
//             * <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_A_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *              and containing header_fields['signer_info'].signer 
//             *                  containing certificate (CERT_TS_MSG_06_02_BO_AT)
//             *                      containing validity_restrictions['time_start_and_end']
//             *                          containing start_validity
//             *                              indicating START_VALIDITY_AT
//             *                          and containing end_validity
//             *                              indicating END_VALIDITY_AT
//             *              and containing header_fields ['generation_time']
//             *                  containing generation_time
//             *                      indicating GEN_TIME > END_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_CAM_06_02_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 5.4 and 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_06_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var ValidityRestriction v_timeValidity;
//                
//                // 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
//                f_getCertificateValidityRestriction(vc_atCertificate, e_time_start_and_end, v_timeValidity);
//                v_securedGnPdu := f_prepareSecuredCam(
//                    cc_taCert0602_BO, 
//                    {
//                        m_header_info_generation_time( 
//                            (v_timeValidity.validity.time_start_and_end.end_validity + 3600) * 1000
//                        ) // In us
//                    },
//                    e_certificate
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_06_02_BO
//            
//            /**
//             * @desc    Check that IUT discards Secured CAM if the generation_time is more than 5 minute in the past (C2C only)
//             * <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_A_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *          containing header_fields ['generation_time']
//             *              containing generation_time
//             *                  indicating GEN_TIME ( CURRENT_TIME - 302sec )
//             *      } 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_CAM_06_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_06_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_generation_time(
//                            (1000 * f_getCurrentTime() - 302) * 1000
//                        ) // In us
//                    },
//                    e_certificate_digest_with_sha256
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_06_03_BO
//            
//            /**
//             * @desc    Check that IUT discards Secured CAM if the generation_time is more than 5 minute in the future(C2C only)
//             * <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_A_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *          containing header_fields ['generation_time']
//             *              containing generation_time
//             *                  indicating GEN_TIME ( CURRENT_TIME + 302sec )
//             *      } 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_CAM_06_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_06_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_generation_time(
//                            (1000 * f_getCurrentTime() + 302) * 1000
//                        ) // In us
//                    },
//                    e_certificate_digest_with_sha256
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_06_04_BO
//            
//            /**
//             * @desc    Check that IUT discards secured CAM when its_aid value is not AID_CAM
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *     when {  
//             *         the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01) 
//             *             containing header_fields['its_aid'] 
//             *                 indicating AID_DENM 
//             *             and containing payload_field { 
//             *                 containing type 
//             *                     indicating 'signed' 
//             *                 containing data 
//             *                     containing CAM payload 
//             *             } 
//             *     } 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_CAM_07_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_07_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_its_aid_DENM
//                    },
//                    e_certificate_digest_with_sha256
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_07_01_BO
//            
//            /**
//             * @desc    Check that IUT discards secured CAM when its_aid value is undefined
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *     when {  
//             *         the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01) 
//             *             containing header_fields['its_aid'] 
//             *                 indicating 'AID_UNDEFINED' 
//             *             and containing payload_field { 
//             *                 containing type 
//             *                     indicating 'signed' 
//             *                 containing data 
//             *                     containing CAM payload 
//             *             } 
//             *     } 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_CAM_07_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_07_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_its_aid_Other
//                    },
//                    e_certificate_digest_with_sha256
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_07_02_BO
//            
//            /**
//            * @desc    Check that IUT discards the Secured CAM containing empty payload of type 'signed'.
//            * <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_A_AT
//            *   }
//            *   ensure that {
//            *       when {
//            *           the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//            *               containing payload_field
//            *                   containing type
//            *                       indicating 'signed'
//            *                   and containing data
//            *                       indicating length 0
//            *       } 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_CAM_09_02_BO
//            * @reference    ETSI TS 103 097 [1] Clause 7.1
//            */
//            testcase TC_SEC_ITSS_RCV_CAM_09_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnNonSecuredPacket v_gnNonSecuredPacket;
//                var octetstring v_gnPayload;
//                var template (value) Ieee1609Dot2Data v_securedMessage;
//                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_gnNonSecuredPacket := valueof(m_geoNwShbPacket(f_getPosition(c_compNodeC)));
//                v_gnNonSecuredPacket.payload := valueof(
//                    valueof(
//                        bit2oct(
//                            encvalue(
//                                m_camReq(
//                                    m_camMsg_vehicle_HF_BV(
//                                        f_getTsStationId(),
//                                        f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
//                                        LibItsCam_Templates.m_tsPosition
//                ))))));
//                v_gnPayload := bit2oct(encvalue(v_gnNonSecuredPacket));
//                f_buildGnSecuredCam(
//                    v_securedMessage,
//                    m_payload_signed(
//                        ''O
//                    )
//                );
//                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_09_02_BO
//            
//            /**
//            * @desc    Check that IUT discards the Secured CAM containing non-empty payload of type 'unsecured'
//            * <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_A_AT
//            *   }
//            *   ensure that {
//            *       when {
//            *           the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//            *               containing payload_field
//            *                   containing type
//            *                       indicating 'unsecured'
//            *                   and containing data
//            *                       indicating length > 0
//            *       } 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_CAM_09_03_BO
//            * @reference    ETSI TS 103 097 [1] Clause 7.1
//            */
//            testcase TC_SEC_ITSS_RCV_CAM_09_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnNonSecuredPacket v_gnNonSecuredPacket;
//                var octetstring v_gnPayload;
//                var template (value) Ieee1609Dot2Data v_securedMessage;
//                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_gnNonSecuredPacket := valueof(m_geoNwShbPacket(f_getPosition(c_compNodeC)));
//                v_gnNonSecuredPacket.payload := valueof(
//                    valueof(
//                        bit2oct(
//                            encvalue(
//                                m_camReq(
//                                    m_camMsg_vehicle_HF_BV(
//                                        f_getTsStationId(),
//                                        f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
//                                        LibItsCam_Templates.m_tsPosition
//                ))))));
//                v_gnPayload := bit2oct(encvalue(v_gnNonSecuredPacket));
//                f_buildGnSecuredCam(
//                    v_securedMessage,
//                    m_payload_unsecured(
//                        v_gnPayload
//                    )
//                );
//                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_09_03_BO
//
//            /**
//            * @desc    Check that IUT discards the Secured CAM containing non-empty payload of type 'encrypted'
//            * <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_A_AT
//            *   }
//            *   ensure that {
//            *       when {
//            *           the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//            *               and containing payload_field
//            *                   containing type
//            *                       indicating 'encrypted'
//            *                   and containing data
//            *                       indicating length > 0
//            *       } 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_CAM_09_04_BO
//            * @reference    ETSI TS 103 097 [1] Clause 7.1
//            */
//            testcase TC_SEC_ITSS_RCV_CAM_09_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnNonSecuredPacket v_gnNonSecuredPacket;
//                var octetstring v_gnPayload;
//                var template (value) Ieee1609Dot2Data v_securedMessage;
//                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_gnNonSecuredPacket := valueof(m_geoNwShbPacket(f_getPosition(c_compNodeC)));
//                v_gnNonSecuredPacket.payload := valueof(
//                    valueof(
//                        bit2oct(
//                            encvalue(
//                                m_camReq(
//                                    m_camMsg_vehicle_HF_BV(
//                                        f_getTsStationId(),
//                                        f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
//                                        LibItsCam_Templates.m_tsPosition
//                ))))));
//                v_gnPayload := bit2oct(encvalue(v_gnNonSecuredPacket));
//                f_buildGnSecuredCam(
//                    v_securedMessage,
//                    m_payload_encrypted(
//                        v_gnPayload
//                    )
//                );
//                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_09_04_BO
//            
//            /**
//            * @desc    Check that IUT discards the Secured CAM containing exactly one non-empty payload of type 'signed_external'
//            * <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_A_AT
//            *   }
//            *   ensure that {
//            *       when {
//            *           the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//            *              containing payload_field
//            *                   containing type
//            *                       indicating 'signed_external'
//            *                   and containing data
//            *                       indicating length > 0
//            *       } 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_CAM_09_05_BO
//            * @reference    ETSI TS 103 097 [1] Clause 7.1
//            */
//            testcase TC_SEC_ITSS_RCV_CAM_09_05_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnNonSecuredPacket v_gnNonSecuredPacket;
//                var octetstring v_gnPayload;
//                var template (value) Ieee1609Dot2Data v_securedMessage;
//                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_gnNonSecuredPacket := valueof(m_geoNwShbPacket(f_getPosition(c_compNodeC)));
//                v_gnNonSecuredPacket.payload := valueof(
//                    valueof(
//                        bit2oct(
//                            encvalue(
//                                m_camReq(
//                                    m_camMsg_vehicle_HF_BV(
//                                        f_getTsStationId(),
//                                        f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
//                                        LibItsCam_Templates.m_tsPosition
//                ))))));
//                v_gnPayload := bit2oct(encvalue(v_gnNonSecuredPacket));
//                f_buildGnSecuredCam(
//                    v_securedMessage,
//                    m_payload_signed_external(
//                        v_gnPayload
//                    )
//                );
//                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_09_05_BO
//            
//            /**
//            * @desc    Check that IUT discards the Secured CAM containing non-empty payload of type 'signed_and_encrypted'
//            * <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_A_AT
//            *   }
//            *   ensure that {
//            *       when {
//            *           the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//            *              containing payload_field
//            *                   containing type
//            *                       indicating 'signed_and_encrypted'
//            *                   and containing data
//            *                       indicating length > 0
//            *       } 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_CAM_09_06_BO
//            * @reference    ETSI TS 103 097 [1] Clause 7.1
//            */
//            testcase TC_SEC_ITSS_RCV_CAM_09_06_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnNonSecuredPacket v_gnNonSecuredPacket;
//                var octetstring v_gnPayload;
//                var template (value) Ieee1609Dot2Data v_securedMessage;
//                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_gnNonSecuredPacket := valueof(m_geoNwShbPacket(f_getPosition(c_compNodeC)));
//                v_gnNonSecuredPacket.payload := valueof(
//                    valueof(
//                        bit2oct(
//                            encvalue(
//                                m_camReq(
//                                    m_camMsg_vehicle_HF_BV(
//                                        f_getTsStationId(),
//                                        f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
//                                        LibItsCam_Templates.m_tsPosition
//                ))))));
//                v_gnPayload := bit2oct(encvalue(v_gnNonSecuredPacket));
//                f_buildGnSecuredCam(
//                    v_securedMessage,
//                    m_payload_signed_and_encrypted(
//                        v_gnPayload
//                    )
//                );
//                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_09_06_BO
//            
//            /**
//            * @desc    Check that IUT discards the Secured CAM containing non-empty payload of unknown type
//            * <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_A_AT
//            *   }
//            *   ensure that {
//            *       when {
//            *           the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//            *              containing payload_field
//            *                   containing type
//            *                       indicating X_UNKNOWN_PAYLOAD_TYPE
//            *                   and containing data
//            *                       indicating length > 0
//            *       } 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_CAM_09_07_BO
//            * @reference    ETSI TS 103 097 [1] Clause 7.1
//            */
//            testcase TC_SEC_ITSS_RCV_CAM_09_07_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnNonSecuredPacket v_gnNonSecuredPacket;
//                var octetstring v_gnPayload;
//                var template (value) Ieee1609Dot2Data v_securedMessage;
//                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_gnNonSecuredPacket := valueof(m_geoNwShbPacket(f_getPosition(c_compNodeC)));
//                v_gnNonSecuredPacket.payload := valueof(
//                    valueof(
//                        bit2oct(
//                            encvalue(
//                                m_camReq(
//                                    m_camMsg_vehicle_HF_BV(
//                                        f_getTsStationId(),
//                                        f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
//                                        LibItsCam_Templates.m_tsPosition
//                ))))));
//                v_gnPayload := bit2oct(encvalue(v_gnNonSecuredPacket));
//                f_buildGnSecuredCam(
//                    v_securedMessage,
//                    m_payload_unknown(
//                        v_gnPayload
//                    )
//                );
//                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_09_07_BO
//            
//            /**
//            * @desc    Check that IUT discards the Secured CAM doesn't containing the TrailerField of type 'signature'
//            * <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_A_AT
//            *    }
//            *    ensure that {
//            *        when {
//            *            the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//            *                containing trailer_fields
//            *                    not containing any instance of type TrailerField
//            *                        containing type
//            *                            indicating 'signature'
//            *        } 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_CAM_10_01_BO
//            * @reference    ETSI TS 103 097 [1] Clause 7.1
//            */
//            testcase TC_SEC_ITSS_RCV_CAM_10_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_Bo(cc_taCert_A, -, 0); 
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                // Empty on purpose
//                }
//                if(i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_10_01_BO
//            
//            /**
//            * @desc    Check that IUT discards the Secured CAM containing more then one instance of TrailerField of type 'signature'
//            * <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_A_AT
//            *   }
//            *   ensure that {
//            *       when {
//            *           the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//            *              containing trailer_fields[0].type
//            *                  containing type
//            *                      indicating 'signature'
//            *              and containing trailer_fields[1].type
//            *                  containing type
//            *                      indicating 'signature'
//            *       } 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_CAM_10_02_BO
//            * @reference    ETSI TS 103 097 [1] Clause 7.1
//            */
//            testcase TC_SEC_ITSS_RCV_CAM_10_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_Bo(cc_taCert_A, -, 2); 
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                // Empty on purpose
//                }
//                if(i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_10_02_BO
//            
//            /**
//            * @desc    Check that the IUT discards Secured message containing signature that is not verified using the 
//            *          verification key from the certificate contained in the message's signer info
//            * <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_A_AT
//            *   }
//            *   ensure that {
//            *       when {
//            *           the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//            *               containing header_fields ['signer_info']
//            *                   containing certificate
//            *                       containing subject_attributes['verification key'] (KEY)
//            *               and containing trailer_fields[0]
//            *                   containing type
//            *                       indicating 'signature'
//            *                   and containing signature
//            *                       NOT verifiable using KEY
//            *       } 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_CAM_11_01_BO
//            * @reference    ETSI TS 103 097 [1] Clause 7.1
//            */
//            testcase TC_SEC_ITSS_RCV_CAM_11_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_prepareSecuredCam_Bo(
//                    cc_taCert_A, 
//                    -, 
//                    1, 
//                    -, 
//                    e_certificate
//                );
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                // Empty on purpose
//                }
//                if(i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_11_01_BO
//            
//            /**
//            * @desc    Check that the IUT discards Secured message containing signature that is not verified using the 
//            *          verification key from the certificate, referenced by the digest contained in the message's signer info
//            * <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_A_AT
//            *   }
//            *   ensure that {
//            *       when {
//            *           the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_02)
//            *               containing header_fields ['signer_info'].signer
//            *                   containing digest
//            *                       referencing to the certificate (CERT_TS_AT_A)
//            *                           containing subject_attributes['verification key'] (KEY)
//            *               and containing trailer_fields[0]
//            *                   containing type
//            *                       indicating 'signature'
//            *                   and containing signature
//            *                       NOT verifiable using KEY
//            *       } 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_CAM_11_02_BO
//            * @reference    ETSI TS 103 097 [1] Clause 7.1
//            */
//            testcase TC_SEC_ITSS_RCV_CAM_11_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_prepareSecuredCam(
//                    cc_taCert_A, 
//                    omit, 
//                    e_certificate_digest_with_sha256
//                );
//                v_securedGnPdu.gnPacket.securedMsg.trailer_fields[0].trailerField.signature_.signature_.ecdsa_signature.s
//                    := not4b(v_securedGnPdu.gnPacket.securedMsg.trailer_fields[0].trailerField.signature_.signature_.ecdsa_signature.s);
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                // Empty on purpose
//                }
//                if(i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_11_02_BO
//            
//            /**
//            * @desc    Check that IUT discards the Secured CAM if the message contains trailer field of type 'signature' with reserved public key algorythms
//            * @remark  Values to be provided as X_RESERVED_PK_ALGORYTHM are: 240, 255
//            * <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_A_AT
//            *   }
//            *   ensure that {
//            *       when {
//            *           the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//            *               containing an instance of type trailer_field
//            *                   containing type
//            *                       indicating 'signature'
//            *                   and containing signature.algorithm
//            *                       indicating X_RESERVED_PK_ALGORYTHM
//            *       } 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_CAM_11_03_BO
//            * @reference    ETSI TS 103 097 [1] Clause 7.1
//            */
//            testcase TC_SEC_ITSS_RCV_CAM_11_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_prepareSecuredCam_Bo(
//                    cc_taCert_A, 
//                    -, 
//                    3 
//                );
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose
//                }
//                if(i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CAM_11_03_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured CAM if the signer certificate of the message 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_A_AT
//             * Expected behaviour:
//             * ensure that {
//             *   when {
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields['signer_info']
//             *              containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  containing certificate (CERT_TS_EC_A)
//             *                      containing subject_info.subject_type
//             *                          indicating 'enrolment_credentials'
//             *   } 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_CAM_12_01_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_12_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_prepareSecuredCam(
//                    cc_taCert_EC, 
//                    {
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate,
//                    true
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_12_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured CAM if the signer certificate of the message contains the subject type 'authorization_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_A_AT
//             * Expected behaviour:
//             * ensure that {
//             *   when {
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields['signer_info']
//             *              containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  containing certificate (CERT_TS_AA_A)
//             *                      containing subject_info.subject_type
//             *                          indicating 'authorization_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_CAM_12_02_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_12_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_prepareSecuredCam(
//                    cc_taCert_AA, 
//                    {
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate,
//                    true
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_12_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured CAM if the signer certificate of the message 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_A_AT
//             * Expected behaviour:
//             * ensure that {
//             *   when {
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields['signer_info']
//             *              containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *              and certificate (CERT_TS_EA_A)
//             *                  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_CAM_12_03_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_12_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_prepareSecuredCam(
//                    cc_taCert_EA, 
//                    {
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate,
//                    true
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_12_03_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured CAM if the signer certificate of the message contains the subject type 'root_ca'
//             * <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_A_AT
//             * Expected behaviour:
//             * ensure that {
//             *   when {
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *          containing header_fields['signer_info']
//             *              containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *              and certificate (CERT_TS_ROOT)
//             *                  containing subject_info.subject_type
//             *                      indicating 'root_ca'
//             *   } 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_CAM_12_04_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_12_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_prepareSecuredCam(
//                    cc_taCert_CA, 
//                    {
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_CAM
//                    }, 
//                    e_certificate,
//                    true
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_12_04_BO
//            
//            /**
//             * @desc    Check that IUT discards secured CAM signed with the not yet valid certificate
//             * <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_MSG_13_01_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *              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_CAM_13_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_13_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_taCertMsg1301_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_13_01_BO
//            
//            /**
//             * @desc    Check that IUT discards secured CAM signed with the expired certificate
//             * <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_MSG_13_02_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *              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_CAM_13_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_13_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_taCertMsg1302_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_13_02_BO
//            
//            /**
//             * @desc    Check that IUT discards secured CAM when IUT location is outside the circular validity restriction of the signing certificate
//             * <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_MSG_13_03_BO_AT
//             *      and the IUT current location is set to CURRENT_IUT_LOCATION
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *              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_CAM_13_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_13_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_taCertMsg1303_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_13_03_BO
//            
//            /**
//             * @desc    Check that IUT discards secured CAM when IUT location is outside the rectangular validity restriction of the signing certificate
//             * <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_MSG_13_04_BO_AT
//             *      and the IUT current location is set to CURRENT_IUT_LOCATION
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields['signer_info'].signer 
//             *                  containing certificate (CERT_TS_MSG_13_04_BO_AT)
//             *                      containing validity_restrictions['region']
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'rectangle'
//             *                              and containing 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_CAM_13_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_13_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_taCertMsg1304_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_13_04_BO
//            
//            /**
//             * @desc    Check that IUT discards secured CAM when IUT location is outside the polygonal validity restriction of the signing certificate
//             * <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_MSG_13_05_BO_AT
//             *      and the IUT current location is set to CURRENT_IUT_LOCATION
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields['signer_info'].signer 
//             *                  containing certificate (CERT_TS_MSG_13_05_BO_AT)
//             *                      containing validity_restrictions['region']
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'polygon'
//             *                              and containing polygonal_region
//             *                                  indicating REGION
//             *                                      not containing the CURRENT_IUT_LOCATION
//             *      } then {
//             *          the IUT discards the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_13_05_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_13_05_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_taCertMsg1305_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_13_05_BO
//            
//            /**
//             * @desc    Check that IUT discards secured CAM when IUT location is outside the identified validity restriction of the signing certificate
//             * <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_MSG_13_06_BO_AT
//             *      and the IUT current location is set to CURRENT_IUT_LOCATION
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_CAM_01)
//             *              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_CAM_13_06_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.1
//             */
//            testcase TC_SEC_ITSS_RCV_CAM_13_06_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_taCertMsg1306_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_CAM_13_06_BO
        } // End of group recvCamProfile
         * @desc Receiving behaviour test cases for DENM profile
garciay's avatar
garciay committed
         * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.3.3 DENM Profile
        group recvDenmProfile {
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured DENM signed with the certificate without region validity restriction
//             * @remark  The message defined in this test purpose is used in the subsequent test purposes with the snippet name ‘MSG_SEC_RCV_DENM_A’. Only differences to this snippet are mentioned in subsequent test purposes.
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data
//             *          containing header_fields[0]
//             *              containing type 
//             *                  indicating 'signer_info'
//             *              and containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  and containing certificate (CERT_AT_A)
//             *                      containing subject_info.subject_type
//             *                          indicating 'authorization_ticket' (2)
//             *                      and containing subject_attributes['verification key'] (KEY)
//             *             and not containing validity_restrictions['region']
//             *       and containing header_fields [1]
//             *         containing type 
//             *           indicating 'generation_time'
//             *              containing generation_time
//             *                  indicating CURRENT_TIME
//             *       and containing header_fields [2]
//             *         containing type 
//             *           indicating 'generation_location'
//             *              containing generation_location
//             *       and containing header_fields[3]
//             *         containing type 
//             *           indicating 'its_aid'
//             *         containing its_aid
//             *              indicating 'AID_DENM'
//             *          and containing payload_field
//             *              containing type
//             *                  indicating 'signed'
//             *              containing data
//             *                  indicating length > 0
//             *                  containing DENM payload
//             *          and containing trailer_fields
//             *              containing single instance of type TrailerField
//             *                  containing type
//             *                      indicating 'signature'
//             *                  containing signature
//             *                      verifiable using KEY
//             *   } then {
//             *     the IUT accepts the message
//             *   }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_01_01_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_01_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(cc_taCert_A, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: DENM was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: DEN message was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_01_01_BV
//            
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured DENM signe with the certificate with a circular region validity restriction
//             * @remark  The message defined in this test purpose is used in the subsequent test purposes with the snippet name ‘MSG_SEC_RCV_DENM_A’. Only differences to this snippet are mentioned in subsequent test purposes.
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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_B_AT
//             *   and the IUT current location is inside the region validity period of CERT_TS_B_AT
//             * }
//             * ensure that {
//             *   when {
//             *     the IUT is receiving a Ieee1609Dot2Data
//             *       and containing header_fields[0]
//             *              containing type 
//             *                  indicating 'signer_info'
//             *              and containing signer {
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  and containing certificate (CERT_AT_B) {
//             *                      containing subject_info.subject_type
//             *                          indicating 'authorization_ticket' (2)
//             *                      and containing subject_attributes['verification key'] (KEY)
//             *                      and containing validity_restrictions['region'] {
//             *                          containing region{
//             *                              containing region_type
//             *                                  indicating 'circle'
//             *                              and containing circular_region
//             *                                  indicating REGION
//             *                          }
//             *                      }
//             *                  }
//             *       and containing header_fields [1]
//             *         containing type 
//             *           indicating 'generation_time'
//             *              containing generation_time
//             *                  indicating CURRENT_TIME
//             *       and containing header_fields [2]
//             *         containing type 
//             *           indicating 'generation_location'
//             *              containing generation_location
//             *                  indicating position inside the REGION
//             *       and containing header_fields[3]
//             *         containing type 
//             *           indicating 'its_aid'
//             *         containing its_aid
//             *              indicating 'AID_DENM'
//             *       and not containing any other header_fields
//             *       and containing payload_fields {
//             *              containing type
//             *                  indicating 'signed'
//             *              containing data
//             *                  indicating length > 0
//             *                  containing DENM payload
//             *          }
//             *          and containing trailer_fields {
//             *              containing single instance of type TrailerField {
//             *                  containing type
//             *                      indicating 'signature'
//             *                  containing signature
//             *                      verifiable using KEY
//             *              }
//             *          }
//             *   } then {
//             *     the IUT accepts the message
//             *   }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_01_02_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_01_02_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(cc_taCert_B, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: DENM was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: DEN message was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_01_02_BV
//            
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured DENM signe with the certificate with a rectangular region validity restriction
//             * @remark  The message defined in this test purpose is used in the subsequent test purposes with the snippet name ‘MSG_SEC_RCV_DENM_A’. Only differences to this snippet are mentioned in subsequent test purposes.
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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_C_AT
//             *   and the IUT current location is inside the region validity period of CERT_TS_C_AT
//             * }
//             * ensure that {
//             *   when {
//             *     the IUT is receiving a Ieee1609Dot2Data
//             *       containing protocol_version 
//             *         indicating value '2'
//             *       and containing header_fields[0]
//             *              containing type 
//             *                  indicating 'signer_info'
//             *              and containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  and containing certificate (CERT_AT_C)
//             *                      containing subject_info.subject_type
//             *                          indicating 'authorization_ticket' (2)
//             *                      and containing subject_attributes['verification key'] (KEY)
//             *                      and containing validity_restrictions['region']
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'rectangle'
//             *                              and containing rectangular_regions
//             *                                  indicating REGIONS
//             *       and containing header_fields [1]
//             *         containing type 
//             *           indicating 'generation_time'
//             *              containing generation_time
//             *                  indicating CURRENT_TIME
//             *       and containing header_fields [2]
//             *         containing type 
//             *           indicating 'generation_location'
//             *              containing generation_location
//             *           indicating position inside the REGION
//             *       and containing header_fields[3]
//             *         containing type 
//             *           indicating 'its_aid'
//             *         containing its_aid
//             *              indicating 'AID_DENM'
//             *       and not containing any other header_fields
//             *          and containing payload_field
//             *              containing type
//             *                  indicating 'signed'
//             *              containing data
//             *                  indicating length > 0
//             *                  containing DENM payload
//             *          and containing trailer_fields
//             *              containing single instance of type TrailerField
//             *                  containing type
//             *                      indicating 'signature'
//             *                  containing signature
//             *                      verifiable using KEY
//             *   } then {
//             *     the IUT accepts the message
//             *   }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_01_03_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_01_03_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(cc_taCert_C, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: DENM was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: DEN message was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_01_03_BV
//            
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured DENM signe with the certificate with a polygonal region validity restriction 
//             * @remark  The message defined in this test purpose is used in the subsequent test purposes with the snippet name ‘MSG_SEC_RCV_DENM_A’. Only differences to this snippet are mentioned in subsequent test purposes.
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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_D_AT
//             *   and the IUT current location is inside the region validity period of CERT_TS_D_AT
//             * }
//             * ensure that {
//             *   when {
//             *     the IUT is receiving a Ieee1609Dot2Data
//             *       containing protocol_version 
//             *         indicating value '2'
//             *       and containing header_fields[0]
//             *              containing type 
//             *                  indicating 'signer_info'
//             *              and containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  and containing certificate (CERT_AT_D) 
//             *                      containing subject_info.subject_type
//             *                          indicating 'authorization_ticket' (2)
//             *                      and containing subject_attributes['verification key'] (KEY)
//             *                      and containing validity_restrictions['region'] 
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'polygon'
//             *                              and containing polygonal_region
//             *                   indicating REGION
//             *       and containing header_fields [1]
//             *         containing type 
//             *           indicating 'generation_time'
//             *              containing generation_time
//             *                  indicating CURRENT_TIME
//             *       and containing header_fields [2]
//             *         containing type 
//             *           indicating 'generation_location'
//             *              containing generation_location
//             *           indicating position inside the REGION
//             *       and containing header_fields[3]
//             *         containing type 
//             *           indicating 'its_aid'
//             *         containing its_aid
//             *              indicating 'AID_DENM'
//             *       and not containing any other header_fields
//             *          and containing payload_field 
//             *              containing type
//             *                  indicating 'signed'
//             *              containing data
//             *                  indicating length > 0
//             *                  containing DENM payload
//             *          and containing trailer_fields
//             *              containing single instance of type TrailerField
//             *                  containing type
//             *                      indicating 'signature'
//             *                  containing signature
//             *                      verifiable using KEY
//             *   } then {
//             *     the IUT accepts the message
//             *   }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_01_04_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_01_04_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(cc_taCert_D, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: DENM was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: DEN message was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_01_04_BV
//            
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured DENM signe with the certificate with a identified region validity restriction 
//             * @remark  The message defined in this test purpose is used in the subsequent test purposes with the snippet name ‘MSG_SEC_RCV_DENM_A’. Only differences to this snippet are mentioned in subsequent test purposes.
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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_D_AT
//             *   and the IUT current location is inside the region validity period of CERT_TS_D_AT
//             * }
//             * ensure that {
//             *   when {
//             *     the IUT is receiving a Ieee1609Dot2Data
//             *       containing protocol_version 
//             *         indicating value '2'
//             *       and containing header_fields[0]
//             *              containing type 
//             *                  indicating 'signer_info'
//             *              and containing signer 
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *           and containing certificate (CERT_AT_E) 
//             *                      containing subject_info.subject_type
//             *                          indicating 'authorization_ticket' (2)
//             *                      and containing subject_attributes['verification key'] (KEY)
//             *                      and containing validity_restrictions['region'] 
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'id_region'
//             *                              and containing identified_region
//             *                                  indicating REGION
//             *       and containing header_fields [1]
//             *         containing type 
//             *           indicating 'generation_time'
//             *              containing generation_time
//             *                  indicating CURRENT_TIME
//             *       and containing header_fields [2]
//             *         containing type 
//             *           indicating 'generation_location'
//             *              containing generation_location
//             *                  indicating position inside the REGION
//             *       and containing header_fields[3]
//             *         containing type 
//             *           indicating 'its_aid'
//             *         containing its_aid
//             *              indicating 'AID_DENM'
//             *       and not containing any other header_fields
//             *          and containing payload_field 
//             *              containing type
//             *                  indicating 'signed'
//             *              containing data
//             *                  indicating length > 0
//             *                  containing DENM payload
//             *          and containing trailer_fields 
//             *              containing single instance of type TrailerField 
//             *                  containing type
//             *                      indicating 'signature'
//             *                  containing signature
//             *                      verifiable using KEY
//             *   } then {
//             *     the IUT accepts the message
//             *   }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_01_05_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_01_05_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(cc_taCert_D, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: DENM was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: DEN message was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_01_05_BV
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM containing protocol version set to a value less then 2
//             * <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_A_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//             *              containing protocol_version 
//             *                  indicating 1
//             *      } then {
//             *          the IUT discards a Ieee1609Dot2Data
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_02_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 5.1
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_02_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm_Bo(cc_taCert_A, PX_WRONG_PROTOCOL_VERSION);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_02_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM containing protocol version set to a value greater then 2
//             * <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_A_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//             *              containing protocol_version 
//             *                  indicating 3
//             *      } then {
//             *          the IUT discards a Ieee1609Dot2Data
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_02_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 5.1
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_02_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm_Bo(cc_taCert_A, PX_WRONG_PROTOCOL_VERSION);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_02_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured DENM if the message contains more than one header field of type 'signer_info'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[3].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[4].type
//             *              indicating 'its_aid'
//             *          and not containing other header fields
//             *  } 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_DENM_04_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )), 
//                        m_header_info_signer_info(
//                            m_signerIdentifier_certificate(
//                                vc_aaCertificate
//                        )), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured DENM if the message does not contain the header field of type 'signer_info'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[2].type
//             *                  indicating 'its_aid'
//             *          and not containing other header fields
//             *  } 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_DENM_04_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_02_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured DENM if the signer_info header field is not encoded first
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[2].type
//             *              containing its_aid
//             *          and containing header_fields[3].type
//             *              indicating 'signer_info'
//             *          and not containing other header fields
//             *  } 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_DENM_04_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM,
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        ))
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_03_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured DENM if the message contains more than one header field of type 'generation_time'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[3].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[4].type
//             *              containing its_aid
//             *          and not containing other header fields
//             *  } 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_DENM_04_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )),
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_time(1000 * f_getCurrentTime() - 1), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_04_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured DENM if the message does not contain the header field of type 'generation_time'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[2].type
//             *              containing its_aid
//             *          and not containing other header fields
//             *  } 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_DENM_04_05_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_05_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )),
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_05_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured DENM if the message contains more than one header field of type 'its_aid'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[3].type
//             *              containing its_aid
//             *          and containing header_fields[4].type
//             *              containing its_aid
//             *          and not containing other header fields
//             *  } 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_DENM_04_06_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_06_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )),
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM,
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_06_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured DENM if the message does not contain the header field of type 'its_aid'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_location'
//             *          and not containing other header fields
//             *  } 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_DENM_04_06a_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_06a_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )),
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        )
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_06a_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured DENM if the message contains more than one header field of type 'generation_location'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[3].type
//             *              containing 'generation_location'
//             *          and containing header_fields[4].type
//             *              containing its_aid
//             *          and not containing other header fields
//             *  } 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_DENM_04_07_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_07_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )),
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0100'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_07_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured DENM if the message does not contain the header field of type 'generation_location'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *              containing its_aid
//             *          and not containing other header fields
//             *  } 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_DENM_04_08_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_08_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )),
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_08_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM if the header fields are not in the ascending order according to the numbering of the enumeration
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              containing its_aid
//             *          and containing header_fields[2].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[3].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[4].type
//             *              containing 'generation_location'
//             *          and not containing other header fields
//             *  } 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_DENM_04_09_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_09_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )),
//                        m_header_info_its_aid_DENM,
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        )
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_09_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM containing header field of type 'generation_time_standard_deviation'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *              and containing time
//             *                  indicating CURRENT_TIME
//             *          and containing header_fields[2]
//             *              containing type
//             *                  indicating 'generation_time_standard_deviation'
//             *              and containing log_std_dev 
//             *                  indicating 255
//             *          and containing header_fields[3].type
//             *                  indicating 'generation_location'
//             *          and containing header_fields[4].type
//             *              containing its_aid
//             *          and not containing other header fields
//             *  } 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_DENM_04_10_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_10_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )),
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_time_with_standard_deviation(
//                            m_time64WithStandardDeviation(
//                                1000 * f_getCurrentTime(),
//                                255
//                            )
//                        ),
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_10_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured DENM containing the header fields of type 'expiry_time'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *              and containing time
//             *                  indicating CURRENT_TIME
//             *          and containing header_fields[2]
//             *              containing type
//             *                  indicating 'expiration'
//             *              and containing expiry_time 
//             *                  indicating CURRENT_TIME + 1 h 
//             *          and containing header_fields[3].type
//             *                  indicating 'generation_location'
//             *          and containing header_fields[4].type
//             *              containing its_aid
//             *          and not containing other header fields
//             *  } 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_DENM_04_11_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_11_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )),
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_expiry_time(
//                            1000 * (3600 + f_getCurrentTime()) // In us
//                        ),
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_11_BO
//            
//            /**
//             * @desc    Check that IUT accepts the Secured DENM containing additional non-standard HeaderInfo
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[3].type
//             *              containing its_aid
//             *          and containing header_fields[4]
//             *              containing type
//             *                  indicating non-standard header field type (200)
//             *              and containing other_header
//             *                  indicating non-empty data
//             *          and not containing other header fields
//             *  } 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_DENM_04_12_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_12_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_issuerIdentifier_sha256AndDigest(
//                                vc_atCertificate.signer_info.signerInfo.digest
//                        )),
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM,
//                        m_header_info_unspecify
//                    }, 
//                    e_certificate_digest_with_sha256,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_04_12_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured CAM containing the header field 'encryption_parameter and recipient_info'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[3].type
//             *              containing its_aid
//             *          and containing header_fields[4]
//             *              containing type
//             *                  indicating 'encryption_parameters'
//             *              and containing enc_params
//             *                  containing symm_algorithm
//             *                      indicating 'aes_128_ccm'
//             *                  and containing nonce
//             *              and containing header_fields[4]
//             *                  containing type
//             *                      indicating 'recipient_info'
//             *                  and containing recipients
//             *                      containing recipients[0]
//             *                          containing cert_id
//             *                              referencing to CERT_IUT_A_AT
//             *                          and containing pk_encryption
//             *                              indicating 'ecies_nistp256'
//             *                          and containing enc_key
//             *          and not containing other header fields
//             *  } 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_DENM_04_13_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_13_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                var Certificate v_iutATCertificate;
//                var SubjectAttribute v_encryption_key;
//                
//                // 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
//                if (
//                    (f_readCertificate(cc_iutCert_A, v_iutATCertificate) == false) or 
//                    (f_getCertificateSubjectAttribute(v_iutATCertificate, e_encryption_key, v_encryption_key) == false)
//                ) {
//                    f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout); // Set verdict to inconc
//                } else {
//                    v_securedGnPdu := f_prepareSecuredDenm(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )),
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_DENM,
//                            m_header_info_enc_params(                                  // containing header_fields[3].type.enc_params
//                                m_encryptionParameters_aes_128_ccm(                     //      indicating 'aes_128_ccm'
//                                    PX_ENCRYPTIONPARAMETERS_AES_128_CCM_NONCE           // and containing nonce
//                                )
//                            ),
//                            m_header_info_multiple_recipients(                         // containing header_fields[4].type
//                                {                                                       //     indicating 'encryption_parameters'
//                                    m_recipientInfo_ecies_enc_key(
//                                        v_iutATCertificate.signer_info.signerInfo.digest,
//                                        e_ecies_nistp256,                               // containing symm_algorithm
//                                                                                        //     indicating 'aes_128_ccm'
//                                        m_eciesEncryptedKey_aesccm(
//                                            v_encryption_key.attribute.rv,
//                                            '00000000000000000000000000000000'O, // FIXME Where to find these values
//                                            '00000000000000000000000000000000'O
//                                        )
//                                    )
//                                }
//                            )
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    
//                    f_sleep(PX_TNOAC);
//                    v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                    for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                        // Empty on purpose 
//                    } // End of 'for' statement
//                    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_DENM_04_13_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured DENM containing the header fields of type 'request_unrecognized_certificate'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *              and containing generation_time
//             *                  indicating CURRENT_TIME
//             *          and containing header_fields[2].type
//             *             indicating 'request_unrecognized_certificate'
//             *             and containing digests[0]
//             *                 indicating the digest of X_IUT_AT_CERT
//             *          and containing header_fields[3].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[4].type
//             *              indicating 'its_aid'
//             *          and not containing other header fields
//             *  } 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_DENM_04_14_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_04_14_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                var Certificate v_iutATCertificate;
//                var SignerInfo v_signerIdentifier;
//                
//                // 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
//                if (
//                    (f_readCertificate(cc_iutCert_A, v_iutATCertificate) == false) or 
//                    (f_getCertificateSignerInfo(v_iutATCertificate, v_signerIdentifier) == false)
//                ) {
//                    f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout); // Set verdict to inconc
//                } else {
//                    v_securedGnPdu := f_prepareSecuredDenm(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )),
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_unrecognised_certificate(
//                                f_HashedId3FromHashedId8(
//                                   f_calculateDigestFromCertificate(
//                                       v_signerIdentifier.signerInfo.certificate
//                                   )
//                                )
//                            ),
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_DENM
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    
//                    f_sleep(PX_TNOAC);
//                    v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                    for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                        // Empty on purpose 
//                    } // End of 'for' statement
//                    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_DENM_04_14_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM if the header_fields contains a signer of type 'self'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *                  containing signer.type
//             *                      indicating 'self'
//             *  } 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_DENM_05_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_05_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_signerIdentifier_self
//                        ), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_self,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_05_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM if the header_fields contains a signer of type 'certificate_digest_with_other_algorithm'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *                  containing signer.type
//             *                      indicating 'certificate_digest_with_other_algorithm'
//             *  } 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_DENM_05_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_05_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_signerIdentifier_other_certificates(
//                                m_certificateWithAlgo_ecdsa(
//                                    PX_OTHER_CERT_DIGEST
//                        ))), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate_digest_with_other_algorithm,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_05_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM if the header_fields contains a signer of type certificate_chain
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *                  containing signer.type
//             *                      indicating 'certificate_digest_with_other_algorithm'
//             *  } 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_DENM_05_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_05_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_signerIdentifier_certificates(
//                                { vc_aaCertificate, vc_atCertificate }
//                        )), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate_chain,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_05_03_BO
//            
//            /**
//             * @desc    Check that IUT discards a secured DENM if the header_fields contains a signer info of unknown or reserved type
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *                  containing signer.type
//             *                      indicating X_UNKNOWN_SIGNERINFO_TYPE
//             *  } 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_DENM_05_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_05_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_signer_info(
//                            m_signerIdentifier_unknown(
//                                'CAFFEEDECA'O
//                        )), 
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_longPosVectorNodeB.latitude,
//                                v_longPosVectorNodeB.longitude,
//                                '0000'O
//                            ))
//                        ),
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_unknown,
//                    false
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_05_04_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM containing generation_time before the certificate validity period
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields['signer_info'].signer 
//             *              containing certificate (CERT_TS_MSG_06_01_BO_AT)
//             *                  containing validity_restrictions['time_start_and_end']
//             *                      containing start_validity
//             *                          indicating START_VALIDITY_AT
//             *                      and containing end_validity
//             *                          indicating END_VALIDITY_AT
//             *          and containing header_fields ['generation_time']
//             *              containing generation_time
//             *                  indicating GEN_TIME < 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_DENM_06_01_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 5.4 and 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_06_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                var ValidityRestriction v_timeValidity;
//                
//                // 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
//                f_getCertificateValidityRestriction(vc_atCertificate, e_time_start_and_end, v_timeValidity);
//                v_securedGnPdu := f_prepareSecuredDenm(
//                    cc_taCert0601_BO, 
//                    {
//                        m_header_info_generation_time(
//                            (v_timeValidity.validity.time_start_and_end.start_validity - 3600) * 1000
//                        ) // In us
//                    }, 
//                    e_certificate
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_06_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM containing generation_time before the certificate validity period
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//             *          containing header_fields['signer_info'].signer 
//             *              containing certificate (CERT_TS_MSG_06_02_BO_AT)
//             *                  containing validity_restrictions['time_start_and_end']
//             *                      containing start_validity
//             *                          indicating START_VALIDITY_AT
//             *                      and containing end_validity
//             *                          indicating END_VALIDITY_AT
//             *          and containing header_fields ['generation_time']
//             *              containing generation_time
//             *                  indicating GEN_TIME > END_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_DENM_06_02_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 5.4 and 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_06_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                var ValidityRestriction v_validity;
//                
//                // 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
//                f_getCertificateValidityRestriction(vc_atCertificate, e_time_start_and_end, v_validity);
//                v_securedGnPdu := f_prepareSecuredDenm(
//                    cc_taCert0602_BO, 
//                    {
//                        m_header_info_generation_time(
//                            (v_validity.validity.time_start_and_end.end_validity + 3600) * 1000
//                        ) // In us
//                    }, 
//                    e_certificate
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_06_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM if the generation_time is more than 10 minute in the past (C2C only)
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields ['generation_time']
//             *              containing generation_time
//             *                  indicating GEN_TIME ( CURRENT_TIME - 11min )
//             *  } 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_DENM_06_03_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 5.4 and 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_06_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_generation_time( 
//                            (1000 * f_getCurrentTime() - 660) * 1000
//                        ) // In us
//                    }, 
//                    e_certificate
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_06_03_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM if the generation_time is more than 10 minute in the future(C2C only)
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing header_fields ['generation_time']
//             *              containing generation_time
//             *                  indicating GEN_TIME ( CURRENT_TIME + 11min )
//             *  } 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_DENM_06_04_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 5.4 and 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_06_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                
//                // 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_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_generation_time( 
//                            (1000 * f_getCurrentTime() + 660) * 1000
//                        ) // In us
//                    }, 
//                    e_certificate
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_06_04_BO
//            
//            /**
//             * @desc  Check that IUT discards secured DENM when its_aid value is not equal to AID_DENM
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * Config Id: CF01
//             * Initial conditions:
//             *  with {
//             *      the IUT being in the 'authorized' state
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//             *              containing header_fields['its_aid']
//             *                  indicating 'AID_CAM'
//             *              and containing payload_field 
//             *                  containing type    
//             *                    indicating 'signed' 
//             *                  containing data    
//             *                    containing DENM payload
//             *      } then {
//             *          the IUT discards the DENM
//             *      }
//             *  }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_07_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_07_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_its_aid_CAM
//                    }
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_07_01_BO
//            
//            /**
//             * @desc  Check that IUT discards a Secured DENM when its_aid value is undefined
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * Config Id: CF01
//             * Initial conditions:
//             *  with {
//             *      the IUT being in the 'authorized' state
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//             *             containing header_fields['its_aid'] 
//             *                 indicating 'AID_UNDEFINED' 
//             *             and containing payload_field { 
//             *                 containing type 
//             *                     indicating 'signed' 
//             *                 containing data 
//             *                     containing DENM payload 
//             *      } then {
//             *          the IUT discards the DENM
//             *      }
//             *  }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_07_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_07_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_its_aid_Other
//                    }
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_07_02_BO
//            
//            /**
//             * @desc   Check that IUT discards Secured DENM if the HeaderInfo generation_location is outside of the circular validity region of the signing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION
//             * Config Id: CF01
//             * Initial conditions:
//             * with {
//             *   the IUT being in the 'authorized' state
//             * }
//             * ensure that {
//             *   when {
//             *     the IUT is requested to send DENM
//             *   } then {
//             *     the IUT is receiving a Ieee1609Dot2Data
//             *          containing header_fields['signer_info'].type
garciay's avatar
garciay committed
//             *              containing certificate
//             *          and containing  header_fields ['signer_info'].certificate (CERT_AT_B)
//             *              containing validity_restrictions['region']
//             *                  containing region
//             *                      containing region_type
//             *                          indicating 'circle'
//             *                      and containing circular_region
//             *                          indicating REGION
//             *          and containing header_fields ['generation_location']
//             *              containing generation_location
//             *                  indicating position outside the REGION
//             *          and containing header_fields['its_aid']
//             *              indicating 'AID_DENM'
//             *      } then {
//             *          the IUT discards the DENM
//             *      }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_08_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_08_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_USE_CIRCULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION' 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_sendSecuredDenm(cc_taCert_B_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_08_01_BO
//            
//            /**
//             * @desc    Check that IUT discards Secured DENM if the HeaderInfo generation_location is outside of the rectangilar validity region of the signing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION
//             * Config Id: CF01
//             * Initial conditions:
//             * with {
//             *   the IUT being in the 'authorized' state
//             * }
//             * ensure that {
//             *   when {
//             *     the IUT is requested to send DENM
//             *   } then {
//             *     the IUT is receiving a Ieee1609Dot2Data
//             *          containing header_fields['signer_info'].type
garciay's avatar
garciay committed
//             *              containing certificate
//             *          and containing  header_fields ['signer_info'].certificate (CERT_AT_C)
//             *              containing validity_restrictions['region']
//             *                  containing region
//             *                      containing region_type
//             *                          indicating 'rectangle'
//             *                      and containing rectangular_regions
//             *                          indicating REGION
//             *          and containing header_fields ['generation_location']
//             *              containing generation_location
//             *                  indicating position outside the REGION
//             *          and containing header_fields['its_aid']
//             *              indicating 'AID_DENM'
//             *      } then {
//             *          the IUT discards the DENM
//             *      }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_08_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_08_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_USE_RECTANGULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION' 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_sendSecuredDenm(cc_taCert_C_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_08_02_BO
//            
//            /**
//             * @desc    Check that IUT discards Secured DENM if the HeaderInfo generation_location is outside of the polygonal validity region of the signing certificate    
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION
//             * Config Id: CF01
//             * Initial conditions:
//             * with {
//             *   the IUT being in the 'authorized' state
//             * }
//             * ensure that {
//             *   when {
//             *     the IUT is requested to send DENM
//             *   } then {
//             *     the IUT is receiving a Ieee1609Dot2Data
//             *          containing header_fields['signer_info'].type
garciay's avatar
garciay committed
//             *              containing certificate
//             *          and containing  header_fields ['signer_info'].certificate (CERT_AT_D)
//             *              containing validity_restrictions['region']
//             *                  containing region
//             *                      containing region_type
//             *                          indicating 'polygon'
//             *                      and containing polygonal_region
//             *                          indicating REGION
//             *          and containing header_fields ['generation_location']
//             *              containing generation_location
//             *                  indicating position outside the REGION
//             *          and containing header_fields['its_aid']
//             *              indicating 'AID_DENM'
//             *      } then {
//             *          the IUT discards the DENM
//             *      }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_08_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_08_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_USE_POLYGONAL_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION' 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_sendSecuredDenm(cc_taCert_D_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_08_03_BO
//            
//            /**
//             * @desc    Check that IUT discards Secured DENM if the HeaderInfo generation_location is outside of the identified validity region of the signing certificate 
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION
//             * Config Id: CF01
//             * Initial conditions:
//             * with {
//             *   the IUT being in the 'authorized' state
//             * }
//             * ensure that {
//             *   when {
//             *     the IUT is requested to send DENM
//             *   } then {
//             *     the IUT is receiving a Ieee1609Dot2Data
//             *          containing header_fields['signer_info'].type
garciay's avatar
garciay committed
//             *              containing certificate
//             *          and containing  header_fields ['signer_info'].certificate (CERT_AT_E)
//             *              containing validity_restrictions['region']
//             *                  containing region
//             *                      containing region_type
//             *                          indicating 'id_region'
//             *                      and containing identified_region
//             *                          indicating REGION
//             *          and containing header_fields ['generation_location']
//             *              containing generation_location
//             *                  indicating position outside the REGION
//             *          and containing header_fields['its_aid']
//             *              indicating 'AID_DENM'
//             *      } then {
//             *          the IUT discards the DENM
//             *      }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_08_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_08_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION' 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_sendSecuredDenm(cc_taCert_E_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_08_04_BO
//            
//            /**
//             * @desc    Check that IUT accepts a Secured DENM if the distance between the current position of IUT and the value of optional HeaderInfo generation_location is 29.9 km (C2C only)
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//             *          containing header_fields[generation_location].type 
//             *              indicating 'generation_location'
//             *          and containing generation_location
//             *              indicating position in 29.9 km from the current position of IUT
//             *   } then {
//             *     the IUT accepts the message
//             *   }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_DENM_08_05_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_08_05_BV() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                var Int32 v_latitude;
//                var Int32 v_longitude;
//                
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                fx_computePositionUsingDistance(
//                    v_longPosVectorNodeB.latitude,
//                    v_longPosVectorNodeB.longitude,
//                    29900.0, 
//                    0,
//                    v_latitude,
//                    v_longitude
//                );
//                v_securedGnPdu := f_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_latitude,
//                                v_longitude,
//                                '0000'O
//                            ))
//                        )
//                    }, 
//                    e_certificate_digest_with_sha256
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: DENM was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: DEN message was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_08_05_BV
//            
//            /**
//             * @desc    Check that IUT discards Secured DENM if the distance between the current position of IUT and the value of optional HeaderInfo generation_location is more than 30 km
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//             *          containing header_fields[generation_location].type 
//             *              indicating 'generation_location'
//             *          and containing generation_location
//             *              indicating position in 31 km from the current position of IUT
//             *   } 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_DENM_08_06_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_08_06_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                var Int32 v_latitude;
//                var Int32 v_longitude;
//                
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                fx_computePositionUsingDistance(
//                    v_longPosVectorNodeB.latitude,
//                    v_longPosVectorNodeB.longitude,
//                    31000.0, 
//                    0,
//                    v_latitude,
//                    v_longitude
//                );
//                v_securedGnPdu := f_prepareSecuredDenm(
//                    cc_taCert_A, 
//                    {
//                        m_header_info_generation_location(
//                            valueof(m_threeDLocation(
//                                v_latitude,
//                                v_longitude,
//                                '0000'O
//                            ))
//                        )
//                    }, 
//                    e_certificate_digest_with_sha256
//                ); 
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_08_06_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured DENM containing empty payload of type 'signed'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing payload_field
//             *              containing type
//             *                  indicating 'signed'
//             *              and containing data
//             *                  indicating length 0
//             *  } 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_DENM_09_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_09_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GnNonSecuredPacket v_gnNonSecuredPacket;
//                var octetstring v_gnPayload;
//                var template (value) Ieee1609Dot2Data v_securedMessage;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
//                
//                // 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_gnNonSecuredPacket := valueof(
//                    m_geoNwBroadcastPacket(
//                        v_longPosVectorNodeB,
//                        vc_localSeqNumber,
//                        f_getGeoBroadcastArea(
//                            c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
//                )));
//                // Add the DENM payload
//                v_gnNonSecuredPacket.payload := valueof(
//                    valueof(
//                        bit2oct(
//                            encvalue(
//                                m_denmReq(
//                                    m_denmPdu(
//                                        m_denm(
//                                            m_denmMgmtCon(
//                                                m_tsActionId
//                                            ),
//                                            v_situation,
//                                            m_denmLocation_zeroDelta
//                )))))));
//                
//                // Encode it
//                v_gnPayload := bit2oct(
//                    encvalue(
//                        v_gnNonSecuredPacket
//                    )
//                );
//                f_buildGnSecuredDenm(
//                    v_securedMessage,
//                    m_payload_signed(
//                        ''O
//                    ),
//                    e_certificate_digest_with_sha256,
//                    valueof(m_threeDLocation(
//                        v_longPosVectorNodeB.latitude,
//                        v_longPosVectorNodeB.longitude,
//                        '0000'O
//                    ))
//                );
//                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_09_02_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured DENM containing payload of type 'unsecured'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing payload_field
//             *              containing type
//             *                  indicating 'unsecured'
//             *              and containing data
//             *                  indicating length > 0
//             *  } 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_DENM_09_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_09_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GnNonSecuredPacket v_gnNonSecuredPacket;
//                var octetstring v_gnPayload;
//                var template (value) Ieee1609Dot2Data v_securedMessage;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
//                
//                // 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_gnNonSecuredPacket := valueof(
//                    m_geoNwBroadcastPacket(
//                        v_longPosVectorNodeB,
//                        vc_localSeqNumber,
//                        f_getGeoBroadcastArea(
//                            c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
//                )));
//                // Add the DENM payload
//                v_gnNonSecuredPacket.payload := valueof(
//                    valueof(
//                        bit2oct(
//                            encvalue(
//                                m_denmReq(
//                                    m_denmPdu(
//                                        m_denm(
//                                            m_denmMgmtCon(
//                                                m_tsActionId
//                                            ),
//                                            v_situation,
//                                            m_denmLocation_zeroDelta
//                )))))));
//                
//                // Encode it
//                v_gnPayload := bit2oct(
//                    encvalue(
//                        v_gnNonSecuredPacket
//                    )
//                );
//                f_buildGnSecuredDenm(
//                    v_securedMessage,
//                        m_payload_unsecured(
//                            v_gnPayload
//                    ),
//                    e_certificate_digest_with_sha256,
//                    valueof(m_threeDLocation(
//                        v_longPosVectorNodeB.latitude,
//                        v_longPosVectorNodeB.longitude,
//                        '0000'O
//                    ))
//                );
//                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_09_03_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured DENM containing payload of type 'encrypted'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing payload_field
//             *              containing type
//             *                  indicating 'encrypted'
//             *              and containing data
//             *                  indicating length > 0
//             *  } 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_DENM_09_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_09_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GnNonSecuredPacket v_gnNonSecuredPacket;
//                var octetstring v_gnPayload;
//                var template (value) Ieee1609Dot2Data v_securedMessage;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
//                
//                // 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_gnNonSecuredPacket := valueof(
//                    m_geoNwBroadcastPacket(
//                        v_longPosVectorNodeB,
//                        vc_localSeqNumber,
//                        f_getGeoBroadcastArea(
//                            c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
//                )));
//                // Add the DENM payload
//                v_gnNonSecuredPacket.payload := valueof(
//                    valueof(
//                        bit2oct(
//                            encvalue(
//                                m_denmReq(
//                                    m_denmPdu(
//                                        m_denm(
//                                            m_denmMgmtCon(
//                                                m_tsActionId
//                                            ),
//                                            v_situation,
//                                            m_denmLocation_zeroDelta
//                )))))));
//                
//                // Encode it
//                v_gnPayload := bit2oct(
//                    encvalue(
//                        v_gnNonSecuredPacket
//                    )
//                );
//                f_buildGnSecuredDenm(
//                    v_securedMessage,
//                        m_payload_encrypted(
//                            v_gnPayload
//                    ),
//                    e_certificate_digest_with_sha256,
//                    valueof(m_threeDLocation(
//                        v_longPosVectorNodeB.latitude,
//                        v_longPosVectorNodeB.longitude,
//                        '0000'O
//                    ))
//                );
//                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_09_04_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured DENM containing payload of type 'signed_external'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing payload_field
//             *              containing type
//             *                  indicating 'signed_external'
//             *              and containing data
//             *                  indicating length > 0
//             *  } 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_DENM_09_05_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_09_05_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GnNonSecuredPacket v_gnNonSecuredPacket;
//                var octetstring v_gnPayload;
//                var template (value) Ieee1609Dot2Data v_securedMessage;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
//                
//                // 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_gnNonSecuredPacket := valueof(
//                    m_geoNwBroadcastPacket(
//                        v_longPosVectorNodeB,
//                        vc_localSeqNumber,
//                        f_getGeoBroadcastArea(
//                            c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
//                )));
//                // Add the DENM payload
//                v_gnNonSecuredPacket.payload := valueof(
//                    valueof(
//                        bit2oct(
//                            encvalue(
//                                m_denmReq(
//                                    m_denmPdu(
//                                        m_denm(
//                                            m_denmMgmtCon(
//                                                m_tsActionId
//                                            ),
//                                            v_situation,
//                                            m_denmLocation_zeroDelta
//                )))))));
//                
//                // Encode it
//                v_gnPayload := bit2oct(
//                    encvalue(
//                        v_gnNonSecuredPacket
//                    )
//                );
//                f_buildGnSecuredDenm(
//                    v_securedMessage,
//                        m_payload_signed_external(
//                            v_gnPayload
//                    ),
//                    e_certificate_digest_with_sha256,
//                    valueof(m_threeDLocation(
//                        v_longPosVectorNodeB.latitude,
//                        v_longPosVectorNodeB.longitude,
//                        '0000'O
//                    ))
//                );
//                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_09_05_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured DENM containing exactly one non-empty payload of type 'signed_and_encrypted'
//             * <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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A) 
//             *          containing payload_field
//             *              containing type
//             *                  indicating 'signed_and_encrypted'
//             *              and containing data
//             *                  indicating length > 0
//             *  } 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_DENM_09_06_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_09_06_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GnNonSecuredPacket v_gnNonSecuredPacket;
//                var octetstring v_gnPayload;
//                var template (value) Ieee1609Dot2Data v_securedMessage;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
//                
//                // 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_gnNonSecuredPacket := valueof(
//                    m_geoNwBroadcastPacket(
//                        v_longPosVectorNodeB,
//                        vc_localSeqNumber,
//                        f_getGeoBroadcastArea(
//                            c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
//                )));
//                // Add the DENM payload
//                v_gnNonSecuredPacket.payload := valueof(
//                    valueof(
//                        bit2oct(
//                            encvalue(
//                                m_denmReq(
//                                    m_denmPdu(
//                                        m_denm(
//                                            m_denmMgmtCon(
//                                                m_tsActionId
//                                            ),
//                                            v_situation,
//                                            m_denmLocation_zeroDelta
//                )))))));
//                
//                // Encode it
//                v_gnPayload := bit2oct(
//                    encvalue(
//                        v_gnNonSecuredPacket
//                    )
//                );
//                f_buildGnSecuredDenm(
//                    v_securedMessage,
//                        m_payload_signed_and_encrypted(
//                            v_gnPayload
//                    ),
//                    e_certificate_digest_with_sha256,
//                    valueof(m_threeDLocation(
//                        v_longPosVectorNodeB.latitude,
//                        v_longPosVectorNodeB.longitude,
//                        '0000'O
//                    ))
//                );
//                v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                } // End of 'for' statement
//                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_DENM_09_06_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured DENM if the message does not contain the trailer field of type signature
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//            *            containing trailer_fields
//            *                not containing any instance of type TrailerField
//            *                    containing type
//            *                        indicating 'signature'
//             *   } 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_DENM_10_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_10_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm_Bo(cc_taCert_A, -, 0);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_10_01_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured DENM containing more than one instance of TrailerField of type 'signature'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//            *          containing trailer_fields[0].type
//            *              containing type
//            *                  indicating 'signature'
//            *          and containing trailer_fields[1].type
//            *              containing type
//            *                  indicating 'signature'
//             *   } 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_DENM_10_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_10_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm_Bo(cc_taCert_A, -, 2);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_10_02_BO
//            
//            /**
//             * @desc    Check that the IUT discards Secured DENM containing signature that is not verified using the verification key from the certificate contained in the message's signer info
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//            *               containing header_fields ['signer_info']
//            *                   containing certificate (CERT_TS_A_AT)
//            *                       containing subject_attributes['verification key'] (KEY)
//            *               and containing trailer_fields[0]
//            *                   containing type
//            *                       indicating 'signature'
//            *                   and containing signature
//            *                       NOT verifiable using KEY
//             *   } 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_DENM_11_01_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.2 & 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_11_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm_Bo(
//                    cc_taCert_A, 
//                    -, 
//                    1, 
//                    -, 
//                    e_certificate
//                );
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_11_01_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured DENM if the message contains trailer field of type 'signature' with reserved public key algorythms
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//            *               containing trailer_fields
//            *                   containing an instance of type TrailerField
//            *                       containing type
//            *                           indicating 'signature'
//            *                       and containing signature.algorithm
//            *                           indicating X_RESERVED_PK_ALGORYTHM
//             *   } 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_DENM_11_02_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.2 & 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_11_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm_Bo(
//                    cc_taCert_A, 
//                    -, 
//                    3 
//                );
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_11_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM if the signer certificate of the message contains the subject type 'enrolment_credential'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//             *          containing header_fields['signer_info']
//             *              containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  containing certificate (CERT_TS_EC_A)
//             *                      containing subject_info.subject_type
//             *                          indicating 'enrolment_credentials'
//             *   } 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_DENM_12_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_12_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(
//                    cc_taCert_EC, 
//                    {
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate
//                ); 
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_12_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM if the signer certificate of the message contains the subject type "authorization_authority"
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//             *          containing header_fields['signer_info']
//             *              containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  containing certificate (CERT_TS_A_AA)
//             *                      containing subject_info.subject_type
//             *                          indicating 'authorization_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_DENM_12_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_12_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(
//                    cc_taCert_AA, 
//                    {
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate
//                ); 
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_12_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM if the signer certificate of the message contains the subject type 'enrolment_authority'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//             *          containing header_fields['signer_info']
//             *              containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *              and certificate (CERT_TS_EA_A)
//             *                  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_DENM_12_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_12_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(
//                    cc_taCert_EA, 
//                    {
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate
//                ); 
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_12_03_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured DENM if the signer certificate of the message contains the subject type 'root_ca'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_A)
//             *          containing header_fields['signer_info']
//             *              containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *              and certificate (CERT_TS_ROOT)
//             *                  containing subject_info.subject_type
//             *                      indicating 'root_ca'
//             *   } 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_DENM_12_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_12_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(
//                    cc_taCert_CA, 
//                    {
//                        m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                        m_header_info_its_aid_DENM
//                    }, 
//                    e_certificate
//                ); 
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_12_04_BO
//            
//            /**
//             * @desc    Check that IUT discards secured DENM signed with the not yet valid certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_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_DENM_13_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_13_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(cc_taCertMsg1301_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_13_01_BO
//            
//            /**
//             * @desc    Check that IUT discards secured DENM signed with the expired certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_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_DENM_13_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_13_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(cc_taCertMsg1302_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_13_02_BO
//            
//            /**
//             * @desc    Check that IUT discards secured DENM when IUT location is outside the circular validity restriction of the signing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_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_DENM_13_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_13_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(cc_taCertMsg1303_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_13_03_BO
//            
//            /**
//             * @desc    Check that IUT discards secured DENM when IUT location is outside the rectangular validity restriction of the signing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_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_DENM_13_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_13_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(cc_taCertMsg1304_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_13_04_BO
//            
//            /**
//             * @desc    Check that IUT discards secured DENM when IUT location is outside the polygonal validity restriction of the signing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_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_DENM_13_05_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_13_05_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(cc_taCertMsg1305_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_13_05_BO
//            
//            /**
//             * @desc    Check that IUT discards secured DENM when IUT location is outside the identified validity restriction of the signing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_DENM_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_DENM_13_06_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_DENM_13_06_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredDenm(cc_taCertMsg1306_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_DENM_13_06_BO
        } // End of group recvDenmProfile
        
        /**
         * @desc Receiving behaviour test cases for Other profile
garciay's avatar
garciay committed
         * @see ETSI TS 103 096-2 V1.3.32 (2018-01) Clause 5.3.4 Generic Signed Message Profile
         */
        group recvOtherProfile {
             * @desc Function used to verify the IUT has forwarded or discarded the received secured message sent by the TA
            group commonFunctions {
//                /**
//                 * @desc    Behavior function for NodeD in case of forwarding is expected
//                 * @see     TC_GEONW_PON_GBC_BV_01
//                 */
//                function f_TC_SEC_ITSS_RCV_GENMSG_xxx_BV_nodeD() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
//                    
//                    // Test Body
//                    tc_ac.start;
//                    alt {
//                        [] geoNetworkingPort.receive(
//                            mw_geoNwInd(
//                                mw_geoNwSecPdu(
//                                    mw_ieee1609Dot2Data_dummy, 
//                                    mw_geoNwBroadcastPacketWithArea(
//                                        mw_longPosVectorPosition(
//                                            v_longPosVectorNodeB
//                                        ),
//                                        ?,
//                                        f_getGeoBroadcastArea(c_area1)
//                        )))) {
//                            tc_ac.stop;
//                            log("*** " & testcasename() & ": PASS: Beacon message was forwarded ***");
//                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                        }
//                        [] geoNetworkingPort.receive(
//                            mw_geoNwInd(
//                                mw_geoNwSecPdu(
//                                    mw_ieee1609Dot2Data_dummy
//                        ))) {
//                            // Do not restart tc_ac timer
//                            log("*** " & testcasename() & ": INFO: Unexpected GN message ignored ***");
//                            repeat;
//                        }
//                        [] tc_ac.timeout {
//                            log("*** " & testcasename() & ": FAIL: GBC message not received ***");
//                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
//                        }
//                    }
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    
//                } // End of function f_TC_SEC_ITSS_RCV_GENMSG_xxx_BV_nodeD
//                
//                /**
//                 * @desc    Behavior function for NodeD in case of forwarding is not expected
//                 * @see     TC_GEONW_PON_GBC_BV_01
//                 */
//                function f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
//                    
//                    // Test Body
//                    tc_noac.start;
//                    alt {
//                        [] geoNetworkingPort.receive(
//                            mw_geoNwInd(
//                                mw_geoNwSecPdu(
//                                    mw_ieee1609Dot2Data_dummy, 
//                                    mw_geoNwBroadcastPacketWithArea(
//                                        mw_longPosVectorPosition(
//                                            v_longPosVectorIut
//                                        ),
//                                        ?,
//                                        f_getGeoBroadcastArea(c_area1)
//                        )))) {
//                            tc_noac.stop;
//                            log("*** " & testcasename() & ": FAIL: Beacon message shall ot be forwarded ***");
//                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                        }
//                        [] geoNetworkingPort.receive(
//                            mw_geoNwInd(
//                                mw_geoNwSecPdu(
//                                    mw_ieee1609Dot2Data_dummy
//                        ))) {
//                            // Do not restart tc_ac timer
//                            log("*** " & testcasename() & ": INFO: Unexpected GN message ignored ***");
//                            repeat;
//                        }
//                        [] tc_noac.timeout {
//                            log("*** " & testcasename() & ": PASS: Secured message was discarded ***");
//                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
//                        }
//                    }
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    
//                } // End of function f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD
            } // End of goup commonFunctions
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured GN Beacon signed with the certificate without region validity restriction
//             * @remark  The message defined in this test purpose is used in the subsequent test purposes with the snippet name ‘MSG_SEC_RCV_GENMSG_C’. Only differences to this snippet are mentioned in subsequent test purposes
//             * <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 Ieee1609Dot2Data
//             *          containing header_fields[0]
//             *              containing type 
//             *                  indicating 'signer_info'
//             *              and containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  and containing certificate (CERT_AT_A)
//             *                      containing subject_info.subject_type
//             *                          indicating 'authorization_ticket' (2)
//             *                      and containing subject_attributes['verification key'] (KEY)
//             *                      and containing validity_restrictions['time_start_and_end']
//             *                          indicating CERT_TS_AT_TIME_VALIDITY
//             *             and not containing validity_restrictions['region']
//             *       and containing header_fields [1]
//             *         containing type 
//             *           indicating 'generation_time'
//             *              containing generation_time
//             *                  indicating CURRENT_TIME
//             *                      inside CERT_TS_AT_TIME_VALIDITY
//             *       and containing header_fields [2]
//             *           containing type 
//             *               indicating 'generation_location'
//             *                   containing generation_location
//             *           and containing generation_location
//             *       and containing header_fields[3]
//             *           containing type 
//             *               indicating 'its_aid'
//             *           and containing its_aid
//             *              indicating 'AID_BEACON'
//             *          and containing payload_field 
//             *               containing type
//             *                  indicating 'signed'
//             *              containing data
//             *                  indicating length > 0
//             *          and containing trailer_fields 
//             *              containing single instance of type TrailerField 
//             *                  containing type
//             *                      indicating 'signature'
//             *                  containing signature
//             *                      verifiable using KEY
//             *   } then {
//             *     the IUT accepts the message
//             *   }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_01_01_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_01_01_BV() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV_nodeB(cc_taCert_A));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BV_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_01_01_BV
//            
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured GN Beacon signed with the certificate with a circular region validity restriction
//             * @remark  The message defined in this test purpose is used in the subsequent test purposes with the snippet name ‘MSG_SEC_RCV_GENMSG_C’. Only differences to this snippet are mentioned in subsequent test purposes
//             * <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_B_AT
//             *   and the IUT current location is inside the region validity period of CERT_TS_B_AT
//             * }
//             * ensure that {
//             *   when {
//             *     the IUT is receiving a Ieee1609Dot2Data
//             *         containing protocol_version 
//             *             indicating value '2'
//             *         and containing header_fields[0]
//             *              containing type 
//             *                  indicating 'signer_info'
//             *              and containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  and containing certificate (CERT_TS_B_AT)
//             *                      containing subject_info.subject_type
//             *                          indicating 'authorization_ticket' (2)
//             *                      and containing subject_attributes['verification key'] (KEY)
//             *                      and containing validity_restrictions['time_start_and_end']
//             *                          indicating CERT_TS_AT_TIME_VALIDITY
//             *                      and containing validity_restrictions['region']
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'circle'
//             *                              and containing circular_region
//             *                                  indicating REGION
//             *       and containing header_fields [1]
//             *         containing type 
//             *           indicating 'generation_time'
//             *              containing generation_time
//             *                  indicating CURRENT_TIME
//             *       and containing header_fields [2]
//             *           containing type 
//             *               indicating 'generation_location'
//             *           and containing generation_location
//             *       and containing header_fields[3]
//             *           containing type 
//             *               indicating 'its_aid'
//             *           and containing its_aid
//             *               indicating 'AID_BEACON'
//             *          and containing payload_field 
//             *               containing type
//             *                  indicating 'signed'
//             *              containing data
//             *                  indicating length > 0
//             *          and containing trailer_fields 
//             *              containing single instance of type TrailerField 
//             *                  containing type
//             *                      indicating 'signature'
//             *                  containing signature
//             *                      verifiable using KEY
//             *   } then {
//             *     the IUT accepts the message
//             *   }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_01_02_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_01_02_BV() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV_nodeB(cc_taCert_B));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BV_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_01_02_BV
//            
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured GN Beacon signed with the certificate with a rectangular region validity restriction
//             * @remark  The message defined in this test purpose is used in the subsequent test purposes with the snippet name ‘MSG_SEC_RCV_GENMSG_C’. Only differences to this snippet are mentioned in subsequent test purposes
//             * <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_C_AT
//             *   and the IUT current location is inside the region validity period of CERT_TS_C_AT
//             * }
//             * ensure that {
//             *   when {
//             *     the IUT is receiving a Ieee1609Dot2Data
//             *         containing protocol_version 
//             *             indicating value '2'
//             *         and containing header_fields[0]
//             *              containing type 
//             *                  indicating 'signer_info'
//             *              and containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  and containing certificate (CERT_TS_C_AT)
//             *                      containing subject_info.subject_type
//             *                          indicating 'authorization_ticket' (2)
//             *                      and containing subject_attributes['verification key'] (KEY)
//             *                      and containing validity_restrictions['time_start_and_end']
//             *                          indicating CERT_TS_AT_TIME_VALIDITY
//             *                      and containing validity_restrictions['region']
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'rectangle'
//             *                              and containing rectangular_region
//             *                                  indicating REGION
//             *       and containing header_fields [1]
//             *         containing type 
//             *           indicating 'generation_time'
//             *              containing generation_time
//             *                  indicating CURRENT_TIME
//             *       and containing header_fields [2]
//             *           containing type 
//             *               indicating 'generation_location'
//             *           and containing generation_location
//             *       and containing header_fields[3]
//             *           containing type 
//             *               indicating 'its_aid'
//             *           and containing its_aid
//             *               indicating 'AID_BEACON'
//             *          and containing payload_field 
//             *               containing type
//             *                  indicating 'signed'
//             *              containing data
//             *                  indicating length > 0
//             *          and containing trailer_fields 
//             *              containing single instance of type TrailerField 
//             *                  containing type
//             *                      indicating 'signature'
//             *                  containing signature
//             *                      verifiable using KEY
//             *   } then {
//             *     the IUT accepts the message
//             *   }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_01_03_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_01_03_BV() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV_nodeB(cc_taCert_C));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BV_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_01_03_BV
//            
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured GN Beacon signed with the certificate with a rectangular region validity restriction
//             * @remark  The message defined in this test purpose is used in the subsequent test purposes with the snippet name ‘MSG_SEC_RCV_GENMSG_C’. Only differences to this snippet are mentioned in subsequent test purposes
//             * <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_D_AT
//             *   and the IUT current location is inside the region validity period of CERT_TS_D_AT
//             * }
//             * ensure that {
//             *   when {
//             *     the IUT is receiving a Ieee1609Dot2Data
//             *         containing protocol_version 
//             *             indicating value '2'
//             *         and containing header_fields[0]
//             *              containing type 
//             *                  indicating 'signer_info'
//             *              and containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  and containing certificate (CERT_TS_D_AT)
//             *                      containing subject_info.subject_type
//             *                          indicating 'authorization_ticket' (2)
//             *                      and containing subject_attributes['verification key'] (KEY)
//             *                      and containing validity_restrictions['time_start_and_end']
//             *                          indicating CERT_TS_AT_TIME_VALIDITY
//             *                      and containing validity_restrictions['region']
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'polygon'
//             *                              and containing polygonal_region
//             *                                  indicating REGION
//             *       and containing header_fields [1]
//             *         containing type 
//             *           indicating 'generation_time'
//             *              containing generation_time
//             *                  indicating CURRENT_TIME
//             *       and containing header_fields [2]
//             *           containing type 
//             *               indicating 'generation_location'
//             *           and containing generation_location
//             *       and containing header_fields[3]
//             *           containing type 
//             *               indicating 'its_aid'
//             *           and containing its_aid
//             *               indicating 'AID_BEACON'
//             *          and containing payload_field 
//             *               containing type
//             *                  indicating 'signed'
//             *              containing data
//             *                  indicating length > 0
//             *          and containing trailer_fields 
//             *              containing single instance of type TrailerField 
//             *                  containing type
//             *                      indicating 'signature'
//             *                  containing signature
//             *                      verifiable using KEY
//             *   } then {
//             *     the IUT accepts the message
//             *   }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_01_04_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_01_04_BV() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV_nodeB(cc_taCert_D));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BV_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_01_04_BV
//            
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured GN Beacon signed with the certificate with a rectangular region validity restriction
//             * @remark  The message defined in this test purpose is used in the subsequent test purposes with the snippet name ‘MSG_SEC_RCV_GENMSG_C’. Only differences to this snippet are mentioned in subsequent test purposes
//             * <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_E_AT
//             *   and the IUT current location is inside the region validity period of CERT_TS_E_AT
//             * }
//             * ensure that {
//             *   when {
//             *     the IUT is receiving a Ieee1609Dot2Data
//             *         containing protocol_version 
//             *             indicating value '2'
//             *         and containing header_fields[0]
//             *              containing type 
//             *                  indicating 'signer_info'
//             *              and containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  and containing certificate (CERT_TS_E_AT)
//             *                      containing subject_info.subject_type
//             *                          indicating 'authorization_ticket' (2)
//             *                      and containing subject_attributes['verification key'] (KEY)
//             *                      and containing validity_restrictions['time_start_and_end']
//             *                          indicating CERT_TS_AT_TIME_VALIDITY
//             *                      and containing validity_restrictions['region']
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'id_region'
//             *                              and containing id_region
//             *                                  indicating REGION
//             *       and containing header_fields [1]
//             *         containing type 
//             *           indicating 'generation_time'
//             *              containing generation_time
//             *                  indicating CURRENT_TIME
//             *       and containing header_fields [2]
//             *           containing type 
//             *               indicating 'generation_location'
//             *           and containing generation_location
//             *       and containing header_fields[3]
//             *           containing type 
//             *               indicating 'its_aid'
//             *           and containing its_aid
//             *               indicating 'AID_BEACON'
//             *          and containing payload_field 
//             *               containing type
//             *                  indicating 'signed'
//             *              containing data
//             *                  indicating length > 0
//             *          and containing trailer_fields 
//             *              containing single instance of type TrailerField 
//             *                  containing type
//             *                      indicating 'signature'
//             *                  containing signature
//             *                      verifiable using KEY
//             *   } then {
//             *     the IUT accepts the message
//             *   }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_01_05_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_01_05_BV() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV_nodeB(cc_taCert_E));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BV_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_01_05_BV
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV {
//                
//                /**
//                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                 */
//                function f_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV_nodeB(
//                                                                 in charstring p_taCert
//                ) runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := 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_01_0x_BV_nodeB
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_01_0x_BV
//            
//            /**
//             * @desc    Check that IUT discards a Secured GN Message containing protocol version set to a value less than 2
//             * <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 Ieee1609Dot2Data
//             *         containing protocol_version 
//             *             indicating 1
//             *   } 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_02_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 5.1
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_02_01_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_02_0x_BO_nodeB(PX_WRONG_PROTOCOL_VERSION));
//                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_02_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured GN Message containing protocol version set to a value greater than 2
//             * <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 Ieee1609Dot2Data
//             *         containing protocol_version 
//             *             indicating 3
//             *   } 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_02_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 5.1
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_02_02_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_02_0x_BO_nodeB(PX_WRONG_PROTOCOL_VERSION));
//                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_02_02_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_02_0x_BO {
//                
//                /**
//                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                 */
//                function f_TC_SEC_ITSS_RCV_GENMSG_02_0x_BO_nodeB(
//                                                                 in UInt8 p_protocolVersion
//                ) runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_sendSecuredBeacon_Bo(cc_taCert_A, p_protocolVersion);
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of function f_TC_SEC_ITSS_RCV_GENMSG_02_0x_BO_nodeB
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_02_0x_BV
//            
//            /**
//             * @desc    Check that IUT discards a secured GN Message if the header_fields contains more than one header field of type 'signer_info'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[3].type
//             *              indicating ''generation_location''
//             *          and containing header_fields[4].type
//             *              containing its_aid
//             *                  indicating 'AID_BEACON'
//             *          and not containing other header fields
//             *  } 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_04_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_01_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_01_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_01_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_01_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_01_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )), 
//                            m_header_info_signer_info(
//                                m_signerIdentifier_certificate(
//                                    vc_aaCertificate
//                            )), 
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_01_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_01_BO 
//            
//            /**
//             * @desc    Check that IUT discards a secured GN Message if the header_fields does not contain the header field of type 'signer_info'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          and containing header_fields[0].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[2].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[3].type
//             *              containing its_aid
//             *                  indicating 'AID_BEACON'
//             *          and not containing other header fields
//             *  } 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_04_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_02_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_02_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_02_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_02_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_02_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_02_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_02_BO 
//            
//            /**
//             * @desc    Check that IUT is able to receive a secured GN Message if the signer_info header field is not encoded first.
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          and containing header_fields[0].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[2].type
//             *              containing its_aid
//             *                  indicating 'AID_BEACON'
//             *          and containing header_fields[3].type
//             *              indicating 'signer_info'
//             *          and not containing other header fields
//             *  } 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_04_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_03_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_03_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_03_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_03_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_03_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other,
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            ))
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_03_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_03_BO 
//            
//            /**
//             * @desc    Check that IUT discards a secured GN Message if the message contains more than one header field of type 'generation_time'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[3].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[4].type
//             *              containing its_aid
//             *                  indicating 'AID_BEACON'
//             *          and not containing other header fields
//             *  } 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_04_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_04_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_04_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_04_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_04_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_04_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )),
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_time(1000 * f_getCurrentTime() - 1), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_04_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_04_BO 
//            
//            /**
//             * @desc    Check that IUT discards a secured GN Message if the message does not contain the header field of type 'generation_time'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *              containing its_aid
//             *                  indicating 'AID_BEACON'
//             *          and not containing other header fields
//             *  } 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_04_05_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_05_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_05_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_05_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_05_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_05_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )),
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_05_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_05_BO 
//            
//            /**
//             * @desc    Check that IUT discards a Secured GN Message if the message contains more than one header field of type 'its_aid'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[3]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_BEACON'
//             *          and containing header_fields[4].type
//             *              containing its_aid
//             *                  indicating 'AID_BEACON'
//             *          and not containing other header fields
//             *  } 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_04_06_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_06_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_06_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_06_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_06_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_06_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )),
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other,
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_06_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_06_BO 
//            
//            /**
//             * @desc    Check that IUT discards a secured GN Message if the message does not contain the header field of type 'its_aid'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_location'
//             *          and not containing other header fields
//             *  } 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_04_06a_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_06a_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_06a_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_06a_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_06a_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_06a_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )),
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            )
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_06a_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_06a_BO 
//            
//            /**
//             * @desc    Check that IUT discards a secured GN Message if the message contains more than one header field of type 'generation_location'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[3].type
//             *              indicating 'generation_location'
//             *          and containing header_fields[4]
//             *              containing type
//             *                  indicating 'its_aid'
//             *              containing its_aid
//             *                  indicating 'AID_BEACON'
//             *          and not containing other header fields
//             *  } 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_04_07_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_07_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_07_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_07_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_07_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_07_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )),
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0100'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_07_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_07_BO 
//            
//            /**
//             * @desc    Check that IUT discards a secured GN Message if the message contains more than one header field of type 'generation_location'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *          and containing header_fields[4].type
//             *              indicating 'its_aid'
//             *                  containing its_aid
//             *                      indicating 'AID_BEACON'
//             *          and not containing other header fields
//             *  } 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_04_08_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_08_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_08_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_08_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_08_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_08_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )),
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_08_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_08_BO 
//            
//            /**
//             * @desc    Check that IUT is able to receive a Secured GN Beacon if the header fields are not in the ascending order according to the numbering of the enumeration
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'its_aid'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[3].type
//             *          and not containing other header fields
//             *  } 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_04_09_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_09_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_09_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_09_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_09_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_09_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )),
//                            m_header_info_its_aid_Other,
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            )
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_09_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_09_BO 
//            
//            /**
//             * @desc    Check that IUT accepts a GN Secured Message containing optional header field of type 'expiry_time'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'its_aid'
//             *          and containing header_fields[2].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[3].type
//             *          and not containing other header fields
//             *  } 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_04_11_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_11_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_11_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_11_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_11_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_11_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )),
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_expiry_time(
//                                1000 * (3600 + f_getCurrentTime()) // In us
//                            ),
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_11_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_11_BO 
//            
//            /**
//             * @desc    Check that IUT accepts the Secured GN Message containing additional non-standard HeaderInfo
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *          and containing header_fields[3].type
//             *              indicating 'its_aid'
//             *          and containing header_fields[4]
//             *              containing type
//             *                  indicating non-standard header field type (1000)
//             *              and containing other_header
//             *                  indicating non-empty data
//             *          and not containing other header fields
//             *  } 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_04_12_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_12_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_12_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_12_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_12_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_12_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )),
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_expiry_time(
//                                1000 * (3600 + f_getCurrentTime()) // In us
//                            ),
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other,
//                            m_header_info_unspecify
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_12_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_12_BO 
//            
//            /**
//             * @desc    Check that IUT accepts the Secured GN Message containing additional non-standard HeaderInfo
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *          and containing header_fields[1].type
//             *              indicating 'generation_time'
//             *          and containing header_fields[2].type
//             *          and containing header_fields[3].type
//             *              indicating 'its_aid'
//             *          and containing header_fields[4]
//             *              containing type
//             *                  indicating 'encryption_parameters'
//             *              and containing enc_params
//             *                  containing symm_algorithm
//             *                      indicating 'aes_128_ccm'
//             *                  and containing nonce
//             *              and containing header_fields[4]
//             *                  containing type
//             *                      indicating 'recipient_info'
//             *                  and containing recipients
//             *                      containing recipients[0]
//             *                          containing cert_id
//             *                              referencing to CERT_IUT_A_AT
//             *                          and containing pk_encryption
//             *                              indicating 'ecies_nistp256'
//             *                          and containing enc_key
//             *          and not containing other header fields
//             *  } 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_04_13_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_04_13_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_04_13_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_04_13_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_04_13_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_04_13_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var Certificate v_iutATCertificate;
//                    var SubjectAttribute v_encryption_key;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    if (
//                        (f_readCertificate(cc_iutCert_A, v_iutATCertificate) == false) or 
//                        (f_getCertificateSubjectAttribute(v_iutATCertificate, e_encryption_key, v_encryption_key) == false)
//                    ) {
//                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout); // Set verdict to inconc
//                    } else {
//                        v_securedGnPdu := f_prepareSecuredBeacon(
//                            cc_taCert_A, 
//                            {
//                                m_header_info_signer_info(
//                                    m_issuerIdentifier_sha256AndDigest(
//                                        vc_atCertificate.signer_info.signerInfo.digest
//                                )),
//                                m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                                m_header_info_expiry_time(
//                                    1000 * (3600 + f_getCurrentTime()) // In us
//                                ),
//                                m_header_info_generation_location(
//                                    valueof(m_threeDLocation(
//                                        v_longPosVectorNodeB.latitude,
//                                        v_longPosVectorNodeB.longitude,
//                                        '0000'O
//                                    ))
//                                ),
//                                m_header_info_its_aid_Other,
//                                m_header_info_enc_params(                                  // containing header_fields[3].type.enc_params
//                                    m_encryptionParameters_aes_128_ccm(                     //      indicating 'aes_128_ccm'
//                                        PX_ENCRYPTIONPARAMETERS_AES_128_CCM_NONCE           // and containing nonce
//                                    )
//                                ),
//                                m_header_info_multiple_recipients(                         // containing header_fields[4].type
//                                    {                                                       //     indicating 'encryption_parameters'
//                                        m_recipientInfo_ecies_enc_key(
//                                            v_iutATCertificate.signer_info.signerInfo.digest,
//                                            e_ecies_nistp256,                               // containing symm_algorithm
//                                                                                            //     indicating 'aes_128_ccm'
//                                            m_eciesEncryptedKey_aesccm(
//                                                v_encryption_key.attribute.rv,
//                                                '00000000000000000000000000000000'O, // FIXME Where to find these values
//                                                '00000000000000000000000000000000'O
//                                            )
//                                        )
//                                    }
//                                )
//                            }, 
//                            e_certificate_digest_with_sha256,
//                            false
//                        ); 
//                        f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    }
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_04_13_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_04_13_BO 
//            
//            /**
//             * @desc    Check that IUT discards a secured GN Beacon if the header_fields contains a signer of type 'self'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields['signer_info']
//             *              containing signer.type
//             *                  indicating 'self''
//             *  } 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_05_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_05_01_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_05_01_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_05_01_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_05_01_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_05_01_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_signerIdentifier_self
//                            ), 
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_self,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_05_01_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_05_01_BO 
//            
//            /**
//             * @desc    Check that IUT discards a secured GN Beacon if the header_fields contains a signer of type 'certificate_digest_with_other_algorithm'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields['signer_info']
//             *              containing signer.type
//             *                  indicating 'certificate_digest_with_other_algorithm'
//             *  } 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_05_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_05_02_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_05_02_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_05_02_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_05_02_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_05_02_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_signerIdentifier_other_certificates(
//                                    m_certificateWithAlgo_ecdsa(
//                                        PX_OTHER_CERT_DIGEST
//                            ))), 
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_other_algorithm,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_05_02_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_05_02_BO 
//            
//            /**
//             * @desc    Check that IUT discards a secured GN Beacon if the header_fields contains a signer of type 'certificate_chain'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields['signer_info']
//             *              containing signer.type
//             *                  indicating 'certificate_chain'
//             *  } 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_05_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_05_03_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_05_03_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_05_03_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_05_03_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_05_03_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_signerIdentifier_certificates(
//                                    { vc_atCertificate }
//                            )), 
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_chain,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_05_03_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_05_03_BO 
//            
//            /**
//             * @desc    Check that IUT discards a Secured Messageif the header_fields contains a signer info of unknown or reserved type
//             * @remark  Values to be used as X_UNKNOWN_SIGNERINFO_TYPE are 5, 239, 240 and 255
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields['signer_info']
//             *              containing signer.type
//             *                  indicating X_UNKNOWN_SIGNERINFO_TYPE
//             *  } 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_05_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_05_04_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_05_04_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_05_04_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_05_04_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_05_04_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_signer_info(
//                                m_signerIdentifier_unknown(
//                                    'CAFFEEDECA'O
//                            )), 
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_unknown,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_05_04_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_05_04_BO 
//            
//            /**
//             * @desc    Check that IUT discards a secured GN Message containing generation_time before the message signing certificate validity period
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A)
//             *          containing header_fields['signer_info'].type
//             *              indicating 'signer_info'
//             *                  containing certificate (CERT_TS_MSG_06_01_BO_AT)
//             *                      containing validity_restrictions['time_start_and_end']
//             *                          containing start_validity
//             *                              indicating START_VALIDITY_AT
//             *                          and containing end_validity
//             *                              indicating END_VALIDITY_AT
//             *                  and containing header_fields ['generation_time']
//             *                      containing generation_time
//             *                          indicating GEN_TIME < TIME_CERT_TS_AT_START
//             *  } 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_06_01_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 5.4 and 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_06_01_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_06_01_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_06_01_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_06_01_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_06_01_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    var ValidityRestriction v_validity;
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    f_getCertificateValidityRestriction(vc_atCertificate, e_time_start_and_end, v_validity);
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert0601_BO, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )), 
//                            m_header_info_generation_time( 
//                                (v_validity.validity.time_start_and_end.start_validity - 3600) * 1000
//                            ), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_06_01_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_06_01_BO 
//            
//            /**
//             * @desc    Check that IUT discards the secured GN Message containing generation_time after the message signing certificate validity period
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields['signer_info'].type
//             *              indicating 'signer_info'
//             *                  containing certificate (CERT_TS_MSG_06_02_BO_AT)
//             *                      containing validity_restrictions['time_start_and_end']
//             *                          containing start_validity
//             *                              indicating START_VALIDITY_AT
//             *                          and containing end_validity
//             *                              indicating END_VALIDITY_AT
//             *                  and containing header_fields ['generation_time']
//             *                      containing generation_time
//             *                          indicating GEN_TIME > TIME_CERT_TS_E_ATND
//             *  } 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_06_02_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 5.4 & 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_06_02_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_06_02_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_06_02_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_06_02_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_06_02_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    var ValidityRestriction v_validity;
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    f_getCertificateValidityRestriction(vc_atCertificate, e_time_start_and_end, v_validity);
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert0602_BO, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )), 
//                            m_header_info_generation_time(
//                                (v_validity.validity.time_start_and_end.end_validity + 3600) * 1000
//                            ), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_longPosVectorNodeB.latitude,
//                                    v_longPosVectorNodeB.longitude,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_06_02_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_06_02_BO 
//            
//            /**
//             * @desc    Check that IUT discards Secured GN Message if the generation_time is more than 10 minute in the past (C2C only)
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields ['generation_time']
//             *              containing generation_time
//             *                  indicating TIME_1 (TIME_1 < CUR_TIME - 10min)
//             *  } 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_06_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_06_03_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_06_03_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_06_03_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_06_03_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_06_03_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_generation_time( 
//                                (1000 * f_getCurrentTime() - 600) * 1000
//                            ) // In us
//                        }, 
//                        e_certificate
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_06_03_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_06_03_BO 
//            
//            /**
//             * @desc    Check that IUT discards Secured GN Message if the generation_time is more than 10 minute in the future(C2C only)
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing header_fields ['generation_time']
//             *              containing generation_time
//             *                  indicating TIME_1 (TIME_1 > CUR_TIME + 10min)
//             *  } 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_06_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_06_04_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_06_04_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_06_04_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_06_04_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_06_04_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_generation_time( 
//                                (1000 * f_getCurrentTime() + 600) * 1000
//                            ) // In us
//                        }, 
//                        e_certificate
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_06_04_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_06_04_BO 
//            
//            /**
//             * @desc    Check that IUT discards Ieee1609Dot2Data when its_aid value is undefined
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A)
//             *          containing header_fields['its_aid']
//             *              indicating indicating 'AID_UNDEFINED'
//             *  } 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_07_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_07_01_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_07_01_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_07_01_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_07_01_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_07_01_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_sha256
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_07_01_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_07_01_BO 
//            
//            /**
//             * @desc    Check that IUT discards Secured GN Message if the HeaderInfo generation_location is outside of the circular validity region of the signing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRCand PICS_USE_CIRCULAR_REGION
//             * 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_B_AT
//             *    and the IUT current location is inside the validity region of CERT_TS_B_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data ((MSG_SEC_RCV_GENMSG_B)) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *                  containing certificate (CERT_TS_B_AT)
//             *                      containing validity_restrictions ['region']
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'circle'
//             *                              and containing circular_region
//             *                                  indicating REGION
//             *          and containing header_fields ['generation_location']
//             *              indicating location outside of the REGION
//             *  } 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_08_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_08_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) or not(PICS_USE_CIRCULAR_REGION)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_USE_CIRCULAR_REGION' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_08_xx_BO(cc_taCert_B));
//                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_08_01_BO
//            
//            /**
//             * @desc    Check that IUT discards Secured GN Message if the HeaderInfo generation_location is outside of the rectangular validity region of the signing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_USE_RECTANGULAR_REGION
//             * 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_C_AT
//             *    and the IUT current location is inside the validity region of CERT_TS_C_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data ((MSG_SEC_RCV_GENMSG_C)) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *                  containing certificate (CERT_TS_C_AT)
//             *                      containing validity_restrictions ['region']
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'rectangle'
//             *                              and containing rectanglar_region
//             *                                  indicating REGION
//             *          and containing header_fields ['generation_location']
//             *              indicating location outside of the REGION
//             *  } 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_08_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_08_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) or not(PICS_USE_RECTANGULAR_REGION)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_USE_RECTANGULAR_REGION' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_08_xx_BO(cc_taCert_C));
//                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_08_02_BO
//            
//            /**
//             * @desc    Check that IUT discards Secured GN Message if the HeaderInfo generation_location is outside of the rectangular validity region of the signing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_USE_POLYGONAL_REGION
//             * 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_D_AT
//             *    and the IUT current location is inside the validity region of CERT_TS_D_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data ((MSG_SEC_RCV_GENMSG_D)) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *                  containing certificate (CERT_TS_D_AT)
//             *                      containing validity_restrictions ['region']
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'polygon'
//             *                              and containing polygonal_region
//             *                                  indicating REGION
//             *          and containing header_fields ['generation_location']
//             *              indicating location outside of the REGION
//             *  } 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_08_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_08_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) or not(PICS_USE_POLYGONAL_REGION)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_USE_POLYGONAL_REGION' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_08_xx_BO(cc_taCert_D));
//                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_08_03_BO
//            
//            /**
//             * @desc    Check that IUT discards Secured GN Message if the optional HeaderInfo generation_location is outside of the identified validity region of the signing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_USE_IDENTIFIED_REGION
//             * 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_E_AT
//             *    and the IUT current location is inside the validity region of CERT_TS_E_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data ((MSG_SEC_RCV_GENMSG_E)) 
//             *          containing header_fields[0].type
//             *              indicating 'signer_info'
//             *                  containing certificate (CERT_TS_E_AT)
//             *                      containing validity_restrictions ['region']
//             *                          containing region
//             *                              containing region_type
//             *                                  indicating 'id_region'
//             *                              and containing identified_region
//             *                                  indicating REGION
//             *          and containing header_fields ['generation_location']
//             *              indicating location outside of the REGION
//             *  } 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_08_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_08_04_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_08_xx_BO(cc_taCert_E));
//                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_08_04_BO
//            
//            /**
//             * @desc    Check that IUT accepts a Secured DENM if the distance between the current position of IUT and the value of optional HeaderInfo generation_location is 29.9 km (C2C only)
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A)
//             *          containing header_fields[generation_location].type 
//             *              indicating 'generation_location'
//             *          and containing generation_location
//             *              indicating position in 29.9 km from the current position of IUT
//             *   } then {
//             *     the IUT accepts the message
//             *   }
//             * }
//             * </pre>
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_GENMSG_08_05_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_08_05_BV() 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) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC and PICS_USE_IDENTIFIED_REGION' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_08_05_BV());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BV_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_08_05_BV
//            
//            /**
//             * @desc    Check that IUT discards Secured DENM if the distance between the current position of IUT and the value of optional HeaderInfo generation_location is more than 30 km
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * 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 Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A)
//             *          containing header_fields[generation_location].type 
//             *              indicating 'generation_location'
//             *          and containing generation_location
//             *              indicating position in 31 km from the current position of IUT
//             *   } 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_08_06_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.2
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_08_06_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_08_06_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_08_06_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_08_xx_BO {
//                
//                /**
//                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                 */
//                function f_TC_SEC_ITSS_RCV_GENMSG_08_xx_BO(
//                                                           in charstring p_taCert
//                ) runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        p_taCert, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )), 
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    PX_WGSLATITUDE,
//                                    PX_WGSLONGITUDE,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate_digest_with_sha256,
//                        false
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_08_xx_BO
//                
//                /**
//                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                 */
//                function f_TC_SEC_ITSS_RCV_GENMSG_08_05_BV() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var integer i;
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var GnRawPayload v_sentRawPayload;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    var Int32 v_latitude;
//                    var Int32 v_longitude;
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    fx_computePositionUsingDistance(
//                        v_longPosVectorNodeB.latitude,
//                        v_longPosVectorNodeB.longitude,
//                        29900.0, 
//                        0,
//                        v_latitude,
//                        v_longitude
//                    );
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_latitude,
//                                    v_longitude,
//                                    '0000'O
//                                ))
//                            )
//                        }, 
//                        e_certificate_digest_with_sha256
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_08_05_BV
//                
//                /**
//                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                 */
//                function f_TC_SEC_ITSS_RCV_GENMSG_08_06_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var integer i;
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var GnRawPayload v_sentRawPayload;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    var Int32 v_latitude;
//                    var Int32 v_longitude;
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    fx_computePositionUsingDistance(
//                        v_longPosVectorNodeB.latitude,
//                        v_longPosVectorNodeB.longitude,
//                        31000.0, 
//                        0,
//                        v_latitude,
//                        v_longitude
//                    );
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        cc_taCert_A, 
//                        {
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    v_latitude,
//                                    v_longitude,
//                                    '0000'O
//                                ))
//                            )
//                        }, 
//                        e_certificate_digest_with_sha256
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_poNeighbour();
//                    f_cf01Down();
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_08_06_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_08_xx_BO 
//            
//            /**
//             * @desc    Check that IUT discards the Secured GN Message containing empty payload of type 'signed'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing payload_field
//             *              containing type
//             *                  indicating 'signed'
//             *              and containing data
//             *                  indicating length 0
//             *  } 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_09_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_09_02_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_09_02_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_09_02_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_09_02_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_09_02_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GnNonSecuredPacket v_gnNonSecuredPacket;
//                    var octetstring v_gnPayload;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    var template (value) Ieee1609Dot2Data v_securedMessage;
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_gnNonSecuredPacket := valueof(
//                        m_geoNwBroadcastPacket(
//                            v_longPosVectorNodeB,
//                            vc_localSeqNumber,
//                            f_getGeoBroadcastArea(
//                                c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
//                    )));
//                    
//                    // Encode it
//                    v_gnPayload := bit2oct(
//                        encvalue(
//                            v_gnNonSecuredPacket
//                        )
//                    );
//                    f_buildGnSecuredOtherMessage(
//                        v_securedMessage,
//                        m_payload_signed(
//                            ''O
//                        ),
//                        e_certificate_digest_with_sha256,
//                        valueof(m_threeDLocation(
//                            v_longPosVectorNodeB.latitude,
//                            v_longPosVectorNodeB.longitude,
//                            '0000'O
//                        ))
//                    );
//                    v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_09_02_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_09_02_BO 
//            
//            /**
//             * @desc    Check that IUT discards the Secured GN Message containing payload element of type 'unsecured'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing payload_field
//             *              containing type
//             *                  indicating 'unsecured'
//             *              and containing data
//             *                  indicating length > 0
//             *  } 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_09_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_09_03_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_09_03_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_09_03_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_09_03_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_09_03_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GnNonSecuredPacket v_gnNonSecuredPacket;
//                    var octetstring v_gnPayload;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    var template (value) Ieee1609Dot2Data v_securedMessage;
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_gnNonSecuredPacket := valueof(
//                        m_geoNwBroadcastPacket(
//                            v_longPosVectorNodeB,
//                            vc_localSeqNumber,
//                            f_getGeoBroadcastArea(
//                                c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
//                    )));
//                    
//                    // Encode it
//                    v_gnPayload := bit2oct(
//                        encvalue(
//                            v_gnNonSecuredPacket
//                        )
//                    );
//                    f_buildGnSecuredOtherMessage(
//                        v_securedMessage,
//                            m_payload_unsecured(
//                                v_gnPayload
//                        ),
//                        e_certificate_digest_with_sha256,
//                        valueof(m_threeDLocation(
//                            v_longPosVectorNodeB.latitude,
//                            v_longPosVectorNodeB.longitude,
//                            '0000'O
//                        ))
//                    );
//                    v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_09_03_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_09_03_BO 
//            
//            /**
//             * @desc    Check that IUT discards the Secured GN Message containing payload element of type 'encrypted'
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing payload_field
//             *              containing type
//             *                  indicating 'encrypted'
//             *              and containing data
//             *                  indicating length > 0
//             *  } 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_09_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_09_04_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_09_04_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_09_04_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_09_04_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_09_04_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GnNonSecuredPacket v_gnNonSecuredPacket;
//                    var octetstring v_gnPayload;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    var template (value) Ieee1609Dot2Data v_securedMessage;
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_gnNonSecuredPacket := valueof(
//                        m_geoNwBroadcastPacket(
//                            v_longPosVectorNodeB,
//                            vc_localSeqNumber,
//                            f_getGeoBroadcastArea(
//                                c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
//                    )));
//                    
//                    // Encode it
//                    v_gnPayload := bit2oct(
//                        encvalue(
//                            v_gnNonSecuredPacket
//                        )
//                    );
//                    f_buildGnSecuredOtherMessage(
//                        v_securedMessage,
//                            m_payload_encrypted(
//                                v_gnPayload
//                        ),
//                        e_certificate_digest_with_sha256,
//                        valueof(m_threeDLocation(
//                            v_longPosVectorNodeB.latitude,
//                            v_longPosVectorNodeB.longitude,
//                            '0000'O
//                        ))
//                    );
//                    v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_09_04_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_09_04_BO 
//            
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured GN Message containing payload of type signed_external
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing payload_field
//             *              containing type
//             *                  indicating 'signed_external'
//             *              and containing data
//             *                  indicating length > 0
//             *  } 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_09_05_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_09_05_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_09_05_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_09_05_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_09_05_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_09_05_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GnNonSecuredPacket v_gnNonSecuredPacket;
//                    var octetstring v_gnPayload;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    var template (value) Ieee1609Dot2Data v_securedMessage;
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_gnNonSecuredPacket := valueof(
//                        m_geoNwBroadcastPacket(
//                            v_longPosVectorNodeB,
//                            vc_localSeqNumber,
//                            f_getGeoBroadcastArea(
//                                c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
//                    )));
//                    
//                    // Encode it
//                    v_gnPayload := bit2oct(
//                        encvalue(
//                            v_gnNonSecuredPacket
//                        )
//                    );
//                    f_buildGnSecuredOtherMessage(
//                        v_securedMessage,
//                            m_payload_signed_external(
//                                v_gnPayload
//                        ),
//                        e_certificate_digest_with_sha256,
//                        valueof(m_threeDLocation(
//                            v_longPosVectorNodeB.latitude,
//                            v_longPosVectorNodeB.longitude,
//                            '0000'O
//                        ))
//                    );
//                    v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_09_05_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_09_05_BO 
//            
//            /**
//             * @desc    Check that IUT accepts a well-formed Secured GN Message containing payload of type signed_and_encrypted
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_GN_GBC_SRC
//             * 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_A_AT
//             * } 
//             * ensure that { 
//             *  when { 
//             *      the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A) 
//             *          containing payload_field
//             *              containing type
//             *                  indicating 'signed_and_encrypted'
//             *              and containing data
//             *                  indicating length > 0
//             *  } 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_09_06_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_09_06_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_09_06_BO());
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_09_06_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_09_06_BO {
//                
//                    /**
//                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                     */
//                function f_TC_SEC_ITSS_RCV_GENMSG_09_06_BO() runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GnNonSecuredPacket v_gnNonSecuredPacket;
//                    var octetstring v_gnPayload;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    var template (value) Ieee1609Dot2Data v_securedMessage;
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    
//                    // Test component configuration
//                    f_cf01Up();
//                    
//                    // Test adapter configuration
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_gnNonSecuredPacket := valueof(
//                        m_geoNwBroadcastPacket(
//                            v_longPosVectorNodeB,
//                            vc_localSeqNumber,
//                            f_getGeoBroadcastArea(
//                                c_area1                 // Select area1 (see ETSI TS 102 871-2 Clause 4.2 Configuration 1)
//                    )));
//                    
//                    // Encode it
//                    v_gnPayload := bit2oct(
//                        encvalue(
//                            v_gnNonSecuredPacket
//                        )
//                    );
//                    f_buildGnSecuredOtherMessage(
//                        v_securedMessage,
//                            m_payload_signed_and_encrypted(
//                                v_gnPayload
//                        ),
//                        e_certificate_digest_with_sha256,
//                        valueof(m_threeDLocation(
//                            v_longPosVectorNodeB.latitude,
//                            v_longPosVectorNodeB.longitude,
//                            '0000'O
//                        ))
//                    );
//                    v_securedGnPdu := valueof(m_geoNwSecPdu(v_gnNonSecuredPacket, v_securedMessage));
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of testcase f_TC_SEC_ITSS_RCV_GENMSG_09_06_BO
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_09_06_BO 
//            
//            /**
//             * @desc    Check that IUT discards the Secured GN Message if the message does not contain the trailer field of type 'signature' 
//             * <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 Ieee1609Dot2Data
//             *         containing trailer_fields
//             *             not containing trailer_fields['signature']
//             *   } 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_10_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_10_01_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_10_0x_BO_nodeB(0));
//                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_10_01_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured GN Message containing more than one instance of TrailerField of type 'signature'
//             * <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 Ieee1609Dot2Data
//             *         containing trailer_fields[0]
//             *             containing type
//             *                 indicating 'signature'
//             *             and containing trailer_fields[1]
//             *                 containing type
//             *                     indicating 'signature'
//             *   } 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_10_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_10_02_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_10_0x_BO_nodeB(2));
//                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_10_02_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_10_0x_BO {
//                
//                /**
//                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                 */
//                function f_TC_SEC_ITSS_RCV_GENMSG_10_0x_BO_nodeB(
//                                                                 in integer p_trailerStatus
//                ) runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    
//                    // Preamble
//                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_sendSecuredBeacon_Bo(cc_taCert_A, -, p_trailerStatus);
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of function f_TC_SEC_ITSS_RCV_GENMSG_10_0x_BO_nodeB
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_10_0x_BV
//            
//            /**
//             * @desc    Check that the IUT discards Secured GN Message containing signature that is not verified using the verification key from the certificate contained in the message's signer info
//             * <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 Ieee1609Dot2Data
//            *            the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A)
//            *                containing header_fields ['signer_info']
//            *                    containing certificate
//            *                        containing subject_attributes['verification key'] 
//            *                            containing key (KEY)
//            *                and containing trailer_fields[0]
//            *                    containing type
//            *                        indicating 'signature'
//            *                    and containing signature
//            *                        NOT verifiable using KEY
//             *   } 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_11_01_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.2 & 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_11_01_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_11_0x_BO_nodeB(1));
//                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_11_01_BO
//            
//            /**
//             * @desc    Check that IUT discards the Secured Message if the message contains trailer field of type 'signature' with reserved public key algorythms
//             * <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 Ieee1609Dot2Data
//            *            the IUT is receiving a Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A)
//            *                containing trailer_fields
//            *                    containing an instance of type TrailerField
//            *                        containing type
//            *                            indicating 'signature'
//            *                        and containing signature
//            *                            indicating X_RESERVED_PK_ALGORYTHM
//             *   } 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_11_02_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.2 & 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_11_02_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_11_0x_BO_nodeB(3));
//                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_11_02_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_11_0x_BO {
//                
//                /**
//                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                 */
//                function f_TC_SEC_ITSS_RCV_GENMSG_11_0x_BO_nodeB(
//                                                                 in integer p_trailerStatus
//                ) runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    
//                    // Preamble
//                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_sendSecuredBeacon_Bo(
//                        cc_taCert_A, 
//                        -, 
//                        p_trailerStatus, 
//                        -, 
//                        e_certificate
//                    );
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of function f_TC_SEC_ITSS_RCV_GENMSG_11_0x_BO_nodeB
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_11_0x_BV
//            
//            /**
//             * @desc    Check that IUT discards a Secured GN Message if the signer certificate of the message contains the subject type 'enrolment_credential'
//             * <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 Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A)
//             *          containing header_fields['signer_info']
//             *              containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  containing certificate (CERT_TS_EC_A)
//             *                      containing subject_info.subject_type
//             *                          indicating 'enrolment_credentials'
//             *   } 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_12_01_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 6.3 & 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_12_01_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO_nodeB(cc_taCert_EC));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_12_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured GN Message if the signer certificate of the message contains the subject type 'authorization_authority'
//             * <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 Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A)
//             *          containing header_fields['signer_info']
//             *              containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  containing certificate (CERT_TS_A_AA)
//             *                      containing subject_info.subject_type
//             *                          indicating 'enrolment_credentials'
//             *   } 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_12_02_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 6.3 & 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_12_02_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO_nodeB(cc_taCert_AA));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_12_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured GN Message if the signer certificate of the message contains the subject type 'enrolment_authority'
//             * <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 Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A)
//             *          containing header_fields['signer_info']
//             *              containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  containing certificate (CERT_TS_A_EA)
//             *                      containing subject_info.subject_type
//             *                          indicating 'enrolment_credentials'
//             *   } 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_12_03_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 6.3 & 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_12_03_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO_nodeB(cc_taCert_EA));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_12_03_BO
//            
//            /**
//             * @desc    Check that IUT discards a Secured GN Message if the signer certificate of the message contains the subject type 'root_ca'
//             * <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 Ieee1609Dot2Data (MSG_SEC_RCV_GENMSG_A)
//             *          containing header_fields['signer_info']
//             *              containing signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  containing certificate (CERT_TS_A_CA)
//             *                      containing subject_info.subject_type
//             *                          indicating 'enrolment_credentials'
//             *   } 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_12_04_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 6.3 & 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_12_04_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO_nodeB(cc_taCert_CA));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_12_04_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO {
//                
//                /**
//                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                 */
//                function f_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO_nodeB(
//                                                                 in charstring p_taCert
//                ) runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    var GeoNetworkingPdu v_securedGnPdu;
//                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB); // Use NodeB
//                    
//                    // Preamble
//                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
//                    
//                    // Test Body
//                    v_securedGnPdu := f_prepareSecuredBeacon(
//                        p_taCert, 
//                        {
//                            m_header_info_signer_info(
//                                m_issuerIdentifier_sha256AndDigest(
//                                    vc_atCertificate.signer_info.signerInfo.digest
//                            )), 
//                            m_header_info_generation_time(1000 * f_getCurrentTime()), // In us
//                            m_header_info_generation_location(
//                                valueof(m_threeDLocation(
//                                    PX_WGSLATITUDE,
//                                    PX_WGSLONGITUDE,
//                                    '0000'O
//                                ))
//                            ),
//                            m_header_info_its_aid_Other
//                        }, 
//                        e_certificate,
//                        true
//                    ); 
//                    f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of function f_TC_SEC_ITSS_RCV_GENMSG_12_0x_BO_nodeB
//                
//            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_12_0x_BV
//            
//            /**
//             * @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 Ieee1609Dot2Data (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
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_13_01_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1301_BO));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_13_01_BO
//            
//            /**
//             * @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 Ieee1609Dot2Data (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
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_13_02_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1302_BO));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_13_02_BO
//            
//            /**
//             * @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 Ieee1609Dot2Data (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
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_13_03_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1303_BO));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_13_03_BO
//            
//            /**
//             * @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 Ieee1609Dot2Data (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
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_13_04_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1304_BO));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_13_04_BO
//            
//            /**
//             * @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 Ieee1609Dot2Data (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
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_13_05_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1305_BO));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_13_05_BO
//            
//            /**
//             * @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 Ieee1609Dot2Data (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
//             * @reference    ETSI TS 103 097 [1] Clause 7.3
//             */
//            testcase TC_SEC_ITSS_RCV_GENMSG_13_06_BO() runs on ItsMtc system ItsSecSystem {
//                
//                // Local variables
//                var ItsGeoNetworking v_nodeB;
//                var ItsGeoNetworking v_nodeD;
//                
//                // Test control
//                if (not(PICS_GN_SECURITY) or not(PICS_GN_GBC_SRC)) {
//                    log("*** " & testcasename() & ": 'PICS_GN_SECURITY and PICS_GN_GBC_SRC' required for executing the TC ***");
//                    setverdict(inconc);
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf02Up();
//                
//                // Preamble
//                
//                // Start components
//                v_nodeB := f_getComponent(c_compNodeB);
//                v_nodeD := f_getComponent(c_compNodeD);
//                v_nodeB.start(f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(cc_taCertMsg1306_BO));
//                v_nodeD.start(f_TC_SEC_ITSS_RCV_GENMSG_xxx_BO_nodeD());
//                
//                // Synchronization
//                f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
//                
//                // Cleanup
//                f_cf02Down();
//                
//            } // End of testcase TC_SEC_ITSS_RCV_GENMSG_13_06_BO
//            
//            group g_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO {
//                
//                /**
//                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
//                 */
//                function f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB(
//                                                                 in charstring p_taCert
//                ) runs on ItsGeoNetworking {
//                    
//                    // Local variables
//                    f_cf01Up();
//                    
//                    // Preamble
//                    f_prNeighbour();
//                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
//                    
//                    // Test Body
//                    f_sendSecuredBeacon(p_taCert, omit, e_certificate);
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                    
//                    // Postamble
//                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
//                    
//                } // End of function f_TC_SEC_ITSS_RCV_GENMSG_13_0x_BO_nodeB
            } // End of group g_TC_SEC_ITSS_RCV_GENMSG_13_0x_BV
        } // End of group recvOtherProfile
         * @desc Receiving behaviour test cases for certificates profile
garciay's avatar
garciay committed
         * @see ETSI TS 103 096-2 V1.3.32 (2018-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 Ieee1609Dot2Data
//             *              containing header_fields['signer_info'].signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  and containing certificate (CERT_TS_01_01_BO_AT)
//             *                      containing  version
//             *                          indicating '3'
//             *      } 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
//             * @reference    ETSI TS 103 097 [1] Clauses 6.1 & 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_01_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test adapter configuration
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredCam(cc_taCert0101_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_01_01_BO
//            
//            /**
//             * @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 Ieee1609Dot2Data
//             *              containing header_fields['signer_info'].signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  and containing certificate (CERT_TS_01_02_BO_AT)
//             *                      containing  version
//             *                          indicating '1'
//             *      } 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
//             * @reference    ETSI TS 103 097 [1] Clauses 6.1 & 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_01_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test adapter configuration
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredCam(cc_taCert0102_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_01_02_BO
//            
//            /**
//             * @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 Ieee1609Dot2Data
//             *              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
//             * @reference    ETSI TS 103 097 [1] Clauses 6.1 & 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_01_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test adapter configuration
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredCam(cc_taCert0103_BO, -, e_certificate_chain);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_01_03_BO
//            
//            /**
//             * @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 Ieee1609Dot2Data
//             *              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
//             * @reference    ETSI TS 103 097 [1] Clauses 6.1 & 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_01_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test adapter configuration
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                if (PICS_DEBUG_ADDON) {
//                    f_sendCertificateAndWaitForCertificateChainRequest(cc_taCert_F, f_generateDefaultCam());
//                }
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredCam(cc_taCert0104_BO, -, e_certificate_chain);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_01_04_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data 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 Ieee1609Dot2Data
//             *              containing header_fields['signer_info'].signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing 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
//             * @reference    ETSI TS 103 097 [1] Clause 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_02_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test adapter configuration
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredCam(cc_taCert0201_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_02_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data 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 Ieee1609Dot2Data
//             *              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
//             * @reference    ETSI TS 103 097 [1] Clause 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_02_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
//                
//                // Local variables
//                var integer i;
//                var GeoNetworkingPdu v_securedGnPdu;
//                var GnRawPayload v_sentRawPayload;
//                
//                // Test adapter configuration
//                if (not(PICS_GN_SECURITY)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
//                    stop;
//                }
//                
//                // Test component configuration
//                f_cf01Up();
//                
//                // Test adapter configuration
//                
//                // Preamble
//                f_prNeighbour();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_securedGnPdu := f_sendSecuredCam(cc_taCert0202_BO, omit, e_certificate_chain);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_02_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data 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 Ieee1609Dot2Data
//             *              containing header_fields['signer_info'].signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing 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
//             * @reference    ETSI TS 103 097 [1] Clause 6.3
//             */
//            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 := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_02_03_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data 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 Ieee1609Dot2Data
//             *              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
//             * @reference    ETSI TS 103 097 [1] Clause 6.3
//             */
//            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 := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_02_04_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data if the issuer certificate of the authorization ticket certificate contains the subject type 'authorization_ticket'
//             * <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_03_01_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields ['signer_info'].signer
//             *                  containing certificate (CERT_TS_03_01_BO_AT)
//             *                      containing signer_info.digest
//             *                          referencing to CERT_TS_03_BO_CA
//             *                              containing subject_info.subject_type
//             *                                  indicating 'authorization_ticket'
//             *      } 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_03_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_03_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_taCert0301_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_03_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data if the issuer certificate of the authorization authority certificate contains the subject type 'authorization_ticket'
//             * <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_03_02_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields ['signer_info'].signer
//             *                  containing type
//             *                      indicating 'certificate_chain'
//             *                  and containing certificates[0] (CERT_TS_03_02_BO_AA)
//             *                      containing signer_info.digest
//             *                          referencing to CERT_TS_03_BO_CA
//             *                              containing subject_info.subject_type
//             *                                  indicating 'authorization_ticket'
//             *                  and containing certificates[1] (CERT_TS_03_02_BO_AT)
//             *                      containing signer_info.digest
//             *                      referencing to CERT_TS_03_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_03_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_03_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_taCert0302_BO, omit, e_certificate_chain);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_03_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data if the issuer certificate of the AA certificate contains the subject type 'authorization_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_04_01_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields ['signer_info'].signer
//             *                  containing type
//             *                      indicating 'certificate_chain'
//             *                  and containing certificates[0] (CERT_TS_04_01_BO_AA)
//             *                      containing signer_info.digest
//             *                          referencing to CERT_TS_A_AA
//             *                  and containing certificates[1] (CERT_TS_04_01_BO_AT)
//             *                      containing signer_info.digest
//             *                      referencing to CERT_TS_04_01_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_04_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 6.3
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_04_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_taCert0401_BO, omit, e_certificate_chain);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_04_01_BO
//            
//            /**
//             * @desc    Check that IUT discards the message when signing AT certificate has an invalid signature
//             * <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_A_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields ['signer_info'].signer
//             *                  containing type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                  and containing certificates (CERT_TS_A_AT)
//             *                      containing signer_info.digest
//             *                          referencing to CERT_TS_A_AA
//             *                      and containing signature
//             *                          NOT verifiable with CERT_TS_A_AA.subject_attributes['verification_key'].key
//             *      } 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_05_01_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 6.1 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_05_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_prepareSecuredCam_Bo(
//                    cc_taCert_A, 
//                    -, 
//                    1, 
//                    -, 
//                    e_certificate,
//                    true,
//                    true
//                );
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_05_01_BO
//            
//            /**
//             * @desc    Check that IUT discards the message when the issuing AA certificate of the signing AT certificate has an invalid signature
//             * <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_A_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields ['signer_info'].signer
//             *                  containing type
//             *                      indicating 'certificate_chain'
//             *                  and containing certificates[0] (CERT_TS_A_AT)
//             *                      containing signer_info.digest
//             *                          referencing to CERT_ROOT
//             *                      and containing signature
//             *                          NOT verifiable with CERT_ROOT.subject_attributes['verification_key'].key
//             *                  and containing certificates[1] (CERT_TS_A_AT)
//             *                      containing signer_info.digest
//             *                          referencing to a CERT_TS_A_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_05_02_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 6.1 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_05_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_prepareSecuredCam_Bo(
//                    cc_taCert_A, 
//                    -, 
//                    1, 
//                    -, 
//                    e_certificate_chain,
//                    true,
//                    false,
//                    true
//                );
//                f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(valueof(v_securedGnPdu.gnPacket.packet.payload));
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_05_02_BO
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the same circular region validity restriction as its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION
//             * 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_06_01_BV_AT
//             *      and the IUT current location is inside the CURCULAR_REGION_AA
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_06_01_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'circle'
//             *                              containing circular_region
//             *                                  indicating CURCULAR_REGION_AA
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_B_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'circle'
//             *                                      and containing circular_region
//             *                                          indicating CURCULAR_REGION_AA
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_06_01_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_06_01_BV() 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) or not(PICS_USE_RECTANGULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION' 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_taCert0601_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_06_01_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the circular region validity restriction which is fully inside in the circular region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION
//             * 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_06_02_BV_AT
//             *      and the IUT current location is inside the CURCULAR_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_06_02_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'circle'
//             *                              containing circular_region
//             *                                  indicating CURCULAR_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_B_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'circle'
//             *                                      and containing circular_region
//             *                                          indicating CURCULAR_REGION_AA
//             *                                              fully covering CURCULAR_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_06_02_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_06_02_BV() 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) or not(PICS_USE_RECTANGULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION' 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_taCert0602_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_06_02_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the circular region validity restriction which is fully inside in the rectangular region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION
//             * 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_06_03_BV_AT
//             *      and the IUT current location is inside the CURCULAR_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_06_03_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'circle'
//             *                              containing circular_region
//             *                                  indicating CURCULAR_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_C_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'rectangle'
//             *                                      and containing rectangular_region[0]
//             *                                          indicating RECT_REGION_AA
//             *                                              fully covering CURCULAR_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_06_03_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_06_03_BV() 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) or not(PICS_USE_RECTANGULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION' 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_taCert0603_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_06_03_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the circular region validity restriction which is fully inside in the polygonal region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION
//             * 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_06_04_BV_AT
//             *      and the IUT current location is inside the CURCULAR_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_06_04_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'circle'
//             *                              containing circular_region
//             *                                  indicating CURCULAR_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_D_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'polygon'
//             *                                      and containing polygonal_region
//             *                                          indicating POLYGON_REGION_AA
//             *                                              fully covering CURCULAR_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_06_04_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_06_04_BV() 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) or not(PICS_USE_RECTANGULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION' 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_taCert0604_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_06_04_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the circular region validity restriction which is fully inside in the identified region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION
//             * 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_06_05_BV_AT
//             *      and the IUT current location is inside the CURCULAR_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_06_05_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'circle'
//             *                              containing circular_region
//             *                                  indicating CURCULAR_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_E_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'id'
//             *                                      and containing id_region
//             *                                          containing region_dictionary
//             *                                              indicating 'iso_3166_1'
//             *                                          and containing local_region
//             *                                              indicating 0
//             *                                          and containing region_identifier
//             *                                              indicating ID_REGION_AT
//             *                                                  fully covering CURCULAR_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_06_05_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_06_05_BV() 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) or not(PICS_USE_RECTANGULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION' 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_taCert0605_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_06_05_BV
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing certificate of this message does not contain the region validity restriction but its issuing certificate contains the circular region validity restriction
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION
//             * 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_06_06_BO_AT
//             *      and the IUT current location is inside the CURCULAR_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_06_06_BO_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'circle'
//             *                              containing circular_region
//             *                                  indicating CURCULAR_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_B_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'circle'
//             *                                      and containing circular_region
//             *                                          indicating CURCULAR_REGION_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_CERT_06_06_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_06_06_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) or not(PICS_USE_RECTANGULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION' 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_taCert0606_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_06_06_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing certificate of this message contains circular region validity restriction which is outside of the circular region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION
//             * 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_06_07_BO_AT
//             *      and the IUT current location is inside the CURCULAR_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_06_07_BO_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'circle'
//             *                              containing circular_region
//             *                                  indicating CURCULAR_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_06_07_BO_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'circle'
//             *                                      and containing circular_region
//             *                                          indicating CURCULAR_REGION_AA_OUTSIDE
//             *                                              not including CURCULAR_REGION_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_CERT_06_07_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_06_07_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) or not(PICS_USE_RECTANGULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION' 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_taCert0607_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_06_07_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing certificate of this message contains circular region validity restriction which is not fully covered by the the circular region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION
//             * 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_06_08_BO_AT
//             *      and the IUT current location is inside the CURCULAR_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_06_08_BO_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'circle'
//             *                              containing circular_region
//             *                                  indicating CURCULAR_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_06_08_BO_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'circle'
//             *                                      and containing circular_region
//             *                                          indicating CURCULAR_REGION_AA_INTERSECT
//             *                                              including partially CURCULAR_REGION_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_CERT_06_08_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_06_08_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) or not(PICS_USE_RECTANGULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_RECTANGULAR_REGION' 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_taCert0608_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_06_08_BO
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the same rectangular region validity restriction as its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION
//             * 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_07_01_BV_AT
//             *      and the IUT current location is inside the RECT_REGION_AA
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_07_01_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'rectangle'
//             *                              containing rectangular_region[0]
//             *                                  indicating RECT_REGION_AA
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_C_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'rectangle'
//             *                                      and containing rectangular_region[0]
//             *                                          indicating RECT_REGION_AA
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_07_01_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_07_01_BV() 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) or not(PICS_USE_CIRCULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION' 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_taCert0701_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_07_01_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the rectangular region validity restriction which is fully inside in the circular region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION
//             * 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_07_02_BV_AT
//             *      and the IUT current location is inside the RECT_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_07_02_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'rectangle'
//             *                              containing rectangular_region[0]
//             *                                  indicating RECT_REGION_AA
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_B_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'circle'
//             *                                      and containing circular_region
//             *                                          indicating CURCULAR_REGION_AA
//                                                            fully covering the RECT_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_07_02_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_07_02_BV() 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) or not(PICS_USE_CIRCULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION' 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_taCert0702_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_07_02_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the validity restriction with rectangular region which is fully inside in the rectangular region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION
//             * 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_07_03_BV_AT
//             *      and the IUT current location is inside the RECT_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_07_03_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'rectangle'
//             *                              containing rectangular_region[0]
//             *                                  indicating RECT_REGION_AA
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_B_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'rectangle'
//             *                                      and containing rectangular_region
//             *                                          indicating RECT_REGION_AA
//                                                            fully covering RECT_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_07_03_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_07_03_BV() 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) or not(PICS_USE_CIRCULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION' 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_taCert0703_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_07_03_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the rectangular region validity restriction which is fully inside in the polygonal region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION
//             * 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_07_04_BV_AT
//             *      and the IUT current location is inside the RECT_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_07_04_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'rectangle'
//             *                              containing rectangular_region[0]
//             *                                  indicating RECT_REGION_AA
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_D_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'polygon'
//             *                                      and containing polygonal_region
//             *                                          indicating POLYGON_REGION_AA
//                                                            fully covering RECT_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_07_04_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_07_04_BV() 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) or not(PICS_USE_CIRCULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION' 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_taCert0704_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_07_04_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the rectangular region validity restriction which is fully inside in the identified region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION
//             * 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_07_05_BV_AT
//             *      and the IUT current location is inside the RECT_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_07_05_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'rectangle'
//             *                              containing rectangular_region[0]
//             *                                  indicating RECT_REGION_AA
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_E_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'id'
//             *                                      and containing id_region
//             *                                          containing region_dictionary
//             *                                              indicating 'iso_3166_1'
//             *                                          and containing local_region
//             *                                              indicating 0
//             *                                          and containing region_identifier
//             *                                              indicating ID_REGION_AT
//                                                                fully covering RECT_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_07_05_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_07_05_BV() 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) or not(PICS_USE_CIRCULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION' 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_taCert0705_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_07_05_BV
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing certificate of this message does not contain the region validity restriction but its issuing certificate contains the rectangular region validity restriction
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION
//             * 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_07_06_BO_AT
//             *      and the IUT current location is inside the RECT_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_07_06_BO_AT)
//             *                          not containing validity_restrictions['region']
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_C_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'rectangle'
//             *      } 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_07_06_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_07_06_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) or not(PICS_USE_CIRCULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION' 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_taCert0706_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_07_06_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing certificate of this message contains rectangular region validity restriction which is outside of the rectangular region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION
//             * 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_07_07_BO_AT
//             *      and the IUT current location is inside the RECT_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_07_07_BO_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'rectangle'
//             *                              containing rectangular_region[0]
//             *                                  indicating RECT_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_07_07_BO_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'rectangle'
//             *                                      and containing rectangular_region[0]
//             *                                          indicating RECT_REGION_AA_OUTSIDE
//             *                                              not including RECT_REGION_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_CERT_07_07_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_07_07_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) or not(PICS_USE_CIRCULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION' 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_taCert0707_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_07_07_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing certificate of this message contains rectangular region validity restriction which is not fully covered by the the rectangular region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION
//             * 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_07_08_BO_AT
//             *      and the IUT current location is inside the RECT_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_07_08_BO_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'rectangle'
//             *                              containing rectangular_region[0]
//             *                                  indicating RECT_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_07_08_BO_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'rectangle'
//             *                                      and containing rectangular_region[0]
//             *                                          indicating RECT_REGION_AA_INTERSECT
//             *                                              not partialy RECT_REGION_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_CERT_07_08_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_07_08_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) or not(PICS_USE_CIRCULAR_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_CIRCULAR_REGION' 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_taCert0708_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_07_08_BO
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the same polygonal region validity restriction as its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION
//             * 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_08_01_BV_AT
//             *      and the IUT current location is inside the POLYGON_REGION_AA
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_08_01_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'polygon'
//             *                              containing polygonal_region
//             *                                  indicating POLYGON_REGION_AA
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_D_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'polygon'
//             *                                      and containing polygonal_region
//             *                                          indicating POLYGON_REGION_AA
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_08_01_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_08_01_BV() 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) or not(PICS_USE_POLYGONAL_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION' 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_taCert0801_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_08_01_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the polygonal region validity restriction which is fully inside in the circular region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION
//             * 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_08_02_BV_AT
//             *      and the IUT current location is inside the POLYGON_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_08_02_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'polygon'
//             *                              containing polygonal_region
//             *                                  indicating POLYGON_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_B_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'circle'
//             *                                      and containing circular_region
//             *                                          indicating CURCULAR_REGION_AA
//             *                                              fully including POLYGON_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_08_02_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_08_02_BV() 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) or not(PICS_USE_POLYGONAL_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION' 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_taCert0802_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_08_02_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the polygonal region validity restriction which is fully inside in the rectangular region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION
//             * 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_08_03_BV_AT
//             *      and the IUT current location is inside the POLYGON_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_08_03_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'polygon'
//             *                              containing polygonal_region
//             *                                  indicating POLYGON_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_C_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'rectangle'
//             *                                      and containing rectangular_region[0]
//             *                                          indicating RECT_REGION_AA
//             *                                              fully including POLYGON_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_08_03_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_08_03_BV() 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) or not(PICS_USE_POLYGONAL_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION' 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_taCert0803_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_08_03_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the polygonal region validity restriction which is fully inside in the polygonal region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION
//             * 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_08_04_BV_AT
//             *      and the IUT current location is inside the POLYGON_REGION_AA
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_08_04_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'polygon'
//             *                              containing polygonal_region
//             *                                  indicating POLYGON_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_D_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'polygon'
//             *                                      and containing polygonal_region[0]
//             *                                          indicating POLYGON_REGION_AA
//             *                                              fully including POLYGON_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_08_04_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_08_04_BV() 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) or not(PICS_USE_POLYGONAL_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION' 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_taCert0804_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_08_04_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the polygonal region validity restriction which is fully inside in the identified region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION
//             * 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_08_05_BV_AT
//             *      and the IUT current location is inside the POLYGON_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_08_05_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'polygon'
//             *                              containing polygonal_region
//             *                                  indicating POLYGON_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_D_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'id'
//             *                                      and containing id_region
//             *                                          containing region_dictionary
//             *                                              indicating 'iso_3166_1'
//             *                                          and containing local_region
//             *                                              indicating 0
//             *                                          and containing region_identifier
//             *                                              indicating ID_REGION_AT
//             *                                                  fully including POLYGON_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_08_05_BV
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_08_05_BV() 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) or not(PICS_USE_POLYGONAL_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION' 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_taCert0805_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_08_05_BV
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing certificate of this message does not contain the region validity restriction but its issuing certificate contains the polygonal region validity restriction
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION
//             * 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_08_06_BO_AT
//             *      and the IUT current location is inside the POLYGON_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_08_06_BO_AT)
//             *                          not containing validity_restrictions['region']
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_C_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'rectangle'
//             *      } 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_08_06_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_08_06_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) or not(PICS_USE_POLYGONAL_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION' 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_taCert0806_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_08_06_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing certificate of this message does not contain the region validity restriction but its issuing certificate contains the polygonal region validity restriction
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION
//             * 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_08_07_BO_AT
//             *      and the IUT current location is inside the POLYGON_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_08_07_BO_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'polygon'
//             *                              containing polygonal_region (POLYGON_REGION_08_04_BO)
//             *                                  indicating length = 2
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_D_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'polygon'
//             *                                      and containing polygonal_region
//             *                                          indicating POLYGON_REGION_AA
//             *                                              fully covering all points of POLYGON_REGION_08_04_BO
//             *      } 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_08_07_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_08_07_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) or not(PICS_USE_POLYGONAL_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION' 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_taCert0807_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_08_07_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing certificate of this message contains polygonal region validity restriction which is outside of the polygonal region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION
//             * 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_08_08_BO_AT
//             *      and the IUT current location is inside the POLYGON_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_08_08_BO_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'polygon'
//             *                              containing polygonal_region
//             *                                  indicating POLYGON_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_D_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'polygon'
//             *                                      and containing polygonal_region
//             *                                          indicating POLYGON_REGION_AA_OUTSIDE
//             *                                              not including POLYGON_REGION_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_CERT_08_08_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_08_08_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) or not(PICS_USE_POLYGONAL_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION' 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_taCert0808_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_08_08_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing certificate of this message contains polygonal region validity restriction which is not fully covered by the the polygonal region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION
//             * 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_08_09_BO_AT
//             *      and the IUT current location is inside the POLYGON_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_08_09_BO_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'polygon'
//             *                              containing polygonal_region
//             *                                  indicating POLYGON_REGION_AT
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_08_08_BO_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'polygon'
//             *                                      and containing polygonal_region
//             *                                          indicating POLYGON_REGION_AA_INTERSECT
//             *                                              including partialy POLYGON_REGION_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_CERT_08_09_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_08_09_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) or not(PICS_USE_POLYGONAL_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_POLYGONAL_REGION' 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_taCert0809_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_08_09_BO
//            
//            /**
//             * @desc    Check that the IUT accepts a message when its signing certificate contains the identified region validity restriction with the same identified region as the issuing certificate and without local area definition 
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION
//             * 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_09_01_BV_AT
//             *      and the IUT current location is inside the ID_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_09_01_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'id'
//             *                              and containing id_region
//             *                                  containing region_dictionary
//             *                                      indicating 'iso_3166_1'
//             *                                  and containing region_identifier
//             *                                      indicating ID_REGION_AT
//             *                                  and containing local_region
//             *                                      indicating 0
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_E_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'id'
//             *                                      and containing id_region
//             *                                          containing region_dictionary
//             *                                              indicating 'iso_3166_1'
//             *                                          and containing region_identifier
//             *                                              indicating ID_REGION_AT
//             *                                          and containing local_region
//             *                                              indicating 0
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_09_01_BV
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.26 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_09_01_BV() 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) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION' 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_taCert0901_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_09_01_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when its signing certificate contains the identified region validity restriction with the same identified region as the issuing certificate and with local area definition 
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION
//             * 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_09_02_BV_AT
//             *      and the IUT current location is inside the ID_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_09_02_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'id'
//             *                              and containing id_region
//             *                                  containing region_dictionary
//             *                                      indicating 'iso_3166_1'
//             *                                  and containing region_identifier
//             *                                      indicating ID_REGION_AT
//             *                                  and containing local_region
//             *                                      indicating ID_LOCAL_REGION_1
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_E_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'id'
//             *                                      and containing id_region
//             *                                          containing region_dictionary
//             *                                              indicating 'iso_3166_1'
//             *                                          and containing region_identifier
//             *                                              indicating ID_REGION_AT
//             *                                          and containing local_region
//             *                                              indicating 0
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_09_02_BV
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.26 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_09_02_BV() 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) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION' 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_taCert0902_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_09_02_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when its signing certificate contains the identified region validity restriction fully containing in the circular validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION
//             * 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_09_03_BV_AT
//             *      and the IUT current location is inside the ID_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_09_03_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'id'
//             *                              and containing id_region
//             *                                  containing region_dictionary
//             *                                      indicating 'iso_3166_1'
//             *                                  and containing region_identifier
//             *                                      indicating ID_REGION_AT
//             *                                  and containing local_region
//             *                                      indicating 0
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_09_03_BV_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'circle'
//             *                                      and containing circular_region
//             *                                          fully covering ID_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_09_03_BV
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.26 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_09_03_BV() 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) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION' 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_taCert0903_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_09_03_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the polygonal region validity restriction which is fully inside in the rectangular region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION
//             * 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_09_04_BV_AT
//             *      and the IUT current location is inside the ID_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_09_04_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'id'
//             *                              and containing id_region
//             *                                  containing region_dictionary
//             *                                      indicating 'iso_3166_1'
//             *                                  and containing region_identifier
//             *                                      indicating ID_REGION_AT
//             *                                  and containing local_region
//             *                                      indicating 0
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_E_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'rectangle'
//             *                                      and containing rectangular_region[0]
//             *                                          fully covering ID_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_09_04_BV
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.26 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_09_04_BV() 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) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION' 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_taCert0904_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_09_04_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of this message contains the polygonal region validity restriction which is fully inside in the polygonal region validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION
//             * 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_09_05_BV_AT
//             *      and the IUT current location is inside the ID_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_09_05_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'id'
//             *                              and containing id_region
//             *                                  containing region_dictionary
//             *                                      indicating 'iso_3166_1'
//             *                                  and containing region_identifier
//             *                                      indicating ID_REGION_AT
//             *                                  and containing local_region
//             *                                      indicating 0
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_E_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'polygon'
//             *                                      and containing polygonal_region
//             *                                          fully covering ID_REGION_AT
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_09_05_BV
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.26 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_09_05_BV() 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) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION' 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_taCert0905_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_09_05_BV
//            
//            /**
//             * @desc    Check that the IUT accepts a message when the signing certificate of the message contains the identified region validity restriction with the identified region which is fully covered by the identified region of the validity restriction of its issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION
//             * 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_09_06_BV_AT
//             *      and the IUT current location is inside the ID_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_09_06_BV_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'id'
//             *                              and containing id_region
//             *                                  containing region_dictionary
//             *                                      indicating 'iso_3166_1'
//             *                                  and containing region_identifier
//             *                                      indicating ID_REGION_AT
//             *                                  and containing local_region
//             *                                      indicating 0
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_E_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'id'
//             *                                      and containing id_region
//             *                                          containing region_dictionary
//             *                                              indicating 'un_stats'
//             *                                          and containing region_identifier
//             *                                              indicating ID_REGION_AA_UNSTATS
//             *                                                  which includes ID_REGION_AT
//             *                                          and containing local_region
//             *                                              indicating 0
//             *      } then {
//             *          the IUT accepts the message
//             *      }
//             *  }
//             * </pre>
//             *
garciay's avatar
garciay committed
//             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CERT_09_06_BV
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.26 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_09_06_BV() 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) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION' 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_taCert0906_BV, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                else {
//                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_09_06_BV
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing certificate of this message does not contain the region validity restriction but its issuing certificate contains the identified region validity restriction
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION
//             * 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_09_07_BO_AT
//             *      and the IUT current location is inside the ID_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_09_07_BO_AT)
//             *                          not containing validity_restrictions['region']
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_E_AA
//             *                                  containing validity_restrictions['region']
//             *                                      containing region_type
//             *                                          indicating 'id'
//             *      } 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_09_07_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.26 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_09_07_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) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION' 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_taCert0907_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_09_07_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing certificate and its issuing certificate are both containing the identified region validity restrictions with the same region id but different local regions
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION
//             * 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_09_08_BO_AT
//             *      and the IUT current location is inside the ID_REGION_AA, local region 1
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_09_08_BO_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'id'
//             *                              and containing id_region
//             *                                  containing region_dictionary
//             *                                      indicating 'iso_3166_1'
//             *                                  and containing region_identifier
//             *                                      indicating ID_REGION_AT
//             *                                  and containing local_region
//             *                                      indicating ID_LOCAL_REGION_1
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_09_08_BO_AA
//             *                                  containing validity_restrictions['region']
//             *                                          indicating 'id'
//             *                                  and containing id_region
//             *                                      containing region_dictionary
//             *                                          indicating 'iso_3166_1'
//             *                                      and containing region_identifier
//             *                                          indicating ID_REGION_AA
//             *                                      and containing local_region
//             *                                          indicating ID_LOCAL_REGION_2
//             *                                              not equal to ID_LOCAL_REGION_1
//             *      } 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_09_08_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.26 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_09_08_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) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION' 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_taCert0908_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_09_08_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the identified region of the validity restriction of its signing certificate is different and not fully covered by the one in the issuing certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION
//             * 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_09_09_BO_AT
//             *      and the IUT current location is inside the ID_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_09_09_BO_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'id'
//             *                              and containing id_region
//             *                                  containing region_dictionary
//             *                                      indicating 'iso_3166_1'
//             *                                  and containing region_identifier
//             *                                      indicating ID_REGION_AT
//             *                                  and containing local_region
//             *                                      indicating 0
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_09_09_BO_AA
//             *                                  containing validity_restrictions['region']
//             *                                          indicating 'id'
//             *                                  and containing id_region
//             *                                      containing region_dictionary
//             *                                          indicating 'iso_3166_1'
//             *                                      and containing region_identifier
//             *                                          indicating ID_REGION_AA_OTHER
//             *                                              other than ID_REGION_AT
//             *                                      and containing local_region
//             *                                          indicating 0
//             *      } 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_09_09_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.26 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_09_09_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) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION' 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_taCert0909_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_09_09_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the identified region validity restriction of its signing certificate contains unknown area code
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION
//             * 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_09_10_BO_AT
//             *      and the IUT current location is inside the ID_REGION_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_09_10_BO_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'id'
//             *                              and containing id_region
//             *                                  containing region_dictionary
//             *                                      indicating 'iso_3166_1'
//             *                                  and containing region_identifier
//             *                                      indicating ID_REGION_UNKNOWN
//             *                                  and containing local_region
//             *                                      indicating 0
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_A_AA
//             *                                  not containing validity_restrictions['region']
//             *      } 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_09_10_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.26 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_09_10_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) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION' 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_taCert0910_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_09_10_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the validity restriction of its signing certificate contains the identified region of type iso-3166-1 but region code is from the UN-Stats dictionary 
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION
//             * 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_09_11_BO_AT
//             *      and the IUT current location is inside the ID_REGION_AA_UNSTATS
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_09_11_BO_AT)
//             *                          containing validity_restrictions['region']
//             *                              containing region_type
//             *                                  indicating 'id'
//             *                              and containing id_region
//             *                                  containing region_dictionary
//             *                                      indicating 'iso_3166_1'
//             *                                  and containing region_identifier
//             *                                      indicating ID_REGION_AA_UNSTATS
//             *                                  and containing local_region
//             *                                      indicating 0
//             *                          and containing signer_info.digest
//             *                              referencing to a CERT_TS_A_AA
//             *                                  not containing validity_restrictions['region']
//             *      } 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_09_11_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 4.2.26 and 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_09_11_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) or not(PICS_USE_IDENTIFIED_REGION)) {
//                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_USE_IDENTIFIED_REGION' 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_taCert0911_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_09_11_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when its signing certificate does not contain the time validity restriction
//             * <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_10_01_BO_AT
//             *      and the IUT current location is inside the CERT_TS_10_01_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_10_01_BO_AT)
//             *                          containing validity_restrictions['time_start_and_end']
//             *                          and not containing validity_restrictions['time_end']
//             *                          and not containing validity_restrictions['time_start_and_duration']
//             *      } 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_10_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_10_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_taCert1001_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_10_01_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the issuing certificate of the message signing certificate does not contain the time validity restriction
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * Config Id: CF01
//             * Initial conditions:
//             *  with {
//             *      the IUT being in the 'authorized' state
//             *      and the IUT current location is inside the CERT_TS_10_02_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_10_02_BO_AT)
//             *                          containing signer_info.digest
//             *                              referencing to CERT_TS_10_02_BO_AA
//             *                                  containing validity_restrictions['time_start_and_end']
//             *                                  and not containing validity_restrictions['time_end']
//             *                                  and not containing validity_restrictions['time_start_and_duration']
//             *      } 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_10_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_10_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_taCert1002_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_10_02_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when its signing certificate contains 'time_end' validity restriction
//             * <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 less then time_end validity restricyion of CERT_TS_10_03_BO_AT
//             *      and the IUT current location is inside the CERT_TS_10_02_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_10_03_BO_AT)
//             *                          containing validity_restrictions['time_end']
//             *      } 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_10_03_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 7.4.2 & 7.4.4
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_10_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_taCert1003_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_10_03_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when its signing certificate contains 'time_start_and_duration' validity restriction
//             * <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_10_04_BO_AT
//             *      and the IUT current location is inside the CERT_TS_10_04_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_10_04_BO_AT)
//             *                          containing validity_restrictions['time_start_and_duration']
//             *      } 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_10_04_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 7.4.2 & 7.4.4
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_10_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_taCert1004_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_10_04_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the issuing certificate of the message signing certificate contains 'time_end' validity restriction
//             * <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 less then time_end validity restricyion of CERT_TS_10_05_BO_AT
//             *      and the IUT current location is inside the CERT_TS_10_05_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_10_05_BO_AT)
//             *                          containing signer_info.digest
//             *                              referencing to CERT_TS_10_05_BO_AA
//             *                                  containing validity_restrictions['time_end']
//             *      } 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_10_05_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 7.4.2 & 7.4.4
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_10_05_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_taCert1005_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_10_05_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when its signing certificate contains 'time_start_and_duration' validity restriction
//             * <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 less then time_end validity restricyion of CERT_TS_10_06_BO_AT
//             *      and the IUT current location is inside the CERT_TS_10_06_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields['signer_info']
//             *                  and containing signer 
//             *                      containing type
garciay's avatar
garciay committed
//             *                          containing certificate
//             *                      and containing certificate (CERT_TS_10_06_BO_AT)
//             *                          containing signer_info.digest
//             *                              referencing to CERT_TS_10_06_BO_AA
//             *                                  containing validity_restrictions['time_start_and_duration']
//             *      } 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_10_06_BO
//             * @reference    ETSI TS 103 097 [1] Clauses 7.4.2 & 7.4.4
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_10_06_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_taCert1006_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_10_06_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the validity period of the signing certificate ends after the validity period of its issuing certificate
//             * <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 greater than START_VALIDITY_AA and less than END_VALIDITY_AA
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields ['signer_info'].signer.certificate (CERT_TS_11_01_BO_AT)
//             *                  containing signer_info.digest
//             *                      referencing to CERT_TS_A_AA
//             *                          containing validity_restrictions['time_start_and_end']
//             *                              containing start_validity
//             *                                  indicating START_VALIDITY_AA
//             *                              and containing end_validity
//             *                                  indicating END_VALIDITY_AA
//             *              and containing validity_restrictions['time_start_and_end'] 
//             *                  containing start_validity
//             *                      indicating START_VALIDITY_AA
//             *                  and containing end_validity
//             *                      indicating END_VALIDITY_AA + 1d
//             *      } 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_11_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_11_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_taCert1101_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_11_01_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the validity period of its signing certificate starts before the validity period of the issuing certificate 
//             * <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 greater than START_VALIDITY_AA and less than END_VALIDITY_AA
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields ['signer_info'].signer.certificate (CERT_TS_11_02_BO_AT)
//             *                  containing signer_info.digest
//             *                      referencing to CERT_TS_A_AA
//             *                          containing validity_restrictions['time_start_and_end']
//             *                              containing start_validity
//             *                                  indicating START_VALIDITY_AA
//             *                              and containing end_validity
//             *                                  indicating END_VALIDITY_AA
//             *              and containing validity_restrictions['time_start_and_end'] 
//             *                  containing start_validity
//             *                      indicating START_VALIDITY_AA - 1d
//             *                  and containing end_validity
//             *                      indicating END_VALIDITY_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_11_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_11_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_taCert1102_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_11_02_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the issuing certificate of signing certificate is expired but the signing certificate is not expired yet.
//             * <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 greater than START_VALIDITY_AA and less than END_VALIDITY_AA
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields ['signer_info'].signer.certificate (CERT_TS_11_03_BO_AT)
//             *                  containing signer_info.digest
//             *                      referencing to CERT_TS_A_AA
//             *                          containing validity_restrictions['time_start_and_end']
//             *                              containing start_validity
//             *                                  indicating START_VALIDITY_AA - 365d
//             *                              and containing end_validity
//             *                                  indicating END_VALIDITY_AA - 1d
//             *              and containing validity_restrictions['time_start_and_end'] 
//             *                  containing start_validity
//             *                      indicating START_VALIDITY_AA - 365d
//             *                  and containing end_validity
//             *                      indicating END_VALIDITY_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_11_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_11_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_taCert1103_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_11_03_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the validity period of the signing certificate is after the validity period of its issuing certificate
//             * <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 greater than START_VALIDITY_AA and less than END_VALIDITY_AA
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data
//             *              containing header_fields ['signer_info'].signer.certificate (CERT_TS_11_04_BO_AT)
//             *                  containing signer_info.digest
//             *                      referencing to CERT_TS_A_AA
//             *                          containing validity_restrictions['time_start_and_end']
//             *                              containing start_validity
//             *                                  indicating START_VALIDITY_AA
//             *                              and containing end_validity
//             *                                  indicating END_VALIDITY_AA + 365d
//             *              and containing validity_restrictions['time_start_and_end'] 
//             *                  containing start_validity
//             *                      indicating START_VALIDITY_AA
//             *                  and containing end_validity
//             *                      indicating END_VALIDITY_AA + 365d
//             *      } 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_11_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_11_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_taCert1104_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_11_04_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when its signing certificate does not contain the SSP-AID subject attribute
//             * <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_12_01_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Ieee1609Dot2Data 
//             *              containing header_fields ['signer_info'].signer.certificate (CERT_TS_12_01_BO_AT)
//             *                  not containing subject_attributes['its_aid_ssp_list']
//             *      } 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_12_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.2
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_12_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_taCert1201_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_12_01_BO
//            
//            /**
//             * @desc    Check that the IUT discards a Secured CAM when its signing certificate does not contain a record with AID_CAM in the its_aid_ssp_list subject attribute 
//             * <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_12_02_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['its_aid']
//             *                      containing its_aid
//             *                          indicating 'AID_CAM'
//             *              and containing header_fields ['signer_info']
//             *                  containing signer
//             *                      containing certificate 
//             *                          indicating CERT_TS_12_02_BO_AT
//             *                              containing subject_attributes['its_aid_ssp_list']
//             *                                  not containing an item
//             *                                      containing its_aid
//             *                                          indicating 'AID_CAM'
//             *      } 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_12_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.2
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_12_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_taCert1202_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_12_02_BO
//            
//            /**
//             * @desc    Check that the IUT discards a Secured DENM when its signing certificate does not contain a record with AID_DENM in the its_aid_ssp_list subject attribute
//             * <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_12_03_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured DENM (MSG_SEC_RCV_DENM_A)
//             *              containing header_fields ['its_aid']
//             *                      containing its_aid
//             *                          indicating 'AID_DENM'
//             *              and containing header_fields ['signer_info']
//             *                  containing signer
//             *                      containing certificate 
//             *                          indicating CERT_TS_12_03_BO_AT
//             *                              containing subject_attributes['its_aid_ssp_list']
//             *                                  not containing an item
//             *                                      containing its_aid
//             *                                          indicating 'AID_DENM'
//             *      } 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_12_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.2
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_12_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_sendSecuredDenm(cc_taCert1203_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_12_03_BO
//            
//            /**
//             * @desc    Check that the IUT discards a Secured CAM when its signing certificate contains two records with AID_CAM in the its_aid_ssp_list subject attribute
//             * <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 greater than START_VALIDITY_AA and less than END_VALIDITY_AA
//             *      and the IUT current location is inside the CERT_TS_12_04_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['its_aid']
//             *                      containing its_aid
//             *                          indicating 'AID_CAM'
//             *              and containing header_fields ['signer_info']
//             *                  containing signer
//             *                      containing certificate 
//             *                          indicating CERT_TS_12_04_BO_AT
//             *                              containing subject_attributes['its_aid_ssp_list']
//             *                                  containing item [0].its_aid
//             *                                      indicating 'AID_CAM'
//             *                                  and containing item [1].its_aid
//             *                                      indicating 'AID_CAM'
//             *      } 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_12_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.2
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_12_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_taCert1204_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_12_04_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing AT certificate contains a CAM AID-SSP record whereas the issuing AA certificate does not contain the record with AID_CAM
//             * <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_13_01_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.certificate (CERT_TS_13_01_BO_AT)
//             *                  containing signer_info.digest
//             *                      referencing to CERT_TS_13_01_BO_AA
//             *                          containing validity_restrictions['its_aid_list']
//             *                              not containing 'AID_CAM'
//             *              and containing validity_restrictions['its_aid_ssp_list']
//             *                  containing a record
//             *                      containing its_aid
//             *                          indicating 'AID_CAM'
//             *      } 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_13_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_13_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_taCert1301_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_13_01_BO
//            
//            /**
//             * @desc    Check that the IUT discards a message when the signing AT certificate contains a DENM AID-SSP record whereas the issuing AA certificate does not contain the AID record with AID_DENM 
//             * <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_13_02_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured DENM (MSG_SEC_RCV_DENM_A)
//             *              containing header_fields ['signer_info'].signer.certificate (CERT_TS_13_02_BO_AT)
//             *                  containing signer_info.digest
//             *                      referencing to CERT_TS_13_02_BO_AA
//             *                          containing validity_restrictions['its_aid_list']
//             *                              not containing 'AID_DENM'
//             *              and containing validity_restrictions['its_aid_ssp_list']
//             *                  containing a record
//             *                      containing its_aid
//             *                          indicating 'AID_DENM'
//             *      } 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_13_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_13_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_sendSecuredDenm(cc_taCert1302_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_13_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data if the AA certificate does not contain a subject_attribute of type its_aid_list
//             * <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_13_03_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.certificate (CERT_TS_13_03_BO_AT)
//             *                  containing signer_info.digest
//             *                      referencing to CERT_TS_13_03_BO_AA
//             *                          not containing validity_restrictions['its_aid_list']
//             *      } 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_13_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_13_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_sendSecuredDenm(cc_taCert1303_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_13_03_BO
//            
//            /**
//             * @desc    Check that IUT discards the AT certificate with signer info of type 'certificate'
//             * <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_14_01_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_14_01_BO_AT)
//             *                  containing signer_info.type
garciay's avatar
garciay committed
//             *                      containing certificate
//             *                      and containing certificate
//             *                          indicating CERT_TS_AA_A
//             *      } 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_14_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.2
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_14_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_taCert1401_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_14_01_BO
//            
//            /**
//             * @desc    Check that IUT discards the AT certificate with signer info of type 'certificate_chain'
//             * <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_14_02_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_14_02_BO_AT)
//             *                  containing signer_info.type
//             *                      indicating 'certificate_chain'
//             *                      and containing certificates[0]
//             *                          indicating certificate (CERT_TEST_ROOT)
//             *                      and containing certificates[1]
//             *                          indicating certificate (CERT_TS_AA_A)
//             *      } 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_14_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.2
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_14_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_taCert1402_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_14_02_BO
//            
//            /**
//             * @desc    Check that IUT discards the AT certificate with signer info of type 'certificate_digest_with_other_algorithm'
//             * <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_14_03_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_14_03_BO_AT)
//             *                  containing signer_info.type
//             *                      indicating 'certificate_digest_with_other_algorithm'
//             *                      and containing digest
//             *                          referencing CERT_TS_AA_A
//             *      } 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_14_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.2
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_14_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_taCert1403_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_14_03_BO
//            
//            /**
//             * @desc    Check that IUT discards the AA certificate with signer info of type 'certificate'
//             * <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_15_01_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_15_01_BO_AT)
//             *                  containing signer_info.digest
//             *                      referencing to certificate (CERT_TS_15_01_BO_AA)
//             *                          containing signer_info
//             *                              containing type
garciay's avatar
garciay committed
//             *                                  containing certificate
//             *                          and containing certificate
//             *                              indicating CERT_TEST_ROOT
//             *      } 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_15_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.4
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_15_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_taCert1501_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_15_01_BO
//            
//            /**
//             * @desc    Check that IUT discards the AA certificate with signer info of type 'certificate_chain'
//             * <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_15_02_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_15_02_BO_AT)
//             *                  containing signer_info.type
//             *                      indicating 'certificate_chain'
//             *                      and containing certificates[0]
//             *                          indicating certificate (CERT_TEST_ROOT)
//             *                      and containing certificates[1]
//             *                          indicating certificate (CERT_TS_15_02_BO_CA)
//             *                              containing signer_info
//             *                                  containing type
//             *                                      indicating 'certificate_digest_with_sha256'
//             *                                  and containing digest 
//             *                                      referencing to CERT_TEST_ROOT
//             *      } 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_15_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.4
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_15_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_taCert1502_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_15_02_BO
//            
//            /**
//             * @desc    Check that IUT discards the AA certificate with signer info of type 'certificate_digest_with_other_algorithm'
//             * <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_15_03_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_15_03_BO_AT)
//             *                  containing signer_info.type
//             *                      indicating 'certificate_digest_with_other_algorithm'
//             *                      and containing digest
//             *                          referencing CERT_TEST_ROOT
//             *      } 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_15_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.4
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_15_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_taCert1503_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_15_03_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data if the subject_name of the AT certificate is not an empty name field
//             * <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_16_01_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_16_01_BO_AT)
//             *                  containing signer_info.digest
//             *                      referencing to certificate (CERT_TS_16_01_BO_AA)
//             *                          containing signer_infosubject_name
//             *                              indicating non-empty string ('Invalid name')
//             *      } 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_16_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.2
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_16_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_taCert1601_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_16_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data if the subject attribute of type assurance_level is missing in the AT certificate
//             * <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_17_01_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_17_01_BO_AT)
//             *                  not containing subject_attributes['assurance_level']
//             *      } 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_17_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_17_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_taCert1701_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_17_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data if the subject attribute of type assurance_level is missing in the AA certificate
//             * <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_17_02_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_17_02_BO_AT)
//             *                  containing signer_info.digest
//             *                      referencing to certificate (CERT_TS_17_02_BO_AA)
//             *                          not containing subject_attributes['assurance_level']
//             *      } 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_17_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_17_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_taCert1702_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_17_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data if the assurance level of issuing certificate is less then assurance level of subordinate certificate
//             * <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_17_03_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_17_03_BO_AT)
//             *                  containing subject_attributes['assurance_level']
//             *                      containing assurance_level
//             *                          indicating 0x80 (assurance level=4, confidence=0)
//             *                  and containing signer_info.digest
//             *                      referencing to certificate (CERT_TS_A_AA)
//             *                          containing subject_attributes['assurance_level']
//             *                              containing assurance_level
//             *                                  indicating 0x60 (assurance level=3, confidence=0)
//             *      } 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_17_03_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_17_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_taCert1703_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_17_03_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data if the assurance level of issuing certificate is equal to the  assurance level of the subordinate certificate but the confidence of subject assurance of issuing certificate is less then the confidence of the subordinate certificate
//             * <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_17_04_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_17_04_BO_AT)
//             *                  containing subject_attributes['assurance_level']
//             *                      containing assurance_level
//             *                          indicating 0x61 (assurance level=3, confidence=1)
//             *                  and containing signer_info.digest
//             *                      referencing to certificate (CERT_TS_A_AA)
//             *                          containing subject_attributes['assurance_level']
//             *                              containing assurance_level
//             *                                  indicating 0x60 (assurance level=3, confidence=0)
//             *      } 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_17_04_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_17_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_taCert1704_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_17_04_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data if the subject attribute of type verification_key is missing in the AT certificate
//             * <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_18_01_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_18_01_BO_AT)
//             *                  not containing subject_attributes['verification_key']
//             *      } 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_18_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_18_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_taCert1801_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_18_01_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data if the subject attribute of type verification_key is missing in the AA certificate
//             * <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_18_01_BO_AT
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.type
garciay's avatar
garciay committed
//             *                  containing certificate
//             *              and containing certificate (CERT_TS_18_02_BO_AT)
//             *                  containing signer_info.digest
//             *                      referencing to certificate (CERT_TS_18_02_BO_AA)
//             *                          not containing subject_attributes['verification_key']
//             *      } 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_18_02_BO
//             * @reference    ETSI TS 103 097 [1] Clause 7.4.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_18_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_taCert1802_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_18_02_BO
//            
//            /**
//             * @desc    Check that IUT discards a Ieee1609Dot2Data if the reserved region type has been used in region validity restriction of the AT certificate
//             * <pre>
//             * Pics Selection: PICS_GN_SECURITY
//             * Config Id: CF01
//             * Initial conditions:
//             *  with {
//             *      the IUT being in the 'authorized' state
//             *  }
//             *  ensure that {
//             *      when { 
//             *          the IUT is receiving a Secured CAM (MSG_SEC_RCV_CAM_01)
//             *              containing header_fields ['signer_info'].signer.certificate (CERT_TS_19_01_BO_AT)
//             *                  containing region_type
//             *                      indicating 240
//             *      } 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_19_01_BO
//             * @reference    ETSI TS 103 097 [1] Clause 4.2.2.1
//             */
//            testcase TC_SEC_ITSS_RCV_CERT_19_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_taCert1901_BO, omit, e_certificate);
//                
//                f_sleep(PX_TNOAC);
//                v_sentRawPayload := valueof(v_securedGnPdu.gnPacket.packet.payload);
//                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
//                    // Empty on purpose 
//                }
//                if (i < lengthof(vc_utInds)) {
//                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                }
//                else {
//                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer***");
//                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
//                }
//                
//                // Postamble
//                f_poNeighbour();
//                f_cf01Down();
//            } // End of testcase TC_SEC_ITSS_RCV_CERT_19_01_BO
//            
        } // End of group recvCertificatesProfile
//        
//    } // End of group receiverbehavior
//    
} // End of module ItsSecurity_TestCase