ItsSecurity_TestCases.ttcn3 1.4 MB
Newer Older
garciay's avatar
garciay committed
8001
8002
8003
8004
8005
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    f_cf01Down();
garciay's avatar
garciay committed
8006
                } // End of testcase TC_SEC_ITSS_SND_CERT_AT_05_01_BV
garciay's avatar
garciay committed
8007
8008
                
                /**
garciay's avatar
garciay committed
8009
8010
8011
                 * @desc Check that all AIDs containing in the its_aid_ssp_list in AT certificate are unique 
                 *       Check that all AIDs containing in the its_aid_ssp_list in AT certificate are also containing in the 
                 *       its_aid_list in the correspondent AA certificate
garciay's avatar
garciay committed
8012
                 *       Check that the length of SSP of each AID is 31 octet maximum
garciay's avatar
garciay committed
8013
                 * <pre>
garciay's avatar
garciay committed
8014
                 * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
8015
8016
8017
8018
8019
8020
8021
8022
8023
                 * Config Id: CF01
                 * with {
                 *   the IUT being in the 'authorized' state
                 *   the IUT being requested to include certificate chain in the next CAM
                 * } ensure that {
                 *    when {
                 *     the IUT is requested to send a CAM
                 *   } then {
                 *     the IUT sends a SecuredMessage
garciay's avatar
garciay committed
8024
                 *       containing header_fields['signer_info'].signer
garciay's avatar
garciay committed
8025
                 *         containing type
garciay's avatar
garciay committed
8026
                 *           indicating 'certificate_chain'
garciay's avatar
garciay committed
8027
                 *         containing certificates[last-1] 
garciay's avatar
garciay committed
8028
8029
8030
8031
8032
                 *           containing subject_info.subject_type
                 *             indicating 'authorization_authority' (2)
                 *           containing subject_attributes['its_aid_list']
                 *             containing its_aid_list[0..N]
                 *               indicating ITS_AID_LIST_AA
garciay's avatar
garciay committed
8033
                 *         containing certificates[last] 
garciay's avatar
garciay committed
8034
8035
8036
                 *           containing subject_info.subject_type
                 *             indicating 'authorization_ticket' (1)
                 *           containing subject_attributes['its_aid_ssp_list']
garciay's avatar
garciay committed
8037
8038
                 *             containing its_aid_ssp_list[0..N] 
                 *               containing its_aid_ssp_list[n]
garciay's avatar
garciay committed
8039
8040
8041
8042
8043
8044
8045
                 *                 containing its_aid
                 *                   indicating unique value containing in the  ITS_AID_LIST_AA
                 *                 containing service_specific_permissions
                 *                   indicating length <= 31 octet
                 *   }
                 * }
                 * </pre>
garciay's avatar
garciay committed
8046
                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AT_07_01_BV
garciay's avatar
garciay committed
8047
                 * @reference   ETSI TS 103 097 [1], clauses 6.9 and 7.4.2
garciay's avatar
garciay committed
8048
                 */
garciay's avatar
garciay committed
8049
                testcase TC_SEC_ITSS_SND_CERT_AT_07_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
8050
8051
8052
8053
8054
8055
8056
                    var CertificateChain         v_chain;
                    var Certificate              v_aa_cert, v_at_cert;
                    var SubjectAttribute         v_sa;
                    var IntXs                    v_aid_list;
                    var ItsAidSsps               v_aid_ssp_list;
                    
                    // Test control
