ItsSecurity_TestCases.ttcn3 1.4 MB
Newer Older
garciay's avatar
garciay committed
             *                      indicating 'aes_128_ccm'
             *                  and containing nonce
             *              and containing header_fields[4]
             *                  containing type
             *                      indicating 'recipient_info'
             *                  and containing recipients
             *                      containing recipients[0]
             *                          containing cert_id
             *                              referencing to CERT_IUT_A_AT
             *                          and containing pk_encryption
             *                              indicating 'ecies_nistp256'
             *                          and containing enc_key
             *          and not containing other header fields
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_04_13_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
            testcase TC_SEC_ITSS_RCV_CAM_04_13_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                var Certificate v_iutATCertificate;
                var SubjectAttribute v_encryption_key;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
garciay's avatar
garciay committed
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                if (
                    (f_readCertificate(cc_iutCert_A, v_iutATCertificate) == false) or 
                    (f_getCertificateSubjectAttribute(v_iutATCertificate, e_encryption_key, v_encryption_key) == false)
                    ) {
                    f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout); // Set verdict to inconc
                } else {
                    v_securedGnPdu := f_prepareSecuredCam(
                        cc_taCert_B, 
                        {
                            m_header_field_generation_time(1000 * (f_getCurrentTime())), // In us
                            m_header_field_generation_location(
                                m_threeDLocation(
                                    PX_WGSLONGITUDE,
                                    PX_WGSLATITUDE,
                                    int2oct(0, 2)
                                )
                            ), 
                            m_header_field_its_aid_CAM,                                 // containing header_fields[2].type
                                                                                        //     indicating 'its_aid'
                            m_header_field_enc_params(                                  // containing header_fields[3].type.enc_params
                                m_encryptionParameters_aes_128_ccm(                     //      indicating 'aes_128_ccm'
                                    PX_ENCRYPTIONPARAMETERS_AES_128_CCM_NONCE           // and containing nonce
                                )
                            ),
                            m_header_field_multiple_recipients(                         // containing header_fields[4].type
                                {                                                       //     indicating 'encryption_parameters'
                                    m_recipientInfo_ecies_enc_key(
                                        v_iutATCertificate.signer_info.signerInfo.digest,
                                        e_ecies_nistp256,                               // containing symm_algorithm
                                                                                        //     indicating 'aes_128_ccm'
                                        m_eciesEncryptedKey_aesccm(
                                            v_encryption_key.attribute.rv,
                                            '00000000000000000000000000000000'O, // FIXME Where to find these values
                                            '00000000000000000000000000000000'O
                                        )
                                    )
                                }
                            )
                        }, 
                        e_certificate_digest_with_sha256,
                        true
                    ); 
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                    
                    f_sleep(PX_TNOAC);
                    v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                    for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
garciay's avatar
garciay committed
                        // Empty on purpose 
garciay's avatar
garciay committed
                    } // End of 'for' statement
                    if (i < lengthof(vc_utInds)) {
                        log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    else {
                        log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CAM_04_13_BO
            
garciay's avatar
garciay committed
             * @desc    Check that IUT discards a secured CAM if the header_fields contains a signer of type 'self'
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
garciay's avatar
garciay committed
             * with { 
             *  the IUT being in the 'authorized' state 
garciay's avatar
garciay committed
             *  and the IUT current time is inside the time validity period of CERT_TS_A_AT
garciay's avatar
garciay committed
             * } 
             * ensure that { 
garciay's avatar
garciay committed
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_01) 
garciay's avatar
garciay committed
             *          containing header_fields[0].type
             *              indicating 'signer_info'
garciay's avatar
garciay committed
             *                  containing signer.type
             *                      indicating 'self'
garciay's avatar
garciay committed
             *  } then { 
             *      the IUT discards the message 
garciay's avatar
garciay committed
             *  } 
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_05_01_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.1
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_CAM_05_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                if (PICS_DEBUG_ADDON) {
                    f_sendCertificate(cc_taCert_F, f_generateDefaultCam());
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_prepareSecuredCam(
garciay's avatar
garciay committed
                    cc_taCert_A, 
garciay's avatar
garciay committed
                        m_header_field_signer_info(
garciay's avatar
garciay committed
                            m_signerInfo_self
                        ), 
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_its_aid_CAM
                    }, 
garciay's avatar
garciay committed
                    e_self,
garciay's avatar
garciay committed
                    false
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
garciay's avatar
garciay committed
                    // Empty on purpose 
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_CAM_05_01_BO
garciay's avatar
garciay committed
             * @desc    Check that IUT discards a secured CAM if the header_fields contains a signer of type certificate_digest_with_other_algorithm
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
garciay's avatar
garciay committed
             * with { 
             *  the IUT being in the 'authorized' state 
garciay's avatar
garciay committed
             *  and the IUT current time is inside the time validity period of CERT_TS_A_AT
garciay's avatar
garciay committed
             * ensure that { 
garciay's avatar
garciay committed
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_02) 
garciay's avatar
garciay committed
             *          containing header_fields[0].type
             *              indicating 'signer_info'
garciay's avatar
garciay committed
             *                  containing signer.type
             *                      indicating 'certificate_digest_with_other_algorithm'
garciay's avatar
garciay committed
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_05_02_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.1
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_CAM_05_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                if (PICS_DEBUG_ADDON) {
                    f_sendCertificate(cc_taCert_F, f_generateDefaultCam());
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_prepareSecuredCam(
garciay's avatar
garciay committed
                    cc_taCert_A, 
garciay's avatar
garciay committed
                        m_header_field_signer_info(
garciay's avatar
garciay committed
                            m_signerInfo_other_certificates(
                                m_certificateWithAlgo_ecdsa(
                                    PX_OTHER_CERT_DIGEST
                        ))), 
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
garciay's avatar
garciay committed
                        m_header_field_its_aid_CAM
garciay's avatar
garciay committed
                    e_certificate_digest_with_other_algorithm,
garciay's avatar
garciay committed
                    false
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
garciay's avatar
garciay committed
                    // Empty on purpose 
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_CAM_05_02_BO
garciay's avatar
garciay committed
             * @desc    Check that IUT discards a secured CAM if the header_fields contains a signer of type certificate_chain and the chain is empty
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             * with { 
             *  the IUT being in the 'authorized' state 
garciay's avatar
garciay committed
             *  and the IUT current time is inside the time validity period of CERT_TS_A_AT
garciay's avatar
garciay committed
             * } 
             * ensure that { 
garciay's avatar
garciay committed
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_02) 
garciay's avatar
garciay committed
             *          containing header_fields[0].type
             *              indicating 'signer_info'
garciay's avatar
garciay committed
             *                  containing signer.type
             *                      indicating 'certificate_chain'
             *                  and containing certificates
             *                      indicating length = 0
garciay's avatar
garciay committed
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
garciay's avatar
garciay committed
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_05_03_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.1
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_CAM_05_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
garciay's avatar
garciay committed
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                if (PICS_DEBUG_ADDON) {
                    f_sendCertificate(cc_taCert_F, f_generateDefaultCam());
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                v_securedGnPdu := f_prepareSecuredCam(
                    cc_taCert_A, 
                    {
                        m_header_field_signer_info(
garciay's avatar
garciay committed
                            m_signerInfo_certificates(
garciay's avatar
garciay committed
                                { }
garciay's avatar
garciay committed
                        )), 
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_its_aid_CAM
                    }, 
garciay's avatar
garciay committed
                    e_certificate_chain,
garciay's avatar
garciay committed
                    false
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_CAM_05_03_BO
garciay's avatar
garciay committed
             * @desc    Check that IUT discards a secured CAM if the header_fields contains a signer of type certificate_chain and the chain contains only one certificate
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
             * with { 
             *  the IUT being in the 'authorized' state 
garciay's avatar
garciay committed
             *  and the IUT current time is inside the time validity period of CERT_TS_A_AT
garciay's avatar
garciay committed
             * } 
             * ensure that { 
garciay's avatar
garciay committed
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_03) 
garciay's avatar
garciay committed
             *          containing header_fields[0].type
             *              indicating 'signer_info'
garciay's avatar
garciay committed
             *                  containing signer.type
             *                      indicating 'certificate_chain'
             *                  and containing certificates
garciay's avatar
garciay committed
             *                      indicating length = 1
garciay's avatar
garciay committed
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
garciay's avatar
garciay committed
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_05_04_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.1
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_CAM_05_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
garciay's avatar
garciay committed
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                v_securedGnPdu := f_prepareSecuredCam(
                    cc_taCert_A, 
                    {
                        m_header_field_signer_info(
garciay's avatar
garciay committed
                            m_signerInfo_certificates(
garciay's avatar
garciay committed
                                { vc_atCertificate }
garciay's avatar
garciay committed
                        )), 
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_its_aid_CAM
                    }, 
garciay's avatar
garciay committed
                    e_certificate_chain,
garciay's avatar
garciay committed
                    false
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_CAM_05_04_BO
garciay's avatar
garciay committed
             * @desc    Check that IUT discards a secured CAM if the header_fields contains a signer info of unknown or reserved type
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
garciay's avatar
garciay committed
             * Initial conditions:
garciay's avatar
garciay committed
             * with { 
             *  the IUT being in the 'authorized' state 
garciay's avatar
garciay committed
             *  and the IUT current time is inside the time validity period of CERT_TS_A_AT
garciay's avatar
garciay committed
             * } 
             * ensure that { 
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_02) 
             *          containing header_fields['signer_info']
             *                  containing signer.type
             *                      indicating X_UNKNOWN_SIGNERINFO_TYPE
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_05_05_BO
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
            testcase TC_SEC_ITSS_RCV_CAM_05_05_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_securedGnPdu := f_prepareSecuredCam(
                    cc_taCert_A, 
                    {
                        m_header_field_signer_info(
                            m_signerInfo_unknown(
                                'CAFFEEDECA'O
                        )), 
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_its_aid_CAM
                    }, 
                    e_unknown,
                    false
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CAM_05_05_BO
            
            /**
             * @desc    Check that IUT discards message containing generation_time before the certificate validity period
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT current time is inside the time validity period of CERT_TS_A_AT
             *  }
garciay's avatar
garciay committed
             *  ensure that {
             *      when { 
garciay's avatar
garciay committed
             *          the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_01)
garciay's avatar
garciay committed
             *              and containing header_fields['signer_info'].signer 
garciay's avatar
garciay committed
             *                  containing certificate (CERT_TS_MSG_06_01_BO_AT)
garciay's avatar
garciay committed
             *                      containing validity_restrictions['time_start_and_end']
             *                          containing start_validity
             *                              indicating START_VALIDITY_AT
             *                          and containing end_validity
             *                              indicating END_VALIDITY_AT
             *              and containing header_fields ['generation_time']
             *                  containing generation_time
             *                      indicating GEN_TIME < START_VALIDITY_AT
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
garciay's avatar
garciay committed
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_06_01_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clauses 5.4 and 7.1
garciay's avatar
garciay committed
            testcase TC_SEC_ITSS_RCV_CAM_06_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
garciay's avatar
garciay committed
                var ValidityRestriction v_timeValidity;
garciay's avatar
garciay committed
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                f_getCertificateValidityRestriction(vc_atCertificate, e_time_start_and_end, v_timeValidity);
garciay's avatar
garciay committed
                v_securedGnPdu := f_prepareSecuredCam(
garciay's avatar
garciay committed
                    cc_taCert0601_BO, 
garciay's avatar
garciay committed
                    {
garciay's avatar
garciay committed
                        m_header_field_generation_time( 
                            (v_timeValidity.validity.time_start_and_end.start_validity - 3600) * 1000
garciay's avatar
garciay committed
                        ) // In us
garciay's avatar
garciay committed
                    },
                    e_certificate
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_CAM_06_01_BO
garciay's avatar
garciay committed
             * @desc    Check that IUT discards message containing generation_time after the certificate validity period
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT current time is inside the time validity period of CERT_TS_A_AT
             *  }
             *  ensure that {
             *      when { 
garciay's avatar
garciay committed
             *          the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_01)
garciay's avatar
garciay committed
             *              and containing header_fields['signer_info'].signer 
garciay's avatar
garciay committed
             *                  containing certificate (CERT_TS_MSG_06_02_BO_AT)
garciay's avatar
garciay committed
             *                      containing validity_restrictions['time_start_and_end']
             *                          containing start_validity
             *                              indicating START_VALIDITY_AT
             *                          and containing end_validity
             *                              indicating END_VALIDITY_AT
             *              and containing header_fields ['generation_time']
             *                  containing generation_time
             *                      indicating GEN_TIME > END_VALIDITY_AT
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_06_02_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clauses 5.4 and 7.1
garciay's avatar
garciay committed
             */
            testcase TC_SEC_ITSS_RCV_CAM_06_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
garciay's avatar
garciay committed
                var ValidityRestriction v_timeValidity;
garciay's avatar
garciay committed
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                f_getCertificateValidityRestriction(vc_atCertificate, e_time_start_and_end, v_timeValidity);
garciay's avatar
garciay committed
                v_securedGnPdu := f_prepareSecuredCam(
garciay's avatar
garciay committed
                    cc_taCert0602_BO, 
garciay's avatar
garciay committed
                    {
garciay's avatar
garciay committed
                        m_header_field_generation_time( 
                            (v_timeValidity.validity.time_start_and_end.end_validity + 3600) * 1000
garciay's avatar
garciay committed
                        ) // In us
                    },
                    e_certificate
                ); 
garciay's avatar
garciay committed
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
garciay's avatar
garciay committed
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
garciay's avatar
garciay committed
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
garciay's avatar
garciay committed
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_CAM_06_02_BO
garciay's avatar
garciay committed
             * @desc    Check that IUT discards Secured CAM if the generation_time is more than 5 minute in the past (C2C only)
             * <pre>
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT current time is inside the time validity period of CERT_TS_A_AT
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *          containing header_fields ['generation_time']
             *              containing generation_time
             *                  indicating GEN_TIME ( CURRENT_TIME - 302sec )
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_06_03_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
            testcase TC_SEC_ITSS_RCV_CAM_06_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
garciay's avatar
garciay committed
                // Test adapter configuration
garciay's avatar
garciay committed
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                v_securedGnPdu := f_prepareSecuredCam(
                    cc_taCert_A, 
                    {
garciay's avatar
garciay committed
                        m_header_field_generation_time(
garciay's avatar
garciay committed
                            (1000 * f_getCurrentTime() - 302) * 1000
                        ) // In us
                    },
                    e_certificate_digest_with_sha256
                ); 
garciay's avatar
garciay committed
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                f_sleep(PX_TNOAC);
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_CAM_06_03_BO
            
garciay's avatar
garciay committed
             * @desc    Check that IUT discards Secured CAM if the generation_time is more than 5 minute in the future(C2C only)
             * <pre>
garciay's avatar
garciay committed
             * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *      and the IUT current time is inside the time validity period of CERT_TS_A_AT
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *          containing header_fields ['generation_time']
             *              containing generation_time
             *                  indicating GEN_TIME ( CURRENT_TIME + 302sec )
             *      } then {
             *          the IUT discards the message
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_06_04_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
            testcase TC_SEC_ITSS_RCV_CAM_06_04_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
garciay's avatar
garciay committed
                // Test adapter configuration
garciay's avatar
garciay committed
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                v_securedGnPdu := f_prepareSecuredCam(
                    cc_taCert_A, 
                    {
garciay's avatar
garciay committed
                        m_header_field_generation_time(
garciay's avatar
garciay committed
                            (1000 * f_getCurrentTime() + 302) * 1000
                        ) // In us
                    },
                    e_certificate_digest_with_sha256
                ); 
garciay's avatar
garciay committed
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
            } // End of testcase TC_SEC_ITSS_RCV_CAM_06_04_BO
garciay's avatar
garciay committed
             * @desc    Check that IUT discards secured CAM when its_aid value is not AID_CAM
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             * with { 
             *  the IUT being in the 'authorized' state 
             *  and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * } 
             * ensure that { 
             *     when {  
             *         the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_01) 
             *             containing header_fields['its_aid'] 
             *                 indicating AID_DENM 
             *             and containing payload_field { 
             *                 containing type 
             *                     indicating 'signed' 
             *                 containing data 
             *                     containing CAM payload 
             *             } 
             *     } then { 
             *         the IUT discards the message 
             *     } 
             * } 
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_07_01_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
            testcase TC_SEC_ITSS_RCV_CAM_07_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
garciay's avatar
garciay committed
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
garciay's avatar
garciay committed
                // Test component configuration
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
                v_securedGnPdu := f_prepareSecuredCam(
                    cc_taCert_A, 
                    {
                        m_header_field_its_aid_DENM
                    },
                    e_certificate_digest_with_sha256
                ); 
garciay's avatar
garciay committed
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_securedGnPdu.gnPacket.packet.payload);
                for (i := 0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i := i + 1) {
garciay's avatar
garciay committed
                    // Empty on purpose 
garciay's avatar
garciay committed
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_RCV_CAM_07_01_BO
            
            /**
             * @desc    Check that IUT discards secured CAM when its_aid value is undefined
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             * with { 
             *  the IUT being in the 'authorized' state 
             *  and the IUT current time is inside the time validity period of CERT_TS_A_AT
             * } 
             * ensure that { 
             *     when {  
             *         the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_01) 
             *             containing header_fields['its_aid'] 
             *                 indicating 'AID_UNDEFINED' 
             *             and containing payload_field { 
             *                 containing type 
             *                     indicating 'signed' 
             *                 containing data 
             *                     containing CAM payload 
             *             } 
             *     } then { 
             *         the IUT discards the message 
             *     } 
             * } 
             * </pre>
             *
garciay's avatar
garciay committed
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_07_02_BO
garciay's avatar
garciay committed
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
            testcase TC_SEC_ITSS_RCV_CAM_07_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
garciay's avatar
garciay committed
                
garciay's avatar
garciay committed
                // Test component configuration
garciay's avatar
garciay committed
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);