ItsSecurity_TestCases.ttcn 1.56 MB
Newer Older
3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356
                // 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_SIGN_ALGORITHM == e_nistp_256] 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: CAM message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SIGN_ALGORITHM == e_nistp_256] 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: CAM message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SIGN_ALGORITHM == e_nistp_256] 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: CAM message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SIGN_ALGORITHM == e_brainpool_256] 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: CAM message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SIGN_ALGORITHM == e_brainpool_256] 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: CAM message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SIGN_ALGORITHM == e_brainpool_256] 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: CAM message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SIGN_ALGORITHM == e_brainpool_384] 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: CAM message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SIGN_ALGORITHM == e_brainpool_384] 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: CAM message with well-formated signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
                    }
                    [PICS_SIGN_ALGORITHM == e_brainpool_384] 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: CAM 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: CAM message with wrong signature received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM 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_CERTFICATES_FOI[PICS_CERTFICATES_VAR].certificate_id;
                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_CERTFICATES_FOI[PICS_CERTFICATES_VAR].certificate_id;
                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_CERTFICATES_FOI[PICS_CERTFICATES_VAR].certificate_id;
                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_CERTFICATES_FOI[PICS_CERTFICATES_VAR].certificate_id;
                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
            
            /**
garciay's avatar
garciay committed
             * @desc    Check that IUT doesn’t send secured CAMs if IUT doesn’t possess an AT certificate allowing 
             *          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_CERTFICATES_FOI[PICS_CERTFICATES_VAR].certificate_id;
                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 sendCAMProfile
         * @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
garciay's avatar
garciay committed
        group sendDENMProfile {
            
            /**
             * @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
             */
            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 DENM 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_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
             */
            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 DENM 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_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, 
             *       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
             */
            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 DENM 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_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
             */
            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(