garciay's avatar
garciay committed
8057
8058
                    if (not(PICS_GN_SECURITY)) {
                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
garciay's avatar
garciay committed
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
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf01Up();
                    
                    // Test adapter configuration
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    
                    // Test Body
                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
                    tc_ac.start;
                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
                    }
                    tc_ac.stop;
                    if (lengthof(v_chain) < 2) {
                        log("*** " & testcasename() & ": FAIL: Certificate chain is too short ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
                    }
                    v_aa_cert := v_chain[lengthof(v_chain) - 2];
                    v_at_cert := v_chain[lengthof(v_chain) - 1];
                    if (not f_getCertificateSubjectAttribute(v_aa_cert, e_its_aid_list, v_sa)) {
                        log("*** " & testcasename() & ": FAIL: AA certificate does not contain its_aid_list subject attribute ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    v_aid_list := v_sa.attribute.its_aid_list;
                    
                    if (not f_getCertificateSubjectAttribute(v_at_cert, e_its_aid_ssp_list, v_sa)) {
                        log("*** " & testcasename() & ": FAIL: AA certificate does not contain its_aid_list subject attribute ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    v_aid_ssp_list := v_sa.attribute.its_aid_ssp_list;
                    
                    for (var integer v_counter :=0; v_counter < lengthof(v_aid_ssp_list); v_counter := v_counter + 1) {
                        // Check unique
                        for (var integer j :=0; j < lengthof(v_aid_ssp_list); j := j + 1) {
                            if (v_counter != j and v_aid_ssp_list[v_counter].its_aid == v_aid_ssp_list[j].its_aid) {
                                log("*** " & testcasename() & ": FAIL: ITS-AID " & int2str(v_aid_ssp_list[v_counter].its_aid) & " is duplicated in AT certificate ***");
                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                            }
                        } // End of 'for' statement
garciay's avatar
garciay committed
8105
8106
8107
8108
//                        if (not match(v_aid_ssp_list[v_counter], (all from v_aid_list))) {
//                            log("*** " & testcasename() & ": FAIL: ITS-AID " & int2str(v_aid_ssp_list[v_counter].its_aid) & " is not exist in AA certificate ***");
//                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                        }
garciay's avatar
garciay committed
8109
                        // TODO Not possible due to typing To be removed
garciay's avatar
garciay committed
8110
8111
8112
8113
//                        if (lengthof(v_aid_ssp_list[v_counter].service_specific_permissions.sspContainer) > 31) {
//                            log("*** " & testcasename() & ": FAIL: ITS-AID " & int2str(v_aid_ssp_list[v_counter].its_aid) & " has too long service_specific_permissions ***");
//                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
//                        }
garciay's avatar
garciay committed
8114
8115
8116
8117
8118
8119
8120
8121
                    } // End of 'for' statement
                    
                    log("*** " & testcasename() & ": PASS: The ITS_AID_SSP list of the AT certificate is good ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    f_cf01Down();
garciay's avatar
garciay committed
8122
                } // End of testcase TC_SEC_ITSS_SND_CERT_AT_07_01_BV
garciay's avatar
garciay committed
8123
8124
8125
8126
                
                /**
                 * @desc Check that AT certificate is signed by AA cert
                 * <pre>
garciay's avatar
garciay committed
8127
                 * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
8128
8129
8130
8131
8132
8133
                 * Config Id: CF01
                 * with {
                 *   the IUT being in the 'authorized' state
                 *   the IUT being requested to include certificate chain in the next CAM
                 * } ensure that {
                 *    when {
garciay's avatar
garciay committed
8134
                 *     the IUT is requested to send a CAM
garciay's avatar
garciay committed
8135
8136
                 *   } then {
                 *     the IUT sends a SecuredMessage
garciay's avatar
garciay committed
8137
                 *       containing header_fields['signer_info'].signer
garciay's avatar
garciay committed
8138
                 *         containing type
garciay's avatar
garciay committed
8139
8140
                 *           indicating 'certificate_chain'
                 *         containing certificates[last-1] (CERT_AA)
garciay's avatar
garciay committed
8141
8142
8143
                 *           containing subject_info.subject_type
                 *             indicating 'authorization_authority' (2)
                 *           and containing subject_attributes['verification key'] (KEY)
garciay's avatar
garciay committed
8144
                 *         containing certificates[last] 
garciay's avatar
garciay committed
8145
8146
                 *           containing subject_info.subject_type
                 *             indicating 'authorization_ticket' (1)
garciay's avatar
garciay committed
8147
                 *           and containing signer_info[0]
garciay's avatar
garciay committed
8148
8149
8150
8151
8152
8153
8154
8155
8156
                 *             containing type
                 *               indicating 'certificate_digest_with_sha256'
                 *             containing digest
                 *               referencing to CERT_AA
                 *           and containing signature
                 *             verifiable using KEY
                 *   }
                 * }
                 * </pre>
garciay's avatar
garciay committed
8157
                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AT_08_01_BV
garciay's avatar
garciay committed
8158
8159
                 * @reference   ETSI TS 103 097 [1], clause 6.3
                 */
garciay's avatar
garciay committed
8160
                testcase TC_SEC_ITSS_SND_CERT_AT_08_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
8161
8162
8163
8164
8165
                    var CertificateChain         v_chain;
                    var Certificate              v_aa_cert, v_at_cert;
                    var HashedId8                v_aa_digest;
                    
                    // Test control
garciay's avatar
garciay committed
8166
8167
                    if (not(PICS_GN_SECURITY)) {
                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
garciay's avatar
garciay committed
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
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf01Up();
                    
                    // Test adapter configuration
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    
                    
                    // Test Body
                    log("*** " & testcasename() & ": INFO: Request and waiting for the message containing certificate chain  ***");
                    tc_ac.start;
                    if (not f_askAndWaitForCertificateChain(v_chain, f_generateDefaultCam())) {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
                    }
                    tc_ac.stop;
                    if (lengthof(v_chain) < 2) {
                        log("*** " & testcasename() & ": FAIL: Certificate chain is too short ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
                    }
                    v_at_cert := v_chain[lengthof(v_chain) - 1];
                    v_aa_cert := v_chain[lengthof(v_chain) - 2];
                    v_aa_digest := f_calculateDigestFromCertificate(v_aa_cert); 
                    
                    if (not match(v_at_cert, mw_at_certificate(mw_signerInfo_digest(v_aa_digest)))) {
                        log("*** " & testcasename() & ": FAIL: AT certificate signer info doesn't reference the  AA certificate from the chain ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    
                    if (not f_verifyCertificateSignatureWithIssuingCertificate(v_at_cert, v_aa_cert)) {
                        log("*** " & testcasename() & ": FAIL: AT certificate signature verification failed ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                    
                    log("*** " & testcasename() & ": PASS: AT certificate was signed by the AA certificate from the given chain ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    f_cf01Down();
garciay's avatar
garciay committed
8213
8214
                } // End of testcase TC_SEC_ITSS_SND_CERT_AT_08_01_BV
                
garciay's avatar
garciay committed
8215
                /**
garciay's avatar
garciay committed
8216
                 * @desc Check that all necessary validity restrictions are present and arranged in ascending order 
garciay's avatar
garciay committed
8217
                 * <pre>
garciay's avatar
garciay committed
8218
                 * Pics Selection: PICS_GN_SECURITY
garciay's avatar
garciay committed
8219
8220
8221
                 * Config Id: CF01
                 * with {
                 *   the IUT being in the 'authorized' state
garciay's avatar
garciay committed
8222
                 *   the IUT being requested to include certificate in the next CAM
garciay's avatar
garciay committed
8223
8224
8225
8226
8227
                 * } ensure that {
                 *    when {
                 *     the IUT is requested to send a CAM
                 *   } then {
                 *     the IUT sends a SecuredMessage
garciay's avatar
garciay committed
8228
                 *       containing header_fields['signer_info'].signer
garciay's avatar
garciay committed
8229
                 *         containing type
garciay's avatar
garciay committed
8230
8231
8232
8233
8234
8235
8236
                 *           indicating 'certificate'
                 *         containing certificate
                 *           containing subject_attributes [0..N]
                 *             indicating subject_attributes[n].type < subject_attributes[n+ 1].type
                 *             containing subject_attributes['verification_key']
                 *             containing subject_attributes['assurance_level']
                 *             containing subject_attributes['its_aid_ssp_list']
garciay's avatar
garciay committed
8237
8238
8239
                 *   }
                 * }
                 * </pre>
garciay's avatar
garciay committed
8240
                 * @see         ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CERT_AT_10_01_BV
garciay's avatar
garciay committed
8241
                 * @reference   ETSI TS 103 097 [1], clauses 6.1
garciay's avatar
garciay committed
8242
                 */
garciay's avatar
garciay committed
8243
                testcase TC_SEC_ITSS_SND_CERT_AT_10_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
garciay's avatar
garciay committed
8244
8245
8246
                    var Certificate             v_at_cert;
                    var ValidityRestriction     v_vr;
                    var ValidityRestrictions    v_vrs;
garciay's avatar
garciay committed
8247
8248
                    
                    // Test control
garciay's avatar
garciay committed
8249
8250
                    if (not(PICS_GN_SECURITY)) {
                        log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
garciay's avatar
garciay committed
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf01Up();
                    
                    // Test adapter configuration
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    
                    // Test Body
garciay's avatar
garciay committed
8264
                    log("*** " & testcasename() & ": INFO: Waiting for the message containing certificate  ***");
garciay's avatar
garciay committed
8265
                    tc_ac.start;
garciay's avatar
garciay committed
8266
                    if (not f_waitForCertificate(v_at_cert)) {
garciay's avatar
garciay committed
8267
8268
8269
8270
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
                    }
                    tc_ac.stop;
garciay's avatar
garciay committed
8271
8272
8273
8274
8275
                    if (not match(
                        v_at_cert, 
                            mw_at_certificate(
                                mw_signerInfo_certificate
                     ))) {
garciay's avatar
garciay committed
8276
8277
                    }
                    
garciay's avatar
garciay committed
8278
8279
                    if (true != f_getCertificateValidityRestriction(v_at_cert.signer_info.signerInfo.certificate, e_time_start_and_end, v_vr)) {
                        log("*** " & testcasename() & ": FAIL: Required 'time_start_and_end' validity_restriction attribute of AT certificate is not found ***");
garciay's avatar
garciay committed
8280
8281
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
garciay's avatar
garciay committed
8282
8283
8284
8285
8286
8287
8288
                    v_vrs := v_at_cert.signer_info.signerInfo.certificate.validity_restrictions;
                    for (var integer v_counter := 1; v_counter < lengthof(v_vrs); v_counter := v_counter + 1 ) {
                        if (v_vrs[v_counter].type_ <= v_vrs[v_counter-1].type_) {
                            log("*** " & testcasename() & ": FAIL: AT certificate subject attributes are not arranged in ascending order ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        }
                    } // End of 'for' statement
garciay's avatar
garciay committed
8289
                    
garciay's avatar
garciay committed
8290
8291
                    log("*** " & testcasename() & ": PASS: All required AT certificate subject attributes are presents and arranged in ascending order ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
garciay's avatar
garciay committed
8292
8293
8294
8295
                    
                    // Postamble
                    f_poNeighbour();
                    f_cf01Down();
garciay's avatar
garciay committed
8296
                } // End of testcase TC_SEC_ITSS_SND_CERT_AT_10_01_BV
garciay's avatar
garciay committed
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
                
            } // End of group AT_Certificates 
            
        } // End of group sendCertificatesProfile
    
    } // End of group sendingBehavior
    
    /**
     * @desc Receiver behaviour test cases
     * @see ETSI TS 103 096-2 V1.2.2 (2016-01) Clause 5.3 Receiver behaviour
     */
    group receiverBehavior {
        
        /**
garciay's avatar
garciay committed
8311
         * @desc Receiving behaviour test cases for CAM profile
garciay's avatar
garciay committed
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
         * @see ETSI TS 103 096-2 V1.2.2 (2016-01) Clause 5.3.2 CAM Profile
         */
        group recvCamProfile {
            
            /**
             * @desc    Check that IUT accepts a well-formed Secured CAM containing certificate in signer_info
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
garciay's avatar
garciay committed
8324
             *      and the IUT current time is inside the time validity period of CERT_TS_A_AT
garciay's avatar
garciay committed
8325
8326
8327
8328
8329
8330
8331
8332
8333
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *              containing protocol_version 
             *                  indicating value '2'
             *              and containing header_fields[0]
             *                  containing type 
             *                      indicating 'signer_info'
garciay's avatar
garciay committed
8334
             *                  and containing signer 
garciay's avatar
garciay committed
8335
8336
             *                      containing type
             *                          indicating 'certificate'
garciay's avatar
garciay committed
8337
             *                      and containing certificate (CERT_TS_AT_A)
garciay's avatar
garciay committed
8338
8339
8340
             *                          containing subject_info.subject_type
             *                              indicating 'authorization_ticket' (2)
             *                          and containing subject_attributes['verification key'] (KEY)
garciay's avatar
garciay committed
8341
             *              and containing header_fields [1]
garciay's avatar
garciay committed
8342
8343
8344
8345
             *                  containing type
             *                      indicating 'generation_time'
             *                  containing generation_time
             *                      indicating CURRENT_TIME
garciay's avatar
garciay committed
8346
             *              and containing header_fields[2] 
garciay's avatar
garciay committed
8347
8348
8349
8350
8351
             *                  containing type
             *                      indicating 'its_aid'
             *                  containing its_aid
             *                      indicating 'AID_CAM'
             *              and not containing any other header fields
garciay's avatar
garciay committed
8352
             *              and containing payload_field 
garciay's avatar
garciay committed
8353
8354
8355
8356
8357
             *                  containing type
             *                      indicating 'signed'
             *                  containing data
             *                      indicating length > 0
             *                      containing CAM payload
garciay's avatar
garciay committed
8358
8359
             *              and containing trailer_fields 
             *                  containing single instance of type TrailerField
garciay's avatar
garciay committed
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
             *                      containing type
             *                          indicating 'signature'
             *                      containing signature
             *                          verifiable using KEY
             *      } then {
             *          the IUT accepts the message
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
8370
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_01_01_BV
garciay's avatar
garciay committed
8371
8372
8373
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
            testcase TC_SEC_ITSS_RCV_CAM_01_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
8374
8375
8376
8377
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
8378
8379
8380
8381
8382
8383
8384
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
8385
                
garciay's avatar
garciay committed
8386
                // Test component configuration
8387
8388
                f_cf01Up();
                
8389
8390
                // Test adapter configuration
                
8391
8392
8393
8394
8395
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
8396
                v_securedGnPdu := f_sendSecuredCam(cc_taCert_A, omit, e_certificate);
8397
8398
                
                f_sleep(PX_TNOAC);
8399
8400
                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
8401
                    // Empty on purpose 
8402
8403
                }
                if (i < lengthof(vc_utInds)) {
garciay's avatar
garciay committed
8404
8405
                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
8406
8407
                }
                else {
garciay's avatar
garciay committed
8408
8409
                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
8410
8411
8412
8413
8414
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
8415
8416
            } // End of testcase TC_SEC_ITSS_RCV_CAM_01_01_BV
            
8417
            /**
garciay's avatar
garciay committed
8418
8419
8420
8421
8422
8423
8424
             * @desc    Check that IUT accepts a well-formed Secured CAM containing certificate digest of the known certificate in signer_info
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
garciay's avatar
garciay committed
8425
8426
             *      and the IUT current time is inside the time validity period of CERT_TS_A_AT
             *      and the IUT already sent a Secured message containing certificate (CERT_TS_A_AT)
garciay's avatar
garciay committed
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
             *          containing subject_info.subject_type
             *              indicating 'authorization_ticket' (2)
             *          and containing subject_attributes['verification key'] (KEY)
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *              containing protocol_version 
             *                  indicating value '2'
             *              and containing header_fields[0]
             *                  containing type 
             *                      indicating 'signer_info'
garciay's avatar
garciay committed
8439
             *                  and containing signer
garciay's avatar
garciay committed
8440
8441
8442
             *                      containing type
             *                          indicating 'certificate_digest_with_sha256'
             *                      and containing digest
garciay's avatar
garciay committed
8443
             *                          referencing to certificate (CERT_TS_A_AT)
garciay's avatar
garciay committed
8444
             *              and containing header_fields [1]
garciay's avatar
garciay committed
8445
8446
8447
8448
             *                  containing type
             *                      indicating 'generation_time'
             *                  containing generation_time
             *                      indicating CURRENT_TIME
garciay's avatar
garciay committed
8449
             *              and containing header_fields[2]
garciay's avatar
garciay committed
8450
8451
8452
8453
8454
             *                  containing type
             *                      indicating 'its_aid'
             *                  containing its_aid
             *                      indicating 'AID_CAM'
             *              and not containing any other header fields
garciay's avatar
garciay committed
8455
             *              and containing payload_field 
garciay's avatar
garciay committed
8456
8457
8458
8459
8460
             *                  containing type
             *                      indicating 'signed'
             *                  containing data
             *                      indicating length > 0
             *                      containing CAM payload
garciay's avatar
garciay committed
8461
8462
             *              and containing trailer_fields
             *                  containing single instance of type TrailerField
garciay's avatar
garciay committed
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
             *                      containing type
             *                          indicating 'signature'
             *                      containing signature
             *                          verifiable using KEY
             *      } then {
             *          the IUT accepts the message
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
8473
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_01_02_BV
garciay's avatar
garciay committed
8474
8475
8476
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
            testcase TC_SEC_ITSS_RCV_CAM_01_02_BV() runs on ItsGeoNetworking system ItsSecSystem {
8477
8478
8479
8480
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
8481
8482
8483
8484
8485
8486
8487
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
8488
                
garciay's avatar
garciay committed
8489
                // Test component configuration
8490
8491
                f_cf01Up();
                
8492
8493
                // Test adapter configuration
                
8494
8495
8496
8497
8498
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
8499
                v_securedGnPdu := f_sendSecuredCam(cc_taCert_A, omit, e_certificate_digest_with_sha256);
8500
8501
                
                f_sleep(PX_TNOAC);
8502
8503
                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
8504
                    // Empty on purpose 
8505
8506
                }
                if (i < lengthof(vc_utInds)) {
garciay's avatar
garciay committed
8507
8508
                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
8509
8510
                }
                else {
garciay's avatar
garciay committed
8511
8512
                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
8513
8514
8515
8516
8517
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
8518
            } // End of testcase TC_SEC_ITSS_RCV_CAM_01_02_BV
8519
8520
            
            /**
garciay's avatar
garciay committed
8521
8522
8523
8524
8525
8526
8527
             * @desc    Check that IUT accepts a well-formed Secured CAM containing certificate chain in signer_info
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
garciay's avatar
garciay committed
8528
             *      and the IUT current time is inside the time validity period of CERT_TS_A_AT
garciay's avatar
garciay committed
8529
8530
8531
8532
8533
8534
8535
8536
8537
             *  }
             *  ensure that {
             *      when { 
             *          the IUT is receiving a SecuredMessage
             *              containing protocol_version 
             *                  indicating value '2'
             *              and containing header_fields[0]
             *                  containing type 
             *                      indicating 'signer_info'
garciay's avatar
garciay committed
8538
             *                  and containing signer
garciay's avatar
garciay committed
8539
8540
8541
             *                      containing type
             *                          indicating 'certificate_chain'
             *                      and containing certificates
garciay's avatar
garciay committed
8542
             *                          containing certificate (CERT_TS_A_AA) at index 0 
garciay's avatar
garciay committed
8543
8544
             *                              containing subject_info.subject_type
             *                                  indicating 'authorization_authority'
garciay's avatar
garciay committed
8545
8546
             *                              and containing subject_attributes['verification key'] (KEY_TS_AA)
             *                          and containing certificate (CERT_TS_A_AT) at index 1 
garciay's avatar
garciay committed
8547
8548
             *                              containing subject_info.subject_type
             *                                  indicating 'authorization_ticket'
garciay's avatar
garciay committed
8549
             *                              and containing signer_info 
garciay's avatar
garciay committed
8550
8551
8552
             *                                  containing type
             *                                      indicating 'certificate_digest_with_sha256'
             *                                  containing digest
garciay's avatar
garciay committed
8553
             *                                      referencing to the CERT_TS_A_AA
garciay's avatar
garciay committed
8554
             *                              and containing signature
garciay's avatar
garciay committed
8555
8556
             *                                  verifiable using KEY_TS_AA
             *                              and containing subject_attributes['verification key'] (KEY_TS_AT)
garciay's avatar
garciay committed
8557
             *              and containing header_fields [1] 
garciay's avatar
garciay committed
8558
8559
8560
8561
             *                  containing type
             *                      indicating 'generation_time'
             *                  containing generation_time
             *                      indicating CURRENT_TIME
garciay's avatar
garciay committed
8562
             *              and containing header_fields[2] 
garciay's avatar
garciay committed
8563
8564
8565
8566
8567
             *                  containing type
             *                      indicating 'its_aid'
             *                  containing its_aid
             *                      indicating 'AID_CAM'
             *              and not containing any other header fields
garciay's avatar
garciay committed
8568
             *              and containing payload_field 
garciay's avatar
garciay committed
8569
8570
8571
8572
8573
             *                  containing type
             *                      indicating 'signed'
             *                  containing data
             *                      indicating length > 0
             *                      containing CAM payload
garciay's avatar
garciay committed
8574
8575
             *              and containing trailer_fields 
             *                  containing single instance of type TrailerField 
garciay's avatar
garciay committed
8576
8577
8578
             *                      containing type
             *                          indicating 'signature'
             *                      containing signature
garciay's avatar
garciay committed
8579
             *                          verifiable using KEY_TC_AT
garciay's avatar
garciay committed
8580
8581
8582
8583
8584
8585
             *      } then {
             *          the IUT accepts the message
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
8586
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_01_03_BV
garciay's avatar
garciay committed
8587
8588
8589
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
            testcase TC_SEC_ITSS_RCV_CAM_01_03_BV() runs on ItsGeoNetworking system ItsSecSystem {
8590
8591
8592
8593
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
8594
8595
8596
8597
8598
8599
8600
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
8601
                
garciay's avatar
garciay committed
8602
                // Test component configuration
8603
8604
                f_cf01Up();
                
8605
8606
                // Test adapter configuration
                
8607
8608
8609
8610
8611
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
8612
                v_securedGnPdu := f_sendSecuredCam(cc_taCert_A, -, e_certificate_chain);
8613
8614
                
                f_sleep(PX_TNOAC);
8615
8616
                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
8617
                    // Empty on purpose 
8618
8619
                }
                if (i < lengthof(vc_utInds)) {
garciay's avatar
garciay committed
8620
8621
                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
8622
8623
                }
                else {
garciay's avatar
garciay committed
8624
8625
                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
8626
                }
garciay's avatar
garciay committed
8627
                 
8628
8629
8630
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
8631
            } // End of testcase TC_SEC_ITSS_RCV_CAM_01_03_BV
8632
8633
            
            /**
garciay's avatar
garciay committed
8634
8635
8636
8637
8638
8639
8640
             * @desc    Check that IUT discards a Secured CAM containing protocol version set to a value less then 2
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
garciay's avatar
garciay committed
8641
             *      and the IUT current time is inside the time validity period of CERT_TS_A_AT
garciay's avatar
garciay committed
8642
8643
8644
             *  }
             *  ensure that {
             *      when { 
garciay's avatar
garciay committed
8645
             *          the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_01)
garciay's avatar
garciay committed
8646
8647
8648
8649
8650
8651
8652
8653
             *              containing protocol_version 
             *                  indicating 1
             *      } then {
             *          the IUT discards a SecuredMessage
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
8654
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_02_01_BO
garciay's avatar
garciay committed
8655
             * @reference    ETSI TS 103 097 [1], clause 5.1
garciay's avatar
garciay committed
8656
8657
             */
            testcase TC_SEC_ITSS_RCV_CAM_02_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
8658
8659
8660
8661
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
8662
8663
8664
8665
8666
8667
8668
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
8669
                
garciay's avatar
garciay committed
8670
                // Test component configuration
8671
8672
                f_cf01Up();
                
8673
8674
                // Test adapter configuration
                
8675
8676
8677
8678
8679
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
8680
                v_securedGnPdu := f_sendSecuredCam_Bo(cc_taCert_A, PX_WRONG_PROTOCOL_VERSION);
8681
8682
                
                f_sleep(PX_TNOAC);
8683
8684
                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
8685
                    // Empty on purpose 
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
                }
                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
8699
            } // End of testcase TC_SEC_ITSS_RCV_CAM_02_01_BO
8700
8701
            
            /**
garciay's avatar
garciay committed
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
             * @desc    Check that IUT discards a Secured CAM containing protocol version set to a value greater then 2
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the 'authorized' state
             *  }
             *  ensure that {
             *      when { 
garciay's avatar
garciay committed
8712
             *          the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_01)
garciay's avatar
garciay committed
8713
8714
8715
8716
8717
8718
8719
8720
             *              containing protocol_version 
             *                  indicating 3
             *      } then {
             *          the IUT discards a SecuredMessage
             *      }
             *  }
             * </pre>
             *
garciay's avatar
garciay committed
8721
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_02_02_BO
garciay's avatar
garciay committed
8722
             * @reference    ETSI TS 103 097 [1], clause 5.1
garciay's avatar
garciay committed
8723
8724
             */
            testcase TC_SEC_ITSS_RCV_CAM_02_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
8725
8726
8727
8728
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
8729
8730
8731
8732
8733
8734
8735
8736
                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
8737
                // Test component configuration
8738
8739
                f_cf01Up();
                
8740
8741
                // Test adapter configuration
                
8742
8743
8744
8745
8746
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
8747
                v_securedGnPdu := f_sendSecuredCam_Bo(cc_taCert_A, PX_WRONG_PROTOCOL_VERSION); // Change PX_WRONG_PROTOCOL_VERSION to 3
8748
8749
                
                f_sleep(PX_TNOAC);
8750
8751
                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
8752
                    // Empty on purpose 
8753
                }
garciay's avatar
garciay committed
8754
                if (i < lengthof(vc_utInds)) {
8755
8756
8757
8758
8759
8760
8761
                    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);
                }
garciay's avatar
garciay committed
8762
                
8763
8764
8765
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
8766
            } // End of testcase TC_SEC_ITSS_RCV_CAM_02_02_BO
8767
8768
            
            /**
garciay's avatar
garciay committed
8769
8770
8771
8772
8773
8774
8775
             * @desc    Check that IUT discards a secured CAM if the header_fields contains more than one element of header field type: signer_info
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             * with { 
             *  the IUT being in the 'authorized' state 
garciay's avatar
garciay committed
8776
             *  and the IUT current time is inside the time validity period of CERT_TS_A_AT
garciay's avatar
garciay committed
8777
8778
             * } 
             * ensure that { 
garciay's avatar
garciay committed
8779
8780
             *  when { 
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_01) 
garciay's avatar
garciay committed
8781
8782
8783
8784
8785
8786
             *          containing header_fields[0].type
             *              indicating 'signer_info'
             *          and containing header_fields[1].type
             *              indicating 'signer_info'
             *          and containing header_fields[2].type
             *              indicating 'generation_time'
garciay's avatar
garciay committed
8787
             *          and containing header_fields[3]
garciay's avatar
garciay committed
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
             *              containing type
             *                  indicating 'its_aid'
             *              containing its_aid
             *                  indicating 'AID_CAM'
             *          and not containing other header fields
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
garciay's avatar
garciay committed
8799
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_04_01_BO
garciay's avatar
garciay committed
8800
8801
8802
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
            testcase TC_SEC_ITSS_RCV_CAM_04_01_BO() runs on ItsGeoNetworking system ItsSecSystem {
8803
8804
8805
8806
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
8807
8808
8809
8810
8811
8812
8813
8814
                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
8815
                // Test component configuration
8816
8817
                f_cf01Up();
                
8818
8819
                // Test adapter configuration
                
8820
8821
8822
8823
8824
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
8825
8826
8827
8828
8829
8830
8831
8832
8833
                v_securedGnPdu := f_prepareSecuredCam(
                    cc_taCert_A, 
                    {
                        m_header_field_signer_info(
                            m_signerInfo_digest(
                                vc_atCertificate.signer_info.signerInfo.digest
                        )), 
                        m_header_field_signer_info(
                            m_signerInfo_certificate(
8834
                                vc_atCertificate
garciay's avatar
garciay committed
8835
8836
8837
8838
8839
8840
8841
8842
                        )), 
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_its_aid_CAM
                    }, 
                    e_certificate_digest_with_sha256,
                    false
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
8843
8844
                
                f_sleep(PX_TNOAC);
8845
8846
                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
8847
                    // Empty on purpose 
garciay's avatar
garciay committed
8848
8849
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
8850
8851
8852
8853
8854
8855
8856
                    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);
                }
garciay's avatar
garciay committed
8857
                
8858
8859
8860
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
8861
8862
            } // End of testcase TC_SEC_ITSS_RCV_CAM_04_01_BO
            
8863
            /**
garciay's avatar
garciay committed
8864
8865
8866
8867
8868
8869
             * @desc    Check that IUT discards a secured CAM if the header_fields does not contain the header field type: signer_info
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             * with { 
garciay's avatar
garciay committed
8870
8871
             *    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
8872
8873
8874
             * } 
             * ensure that { 
             *  when {  
garciay's avatar
garciay committed
8875
             *      the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_01) 
garciay's avatar
garciay committed
8876
8877
             *          containing header_fields[0].type
             *              indicating 'generation_time'
garciay's avatar
garciay committed
8878
             *          and containing header_fields[1]
garciay's avatar
garciay committed
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
             *              containing type
             *                  indicating 'its_aid'
             *              containing its_aid
             *                  indicating 'AID_CAM'
             *          and not containing other header fields
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
garciay's avatar
garciay committed
8890
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_04_02_BO
garciay's avatar
garciay committed
8891
8892
8893
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
            testcase TC_SEC_ITSS_RCV_CAM_04_02_BO() runs on ItsGeoNetworking system ItsSecSystem {
8894
8895
8896
8897
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
8898
8899
8900
8901
8902
8903
8904
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
8905
                
garciay's avatar
garciay committed
8906
                // Test component configuration
8907
8908
                f_cf01Up();
                
8909
8910
                // Test adapter configuration
                
8911
8912
                // Preamble
                f_prNeighbour();
8913
8914
8915
                if (PICS_DEBUG_ADDON) {
                    f_sendCertificateAndWaitForCertificateChainRequest(cc_taCert_F, f_generateDefaultCam());
                }
8916
8917
8918
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
garciay's avatar
garciay committed
8919
                v_securedGnPdu := f_prepareSecuredCam(
8920
                    cc_taCert_A, 
garciay's avatar
garciay committed
8921
8922
8923
8924
8925
8926
8927
8928
                    {
                        m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
                        m_header_field_its_aid_CAM
                    }, 
                    e_certificate_digest_with_sha256,
                    false
                ); 
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu));
8929
8930
                
                f_sleep(PX_TNOAC);
8931
8932
                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
8933
                    // Empty on purpose 
garciay's avatar
garciay committed
8934
8935
8936
                } // End of 'for' statement
                if (i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
8937
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
8938
8939
                }
                else {
garciay's avatar
garciay committed
8940
                    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
8941
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
8942
                }
garciay's avatar
garciay committed
8943
                
8944
8945
8946
                // Postamble
                f_poNeighbour();
                f_cf01Down();
garciay's avatar
garciay committed
8947
8948
            } // End of testcase TC_SEC_ITSS_RCV_CAM_04_02_BO
            
8949
            /**
garciay's avatar
garciay committed
8950
8951
8952
8953
8954
8955
             * @desc    Check that IUT is able to receive a secured CAM if the signer_info header field is not encoded first
             * <pre>
             * Pics Selection: PICS_GN_SECURITY
             * Config Id: CF01
             * Initial conditions:
             * with { 
garciay's avatar
garciay committed
8956
8957
             *    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
8958
8959
8960
             * } 
             * ensure that { 
             *  when {  
garciay's avatar
garciay committed
8961
             *    the IUT is receiving a SecuredMessage (MSG_SEC_RCV_CAM_01)
garciay's avatar
garciay committed
8962
8963
8964
8965
8966
8967
             *      containing header_fields[0].type
             *        indicating 'signer_info'
             *      and containing header_fields[1].type
             *        indicating 'generation_time'
             *      and containing header_fields[2].type
             *        indicating 'signer_info'
garciay's avatar
garciay committed
8968
             *      and containing header_fields[3]
garciay's avatar
garciay committed
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
             *        containing type
             *          indicating 'its_aid'
             *        containing its_aid
             *          indicating 'AID_CAM'
             *      and not containing other header fields
             *  } then { 
             *      the IUT discards the message 
             *  } 
             * } 
             * </pre>
             *
garciay's avatar
garciay committed
8980
             * @see          ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_RCV_CAM_04_03_BO
garciay's avatar
garciay committed
8981
8982
8983
             * @reference    ETSI TS 103 097 [1], clause 7.1
             */
            testcase TC_SEC_ITSS_RCV_CAM_04_03_BO() runs on ItsGeoNetworking system ItsSecSystem {
8984
8985
8986
8987
                
                // Local variables
                var integer i;
                var GeoNetworkingPdu v_securedGnPdu;
8988
8989
8990
8991
8992
8993
8994
                var GnRawPayload v_sentRawPayload;
                
                // Test adapter configuration
                if (not(PICS_GN_SECURITY)) {
                    log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
                    stop;
                }
8995
                
garciay's avatar
garciay committed
8996
                // Test component configuration
8997
8998
                f_cf01Up();
                
8999
9000
                // Test adapter configuration
                
For faster browsing, not all history is shown. View entire blame