ItsSecurity_TestCases.ttcn3 462 KB
Newer Older
            
            /**
             * @desc    Check that SUT send certificate to unknown ITS-S
             * <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 already sent CAM at TIME_1
             *          containing header_fields['signer_info'].signer.type
             *              indicating 'certificate'
             *      and the IUT having received a SecuredMessage
             *                              at TIME_2 (TIME_1 < TIME_2 < TIME_1+ 1sec)
             *          containing header_fields['signer_info'] {
             *              containing signer
             *                  containing type
             *                      indicating 'certificate_digest_with_sha256'
             *                  containing digest
             *                      indicating HashedId3 value
             *                          referenced to unknown certificate
             *          }
             *          containing header_fields['its_aid']
             *              indicating 'AID_CAM'
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send CAM
             *                      at TIME_3 (TIME_1 < TIME_2 < TIME_3 < TIME_1 + 1sec)
             *      } then {
             *          the IUT sends a SecuredMessage {
             *              containing header_fields[0] {
             *                  containing type 
             *                      indicating 'signer_info'
             *                  containing signer {
             *                      containing type
             *                          indicating 'certificate'
             *                      containing certificate
             *                  }
             *              }
             *              containing header_fields['its_aid']
             *                  indicating 'AID_CAM'
             *          }
             *      }
             *  }
             * </pre>
             *
             * @see
             * @reference ETSI TS 103 097 V1.1.14, clause 7.1
             */
            testcase TC_SEC_ITSS_SND_CAM_07_01() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                const float c_certificateGenerationTime := 1.0;
                
                timer t_minTransInterval := c_certificateGenerationTime * 0.95;
                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();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_setCamFrequencyGreatherThan1Hz();
                geoNetworkingPort.clear;
                tc_ac.start;
                alt {
                     [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs(
                                    mw_header_field_signer_info_certificate
                     )))) { 
                        tc_ac.stop;
                        t_minTransInterval.start;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message with certificate received ***");
                        
                        // Send secured message from unknown ITS-S
                        f_sendSecuredCam(cc_taCert_B);
                        
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble("error", e_timeout);
                    }
                }
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs(
                                    mw_header_field_signer_info_certificate
                    )))) {
                        tc_ac.stop; 
                        log("*** " & testcasename() & ": INFO: CAM retransmission with certificate ***"); 
                        if (t_minTransInterval.running) {
                            log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate was successful ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
                        }
                        else {
                            log("*** " & testcasename() & ": INCONC: CAM with certificate received after 1s... ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                        }   
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: CAM retransmission w/o certificate ***"); 
                        tc_ac.start;
                        repeat;
                    }
                    [] t_minTransInterval.timeout {
                        log("*** " & testcasename() & ": INFO: Next CAM shall contain certificate ***");
                        repeat;  
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CAM 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_07_01
            
            /**
             * @desc    Check that IUT restart the certificate sending timer when the certificate has been sent
             * <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 then one CAM per second
             *      and the IUT having already sent CAM at TIME_1
             *          containing header_fields['signer_info'].signer.type
             *              indicating 'certificate'
             *      and the IUT having received a CAM
             *                              at TIME_2 (TIME_1 + 0.3sec) {
             *          containing header_fields['signer_info'].signer.type
             *              indicating 'certificate_digest_with_sha256'
             *          containing header_fields['signer_info'].signer.digest
             *              referenced to unknown certificate
             *      }
             *      and the IUT having sent CAM at TIME_3 (TIME_3 > TIME_2)
             *          containing header_fields['signer_info'].signer.type
             *              indicating 'certificate'
             *  }
             *  ensure that {
             *      when {
             *          the IUT is sending the next CAM at TIME_4
             *              containing header_fields['signer_info'].signer.type
             *                  indicating 'certificate'
             *      } then {
             *          the difference between TIME_4 and TIME_3 is about of 1sec
             *      }
             *  }
             * </pre>
             *
             * @see
             * @reference ETSI TS 103 097 V1.1.14, clause 7.1
             */
            testcase TC_SEC_ITSS_SND_CAM_07a_01() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                const float c_certificateGenerationTime := 1.0;
                
                timer t_minTransInterval := c_certificateGenerationTime * 0.95;
                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();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_setCamFrequencyGreatherThan1Hz();
                geoNetworkingPort.clear;
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs(
                                    mw_header_field_signer_info_certificate
                    )))) { 
                        tc_ac.stop;
                        t_minTransInterval.start;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message with certificate received ***");
                        
                        // Send secured message with request for unrecognized certificate
                        f_sendSecuredCam(
                            {
                                m_header_field_unrecognised_certificate(
                                    f_HashedId3FromHashedId8(
                                        vc_atCertificate.signer_info.signerInfo.digest
                                    )
                                )
                            } );
                        
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble("error", e_timeout);
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs(
                                    mw_header_field_signer_info_certificate
                    )))) {
                        tc_ac.stop; 
                        log("*** " & testcasename() & ": INFO: CAM retransmission with certificate ***"); 
                        if (t_minTransInterval.running) {
                            log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate was successful ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
                        } else {
                            log("*** " & testcasename() & ": INCONC: CAM with certificate received after 1s... ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                        }
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: CAM retransmission w/o certificate ***"); 
                        tc_ac.start;
                        repeat;
                    }
                    [] t_minTransInterval.timeout {
                        log("*** " & testcasename() & ": INFO: Next CAM shall contain certificate ***");
                        repeat;  
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CAM 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_07a_01
            
            /**
             * @desc    Check that SUT send certificate when requested
             * <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 already sent CAM at TIME_1
             *          containing header_fields['signer_info'].signer.type
             *              indicating 'certificate' 
             *      and the IUT having received a SecuredMessage 
             *                          at TIME_2 (TIME_1 < TIME_2 < TIME_1 + 1sec)
             *          containing header_fields['request_unrecognized_certificate']
             *              containing digests {
             *                  containing HashedId3 value
             *                      referencing to the AT certificate
             *                  and not containing HashedId3 value
             *                      referencing to the AA certificate
             *              }
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a CAM
             *                  at TIME_3 (TIME_1 < TIME_2 < TIME_3 < TIME_1 + 1sec)
             *      } then {
             *          the IUT sends a SecuredMessage {
             *              containing header_fields['signer_info'] {
             *                  containing signer {
             *                      containing type
             *                          indicating 'certificate'
             *                      containing certificate
             *                          referenced by the requested digest 
             *                  }
             *              }
             *              containing header_fields['its_aid']
             *                  indicating 'AID_CAM'
             *          }
             *      }
             *  }
             * </pre>
             *
             * @see
             * @reference ETSI TS 103 097 V1.1.14, clause 7.1
             */
            testcase TC_SEC_ITSS_SND_CAM_08_01() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                const float c_certificateGenerationTime := 1.0;
                
                timer t_minTransInterval := c_certificateGenerationTime * 0.95;
                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();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_setCamFrequencyGreatherThan1Hz();
                geoNetworkingPort.clear;
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs(
                                    mw_header_field_signer_info_certificate
                    )))) { 
                        tc_ac.stop;
                        t_minTransInterval.start;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message with certificate received ***");
                        
                        // Send secured message with request for unrecognized certificate
                        f_sendSecuredCam(
                            {
                                m_header_field_unrecognised_certificate(                                                              // containing digests
                                    f_HashedId3FromHashedId8(                           // containing HashedId3 value
                                        vc_atCertificate.signer_info.signerInfo.digest  //  referencing to the AT certificate
                                                                                        // and not containing HashedId3 value referencing to the AA certificate
                                    )
                                )
                            } );
                        
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble("error", e_timeout);
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs(
                                    mw_header_field_signer_info_certificate
                    )))) {
                        tc_ac.stop; 
                        log("*** " & testcasename() & ": INFO: CAM retransmission with certificate ***"); 
                        if (t_minTransInterval.running) {
                            log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate was successful ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
                        } else {
                            log("*** " & testcasename() & ": INCONC: CAM with certificate received after 1s... ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                        }
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: CAM retransmission w/o certificate ***"); 
                        tc_ac.start;
                        repeat;
                    }
                    [] t_minTransInterval.timeout {
                        log("*** " & testcasename() & ": INFO: Next CAM shall contain certificate ***");
                        repeat;  
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CAM 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_08_01
            
            /**
             * @desc    Check that SUT send certificate_chain when requested
             * <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 already sent a CAM
             *          containing header_fields['signer_info'].signer.type
             *              indicating 'certificate'
             *          at TIME_1
             *      and the IUT having received a SecuredMessage
             *          containing header_fields['request_unrecognized_certificate'] {
             *              containing digests {
             *                  containing HashedId3 value
             *                      referencing to the AA certificate
             *              }
             *          }
             *          at TIME_2 (TIME_1 < TIME_2 < TIME_1+ 1sec)
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send a CAM
             *              at TIME_3 (TIME_1 < TIME_2 < TIME_3 < TIME_1+ 1sec)
             *      } then {
             *          the IUT sends a SecuredMessage {
             *              containing header_fields['signer_info'] {
             *                  containing signer {
             *                      containing type
             *                          indicating 'certificate_chain'
             *                      containing certificates[last]
             *                          indicating the AT certificate
             *                      containing certificates[last-1]
             *                          indicating the AA certificate
             *                  }
             *              }
             *              containing header_fields['its_aid']
             *                  indicating 'AID_CAM'
             *          }
             *      }
             *  }
             * </pre>
             *
             * @see
             * @reference ETSI TS 103 097 V1.1.14, clause 7.1
             */
            testcase TC_SEC_ITSS_SND_CAM_09_01() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                const float c_certificateGenerationTime := 1.0;
                
                timer t_minTransInterval := c_certificateGenerationTime * 0.95;
                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();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_setCamFrequencyGreatherThan1Hz();
                geoNetworkingPort.clear;
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs(
                                    mw_header_field_signer_info_certificate
                    )))) { 
                        tc_ac.stop;
                        t_minTransInterval.start;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message with certificate received ***");
                        
                        // Send secured message with request for unrecognized certificate
                        f_sendSecuredCam(
                            {
                                m_header_field_unrecognised_certificate(                    // containing digests
                                    f_HashedId3FromHashedId8(                               //     containing HashedId3 value
                                        vc_aaCertificate.signer_info.signerInfo.digest  //         referencing to the AA certificate
                                    )
                                )
                            });
                        
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message with certificate not received ***");
                        f_selfOrClientSyncAndVerdictPreamble("error", e_timeout);
                    }
                } // End of 'alt' statement
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs(
                                    mw_header_field_signer_info_certificate_chain
                    )))) -> value v_geoNwInd {
                        tc_ac.stop; 
                        log("*** " & testcasename() & ": INFO: CAM retransmission with certificate ***"); 
                        if (t_minTransInterval.running) {
                            var SignerInfo v_signerInfo;
                            var CertificateChain v_certificates;
                            var integer v_certificateChainLength;
                            
                            // Extract certificate chain
                            f_getMsgSignerInfo(v_geoNwInd.msgIn.gnPacket.securedMsg, v_signerInfo);
                            v_certificates := v_signerInfo.signerInfo.certificates;
                            v_certificateChainLength := lengthof(v_certificates);
                            if (v_certificateChainLength >= 2) { // Check length
                                if ( // Check Content
                                    not(
                                        (v_certificates[v_certificateChainLength - 1].subject_info.subject_type == e_authorization_authority) and 
                                            // Check the certificate chain contains certificates[last] indicating the AT certificate
                                        (v_certificates[v_certificateChainLength - 2].subject_info.subject_type == e_authorization_ticket)
                                            // Check the certificate chain contains certificates[last-1] indicating the AA certificate
                                )) {
                                    log("*** " & testcasename() & ": FAIL: Unexpected certificate chain content ***");
                                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
                                } else {
                                    log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate chain was successful ***");
                                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                                } 
                            } else {
                                log("*** " & testcasename() & ": FAIL: Unexpected certificate chain content length ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
                            }
                        } else {
                            log("*** " & testcasename() & ": INCONC: CAM with certificate chain received after 1s... ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                        }   
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: CAM retransmission w/o certificate chain ***"); 
                        tc_ac.start;
                        repeat;
                    }
                    [] t_minTransInterval.timeout {
                        log("*** " & testcasename() & ": INFO: Next CAM shall contain certificate chain ***");
                        repeat;  
                    }
                    
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CAM 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_09_01
            
            /**
             * @desc    Check that message generation time is inside the validity period of the signing certificate
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  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 CAM
             *      } then {
             *          the IUT sends a SecuredMessage {
             *              containing security_profile
             *                  indicating '1'
             *              containing header_fields ['generation_time'] {
             *                  containing generation_time
             *                      indicating TIME_1 (CUR_TIME - 5min <= TIME_1 <= CUR_TIME + 5min)
             *              }
             *              containing header_fields ['signer_info'] {
             *                  containing signer {
             *                      containing type
             *                          indicating 'certificate'
             *                      containing certificate {
             *                          not containing validity_restrictions['time_start_and_end']
             *                          or containing validity_restrictions['time_start_and_end'] {
             *                              containing start_validity
             *                                  indicating value <= TIME_1
             *                              containing end_validity
             *                                  indicating value > TIME_1
             *                          }
             *                      }
             *                  }
             *              }
             *              containing its_aid
             *                  indicating 'AID_CAM'
             *          }
             *      }
             *  }
             * </pre>
             *
             * @see
             * @reference ETSI TS 103 097 V1.1.14, clause 7.1
             */
            testcase TC_SEC_ITSS_SND_CAM_10_01() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                const integer c_timeThreshold := 5000; /** Time threshold in milliseconds */
                
                var GeoNetworkingInd v_geoNwInd;
                var SignerInfo v_signerInfo;
                var Certificate v_certificate;
                var HeaderField v_headerField;
                var Time64 v_generationTime;
                var ValidityRestriction v_validity;
                var integer v_currentTime, v_lowerBound, v_upperBound;
                
                // 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();
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage(
                                    superset(
                                        mw_header_field_generation_time, 
                                        mw_header_field_signer_info_certificate,
                                        mw_header_field_its_aid_CAM
                    ))))) -> value v_geoNwInd {
                        tc_ac.stop; 
                        log("*** " & testcasename() & ": INFO: CAM transmission with certificate ***");
                        
                        v_currentTime := f_getCurrentTime();
                        v_lowerBound := (v_currentTime - c_timeThreshold) * 1000;
                        v_upperBound := (v_currentTime + c_timeThreshold) * 1000;
                        
                        // Extract generation_time
                        f_getMsgHeaderField(v_geoNwInd.msgIn.gnPacket.securedMsg, e_generation_time, v_headerField);
                        v_generationTime := v_headerField.headerField.generation_time;
                        
                        // Extract certificate
                        f_getMsgSignerInfo(v_geoNwInd.msgIn.gnPacket.securedMsg, v_signerInfo);
                        v_certificate := v_signerInfo.signerInfo.certificate;
                         
                        // Check current time 
                        if (match(v_generationTime, (v_lowerBound .. v_upperBound))) {
                            log("*** " & testcasename() & ": PASS: Generation time matches current time ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
                        } else {
                            log("*** " & testcasename() & ": FAIL: Generation time does not match current time. ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        }   
                        
                        // Check generation_time validity
                        if (
                            not(f_getCertificateValidityRestriction(v_certificate, e_time_start_and_end, v_validity)) or 
                            (v_generationTime >= (v_validity.validity.time_start_and_end.start_validity * 1000000) and 
                            (v_generationTime < (v_validity.validity.time_start_and_end.end_validity * 1000000)))
                        ) {
                            log("*** " & testcasename() & ": PASS: Generation time within certificate validity ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
                        } else {
                            log ("start_validity (in us)=", v_validity.validity.time_start_and_end.start_validity * 1000000);
                            log ("end_validity (in us)  =", v_validity.validity.time_start_and_end.end_validity * 1000000);
                            log("*** " & testcasename() & ": FAIL: Generation time not within certificate validity ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        }
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: CAM retransmission w/o certificate  ***"); 
                        tc_ac.start;
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CAM 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_10_01
            
            /**
             * @desc    Check secured CAM its_aid value
             * <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 requested to send CAM
             *      } then {
             *          the IUT sends a SecuredMessage {
             *              containing header_fields ['its_aid'] {
             *                  containing its_aid
             *                      indicating 'AID_CAM' (16512)
             *              }
             *          }
             *      }
             *  }
             * </pre>
             *
             * @see
             * @reference ETSI TS 103 097 V1.1.14, clause 7.1
             */
            testcase TC_SEC_ITSS_SND_CAM_11_01() 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
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs,
                                mw_geoNwPduWithPayload(
                                    ?,
                                    ?,
                                    mw_secCamPayload).packet
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CAM received as message_type 2");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_dummy, 
                                mw_geoNwPduWithPayload(
                                    ?,
                                    ?,
                                    mw_secCamPayload).packet
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: CAM received with different message_type");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CAM 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_11_01
            
            /**
             * @desc    Check that the IUT sends certificate request when it receives a message from unknown station
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT has receiving a SecuredMessage {
             *          containing header_fields['signer_info'].signer {
             *              containing type
             *                  indicating 'certificate_digest_with_sha256'
             *              containing digest
             *                  indicating HashedId3 value DIGEST_A
             *                      referenced to unknown certificate
             *          }
             *      }
             *  }
             *  ensure that {
             *      when {
             *          the IUT is requested to send CAM
             *      } then {
             *          the IUT sends a SecuredMessage {
             *              containing header_fields['request_unrecognized_certificate'] {
             *                  containing digests
             *                      containing HashedId3 value
             *                          indicating DIGEST_A
             *              }
             *              containing header_fields ['its_aid'] {
             *                  containing its_aid
             *                      indicating 'AID_CAM'
             *          }
             *      }
             *  }
             * </pre>
             *
             * @see
             * @reference ETSI TS 103 097 V1.1.14, clause 7.1
             */
            testcase TC_SEC_ITSS_SND_CAM_12_01() 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
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                // Send secured message from unknown ITS-S
                f_sendSecuredCam(cc_taCert_B);
                geoNetworkingPort.clear;
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs(
                                    mw_header_field_request_unrecognized_certificate(
                                        {
                                            f_HashedId3FromHashedId8(
                                                vc_lastAtCertificateUsed.signer_info.signerInfo.digest
                                            )
                                        } // End of list
                    ))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CAM received with request for unrecognized certificate");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_dummy
                    ))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: CAM received without request for unrecognized certificate");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CAM 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_12_01
            
            /**
             * @desc    Check that the Secured CAM contains exactly one non-empty payload of type signed.
             * <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 requested to send a CAM
             *      } then {
             *          the IUT sends a SecuredMessage {
             *              containing header_fields ['its_aid'] {
             *                  containing its_aid
             *                      indicating 'AID_CAM' (16512)
             *              }
             *              containing payload_field
             *                  containing exactly one element of type Payload {
             *                      containing type
             *                          indicating 'signed'
             *                      containing not-empty data
             *                  }
             *          }
             *      }
             *  }
             * </pre>
             *
             * @see
             * @reference ETSI TS 103 097 V1.1.14, clause 7.1
             */
            testcase TC_SEC_ITSS_SND_CAM_14_01() 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
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mdw_securedMessage_CAMs(
                                    ?, 
                                    mw_payload(
                                        e_signed
                    ))))) {
                        tc_ac.stop;
                        
                        log("*** " & testcasename() & ": PASS: CAM received with exactly 1 signed payload");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected CAM 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_14_01
            
            /**
             * @desc    Check that the secured CAM contains only one TrailerField of type signature.
             *        Check that the signature contained in the SecuredMessage is calculated over the