ItsSecurity_TestCases.ttcn 1.6 MB
Newer Older
8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_07_BV
            
            /**
             * @desc    Check that the identified certificate validity region contains values that correspond 
             *          to numeric country codes as defined by United Nations Statistics Division [6] in October 2013.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_IDENTIFIED_REGION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT issued the certificate 
             *          containing toBeSigned
             *              containing region
             *                  containing identifiedRegion
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT issued the AT certificate 
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing toBeSigned
             *                 containing region
             *                     containing identifiedRegion
             *                         containing 1 entry of type IdentifiedRegion
             *                             containing countryOnly
             *                                 indicating integer representation of the identifier of country or area
             *                             or containing countryAndRegions
             *                                 containing countryOnly
             *                                     indicating integer representation of the identifier of country or area
             *                             or containing countryAndSubregions
             *                                 containing country
             *                                     indicating integer representation of the identifier of country or area
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_08_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6.4.23
             */
            testcase TC_SEC_ITSS_SND_CERT_08_BV() runs on ItsGeoNetworking system ItsSecSystem {                    
                    
                // Local variables
                var SequenceOfCertificate v_aa_certificate;
                var SignerIdentifier      v_signerIdentifier;
                var GeoNetworkingInd      v_geoNwInd;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_IDENTIFIED_REGION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_IDENTIFIED_REGION' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                f_cf01Up(); // Initialise IUT with CERT_IUT_A_AT signed with CERT_IUT_A_AA
                    
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -,
                                                    mw_geographicRegion_identified
                    )))))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        // FIXME To be continued
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                )
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_08_BV
            
            /**
             * @desc    Check that the IUT supports at least 8 points in the polygonal certificate validity region 
             *          in the AT certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY and PICS_SEC_IDENTIFIED_REGION
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (CERT_IUT_E_AT_8)
             *          containing toBeSigned
             *              containing region
             *                  containing polygonalRegion
             *                      containing 8 entries
             *                          containing one of the items (I)
             *                              containing current IUT position
             *  }
             * Expected behaviour:
             * ensure that {
             *     when { 
             *         the IUT is requested to send a secured DENM 
             *     } then {
             *         this certificate is of type EtsiTs103097Certificate
             *             containing headerInfo
             *                 containing generationLocation
             *                     indicating position inside I 
             *     }
             * }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_09_BV
             * @reference   ETSI TS 103 097 [1], Clauses 6.4.17
             */
            testcase TC_SEC_ITSS_SND_CERT_09_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var HeaderInfo       v_headerInfo;
                var SignerIdentifier v_signerIdentifier;
                var Certificate      v_cert;
                var ItsDenm          v_denmComponent;
                
                // Test control
                if (not(PICS_GN_SECURITY) or not(PICS_SEC_IDENTIFIED_REGION)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_SEC_IDENTIFIED_REGION' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := cc_iutCert_A; // FIXME Review certificate to be used
                f_cf01Up();
                    
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_denmComponent := f_triggerDenmEvent();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                ?,
                                                mw_toBeSignedCertificate_at(
                                                    -, -, -,
                                                    mw_geographicRegion_polygonal
                                                )
                                            )
                                        )
                                     )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if (f_getMsgHeaderInfo(f_getSecuredMessage(v_geoNwInd.msgIn), v_headerInfo) and f_getMsgSignerIdentifier(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerIdentifier)) {
                            var ThreeDLocation v_location := { v_headerInfo.generationLocation.latitude, v_headerInfo.generationLocation.longitude, v_headerInfo.generationLocation.elevation }; 
                            var integer v_counter;
                            
                            for (v_counter := 0; v_counter < lengthof(v_signerIdentifier.certificate); v_counter := v_counter + 1) {
                                if (f_isLocationInsideRegion(v_signerIdentifier.certificate[v_counter].toBeSigned.region, v_location) == false) {
                                    break;
                                }
                            } // End of of for statement
                            if (v_counter == lengthof(v_signerIdentifier.certificate)) {
                                log("*** " & testcasename() & ": PASS: AT certificate is inside the validity region of the issuing certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                            } else {
                                log("*** " & testcasename() & ": FAIL: AT certificate is not inside the validity region of the issuing certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            }
                        } else {
                            log("*** " & testcasename() & ": FAIL: IMPOSSIBLE!!! CAM generation location or certificate region restriction header field does not exist ***"); 
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        }
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_denm
                                        ),
                                        mw_signerIdentifier_digest // containing digest
                                    )
                                ), 
                                mw_geoNwBroadcastPacket
                    ))) {
                        log("*** " & testcasename() & ": INFO: Generation of CAM messages including digest ***");
                        repeat;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_cancelDenmEvent(v_denmComponent);
                f_poNeighbour();
                f_cf01Down();
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_09_BV
            
            // TODO TP_SEC_ITSS_SND_CERT_10_BV
            
            /**
             * @desc    Check that the validityPeriod of the subordinate certificate is inside the validityPeriod 
             *          of the issuing certificate.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the CA is authorized with AA certificate 
             *          containing toBeSigned
             *              containing validityPeriod
             *                  containing start
             *                      indicating X_START_VALIDITY_AA
             *                  and containing duration
             *                      indicating X_START_DURATION_AA
             *  }
             *  ensure that {
             *      when {
             *          the IUT issued the certificate 
             *      } then {
             *          this certificate is of type EtsiTs103097Certificate
             *              containing signedData
             *                  containing validityPeriod
             *                      containing start
             *                          indicating X_START_VALIDITY_AT ( X_START_VALIDITY_AT >= X_START_VALIDITY_AA )
             *                      and containing duration
             *                          X_DURATION_AT <= X_START_VALIDITY_AA + X_DURATION_AA
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_11_BV
             * @reference   ETSI TS 103 097 [1], Clauses 5.2 & 7.1.3
             * @reference   IEEE 1609.2 [2], Clauses 5.3.1, 6.3.4, 6.3.29, 6.3.30, 6.3.31
             */
            testcase TC_SEC_ITSS_SND_CERT_11_BV() runs on ItsGeoNetworking system ItsSecSystem {
                    
                // Local variables
                var EtsiTs103097Certificate v_aa_certificate;
                var EtsiTs103097Certificate v_at_certificate;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                    
                // Test adapter configuration
                
                // Preamble
                f_readCertificate(cc_taCert_CC_AA, v_aa_certificate); // TODO Use PIXIT as array of strings to change 
                                                                      // certificates to be checked
                f_readCertificate(cc_iutCert_A, v_at_certificate);
                
                // Test Body
                // 1. Check certificate format
                if (
                    (v_aa_certificate.toBeSigned.validityPeriod.start_ >= v_at_certificate.toBeSigned.validityPeriod.start_) and 
                    (f_duration2time(v_at_certificate.toBeSigned.validityPeriod.duration) <= (v_aa_certificate.toBeSigned.validityPeriod.start_ + f_duration2time(v_aa_certificate.toBeSigned.validityPeriod.duration)))
                ) {
                    log("*** " & testcasename() & ": PASS: Validity periods are correct ***");
                    setverdict(pass);
                } else {
                    log("*** " & testcasename() & ": FAIL: Invalid validity period ***");
                    setverdict(fail);
                } // End of 'alt' statement
                                
                // Postamble
                
            } // End of testcase TC_SEC_ITSS_SND_CERT_11_BV
            
            /**
             * @desc    Check that the certificate signature contains ECC point of type set to 
             *          either compressed_lsb_y_0, compressed_lsb_y_1 or x_coordinate_only.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT is authorized with AT certificate (X_CERTIFICATE) 
             *  }
             *  ensure that {
             *      when {
             *          the IUT issued the certificate 
             *      } then {
             *          this certificate is of type EtsiTs103097Certificate
             *              containing signature
             *                  containing X_SIGNATURE
             *                       containing rSig
             *                           containing x-only
             *                           or containing compressed-y-0
             *                           or containing compressed-y-1
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_12_BV
             * @reference    IEEE 1609.2 [2], Clauses 6.3.29, 6.3.30, 6.3.31
             */
            testcase TC_SEC_ITSS_SND_CERT_12_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var GeoNetworkingInd        v_geoNwInd;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaNistP256(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_x_only
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaNistP256(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_compressed_y_0
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaNistP256(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_compressed_y_1
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP256r1(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_x_only
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP256r1(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_compressed_y_0
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP256r1(
                                            mw_ecdsaP256Signature(
                                                mw_eccP256CurvePoint_compressed_y_1
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP384r1(
                                            mw_ecdsaP384Signature(
                                                mw_eccP384CurvePoint_x_only
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP384r1(
                                            mw_ecdsaP384Signature(
                                                mw_eccP384CurvePoint_compressed_y_0
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        -,
                                        mw_signature_ecdsaBrainpoolP384r1(
                                            mw_ecdsaP384Signature(
                                                mw_eccP384CurvePoint_compressed_y_1
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Message with wrong signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Message with certificate not received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                    }
                } // End of 'alt' statement
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
            } // End of testcase TC_SEC_ITSS_SND_CERT_12_BV
            
            /**
             * @desc    Check that the certificate verification key contains ECC point of type set to either 
             *          compressed_lsb_y_0, compressed_lsb_y_1 or uncompressed.
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *  }
             *  ensure that {
             *      when {
             *          the IUT issued the certificate 
             *      } then {
             *          this certificate is of type EtsiTs103097Certificate
             *              containing toBeSigned 
             *                  containing verifyKeyIndicator
             *                       containing verificationKey
             *                           containing uncompressed
             *                           or containing compressed-y-0
             *                           or containing compressed-y-1
             *      }
             *  }
             * </pre>
             *
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_13_BV
             * @reference    IEEE 1609.2 [2], Clauses 6.3.29, 6.3.30, 6.3.31
             */
            testcase TC_SEC_ITSS_SND_CERT_13_BV() runs on ItsGeoNetworking system ItsSecSystem {
                // Local variables
                var GeoNetworkingInd        v_geoNwInd;
                
                // Test control
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
                
                // Test component configuration
                vc_hashedId8ToBeUsed := PICS_CERTFICATE_ID_VARIANT;
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaNistP256(
                                                            mw_eccP256CurvePoint_uncompressed
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaNistP256(
                                                            mw_eccP256CurvePoint_compressed_y_0
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_NIST_P256 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaNistP256(
                                                            mw_eccP256CurvePoint_compressed_y_1
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaBrainpoolP256r1(
                                                            mw_eccP256CurvePoint_uncompressed
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaBrainpoolP256r1(
                                                            mw_eccP256CurvePoint_compressed_y_0
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P256R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaBrainpoolP256r1(
                                                            mw_eccP256CurvePoint_compressed_y_1
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaBrainpoolP384r1(
                                                            mw_eccP384CurvePoint_uncompressed
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaBrainpoolP384r1(
                                                            mw_eccP384CurvePoint_compressed_y_0
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [PICS_SEC_BRAINPOOL_P384R1 == true] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at(
                                                    -, 
                                                    mw_verificationKeyIndicator_verificationKey(
                                                        mw_publicVerificationKey_ecdsaBrainpoolP384r1(
                                                            mw_eccP384CurvePoint_compressed_y_1
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                ), 
                                mw_geoNwShbPacket
                    ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Message with well-formated signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(
                            mw_geoNwSecPdu(
                                mw_etsiTs103097Data_signed(
                                    mw_signedData(
                                        -, 
                                        mw_toBeSignedData(
                                            mw_signedDataPayload,
                                            mw_headerInfo_cam
                                        ),
                                        mw_signerIdentifier_certificate(
                                            mw_etsiTs103097Certificate(
                                                -,
                                                mw_toBeSignedCertificate_at
                                    )
                                )
                    ))))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Message with wrong signature received ***");
Yann Garcia's avatar
Yann Garcia committed
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    [] geoNetworkingPort.receive(
                        mw_geoNwInd(