Commit 5d8bcbab authored by YannGarcia's avatar YannGarcia
Browse files

STF594: Add new CAM tests

parent 913d1303
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -1275,10 +1275,10 @@ module LibItsGeoNetworking_Functions {
      var UtGnEventInd v_ind;
      var UtGnEventInd v_ind;
      [vc_utDefaultActive] utPort.receive(UtGnEventInd:?) -> value v_ind {
      [vc_utDefaultActive] utPort.receive(UtGnEventInd:?) -> value v_ind {
        //store every upper tester indication received
        //store every upper tester indication received
        log("################# v_ind: ", v_ind);
        //log("################# v_ind: ", v_ind);
        log("################# vc_utInds: ", vc_utInds);
        log("################# lengthof(vc_utInds): ", lengthof(vc_utInds));
        vc_utInds[lengthof(vc_utInds)] := v_ind;
        vc_utInds[lengthof(vc_utInds)] := v_ind;
        //log("################# vc_utInds: ", vc_utInds);
        //log("################# lengthof(vc_utInds): ", lengthof(vc_utInds));
        repeat;
        repeat;
      }
      }
      [vc_utDefaultActive] utPort.receive {
      [vc_utDefaultActive] utPort.receive {
+34 −53
Original line number Original line Diff line number Diff line
@@ -21,7 +21,7 @@ module LibItsSecurity_Functions {
    import from EtsiTs103097Module language "ASN.1:1997" all;
    import from EtsiTs103097Module language "ASN.1:1997" all;
    
    
    // LibItsCommon
    // LibItsCommon
    //import from LibItsCommon_Functions all;
    import from LibItsCommon_Functions all;
    //import from LibItsCommon_TypesAndValues all;
    //import from LibItsCommon_TypesAndValues all;
    import from LibItsCommon_Pixits all;
    import from LibItsCommon_Pixits all;
    
    
@@ -1086,8 +1086,7 @@ module LibItsSecurity_Functions {
                                         out EtsiTs103097Data p_securedMessage,
                                         out EtsiTs103097Data p_securedMessage,
                                         in ToBeSignedData p_payloadField,
                                         in ToBeSignedData p_payloadField,
                                         in SignerIdentifier p_signerIdentifierType,
                                         in SignerIdentifier p_signerIdentifierType,
                                         in charstring p_certificateName := ""/*,
                                         in charstring p_certificateName := ""
                                         in boolean p_addMissingHeaders := true*/
            ) runs on ItsSecurityBaseComponent return boolean {
            ) runs on ItsSecurityBaseComponent return boolean {
                // Local variables
                // Local variables
                var EtsiTs103097Certificate v_aaCertificate, v_atCertificate;
                var EtsiTs103097Certificate v_aaCertificate, v_atCertificate;
@@ -1116,27 +1115,8 @@ module LibItsSecurity_Functions {
                                                                                   )
                                                                                   )
                                                                      ));
                                                                      ));
                // Prepare mandatory headers
                // Prepare mandatory headers
                //log("f_buildGnSecuredCam: p_signerIdentifierType=", p_signerIdentifierType);
                log("f_buildGnSecuredCam: p_signerIdentifierType=", p_signerIdentifierType);
                if (ischosen(p_signerIdentifierType.certificate)) { // Add the AT certificate
                if (ischosen(p_signerIdentifierType.digest)) { // Add the AT certificate digest
                    log("*** " & testcasename() & "f_buildGnSecuredCam: TODO ***");
                    stop;
                    /* TODO
                     * v_signerInfo := valueof(
                        m_header_info_signer_info(
                            m_signerIdentifier_certificate(
                                v_atCertificate
                    )));
                } else if (valueof(p_signerIdentifierType) == e_certificate_chain) { // Add the AT certificate + AA EtsiTs103097Certificate
                    v_signerInfo := valueof(
                        m_header_info_signer_info(
                            m_signerIdentifier_certificates(
                                {
                                    v_aaCertificate,
                                    v_atCertificate
                                }
                            )
                    ));*/
                } else if (ischosen(p_signerIdentifierType.digest)) { // Add the AT certificate digest
                    if (ischosen(v_atCertificate.issuer.sha256AndDigest)) {
                    if (ischosen(v_atCertificate.issuer.sha256AndDigest)) {
                        p_securedMessage.content.signedData.hashId := sha256;
                        p_securedMessage.content.signedData.hashId := sha256;
                        p_securedMessage.content.signedData.signer := valueof(m_signerIdentifier_digest(
                        p_securedMessage.content.signedData.signer := valueof(m_signerIdentifier_digest(
@@ -1148,9 +1128,6 @@ module LibItsSecurity_Functions {
                                                                                                f_calculateDigestSha384FromCertificate(v_atCertificate)
                                                                                                f_calculateDigestSha384FromCertificate(v_atCertificate)
                                                                                                        ));
                                                                                                        ));
                    }
                    }
                } else {
                    log("*** " & testcasename() & "f_buildGnSecuredCam: TODO ***");
                    stop;
                }
                }
                if (ispresent(v_atCertificate.signature_)) {
                if (ispresent(v_atCertificate.signature_)) {
                    if (ischosen(v_atCertificate.signature_.ecdsaBrainpoolP256r1Signature)) {
                    if (ischosen(v_atCertificate.signature_.ecdsaBrainpoolP256r1Signature)) {
@@ -1169,7 +1146,7 @@ module LibItsSecurity_Functions {
                                                                                                           ));
                                                                                                           ));
                    } // else, m_signature_ecdsaNistP256 already chosen by default
                    } // else, m_signature_ecdsaNistP256 already chosen by default
                }
                }
                //log("f_buildGnSecuredCam: p_securedMessage = ", p_securedMessage);
                log("f_buildGnSecuredCam: p_securedMessage = ", p_securedMessage);
                
                
                return f_buildGnSecuredMessage(p_securedMessage, p_certificateName, p_payloadField/*, v_mandatoryHeaders*/);
                return f_buildGnSecuredMessage(p_securedMessage, p_certificateName, p_payloadField/*, v_mandatoryHeaders*/);
                
                
@@ -1194,6 +1171,12 @@ module LibItsSecurity_Functions {
                                            in SignerIdentifier p_signerIdentifierType, // FIXME To be reviewed
                                            in SignerIdentifier p_signerIdentifierType, // FIXME To be reviewed
                                            in charstring p_certificateName,
                                            in charstring p_certificateName,
                                            in UInt8 p_protocolVersion,
                                            in UInt8 p_protocolVersion,
                                            in boolean p_alter_psid,
                                            in boolean p_add_generation_location,
                                            in boolean p_add_expiry_time,
                                            in boolean p_add_p2pcd_learning_request,
                                            in boolean p_add_missing_crl_identifier,
                                            in boolean p_add_encryption_key,
                                            in boolean p_alterIssuerIdentifier,
                                            in boolean p_alterIssuerIdentifier,
                                            in boolean p_alterATCertificateSignature,
                                            in boolean p_alterATCertificateSignature,
                                            in boolean p_alterAACertificateSignature
                                            in boolean p_alterAACertificateSignature
@@ -1225,26 +1208,7 @@ module LibItsSecurity_Functions {
                                                                      ));
                                                                      ));
                // Prepare mandatory headers
                // Prepare mandatory headers
                //log("f_buildGnSecuredCam: p_signerIdentifierType=", p_signerIdentifierType);
                //log("f_buildGnSecuredCam: p_signerIdentifierType=", p_signerIdentifierType);
                if (ischosen(p_signerIdentifierType.certificate)) { // Add the AT certificate
                if (ischosen(p_signerIdentifierType.digest)) { // Add the AT certificate digest
                    log("*** " & testcasename() & "f_buildGnSecuredCam: TODO ***");
                    stop;
                    /* TODO
                     * v_signerInfo := valueof(
                        m_header_info_signer_info(
                            m_signerIdentifier_certificate(
                                v_atCertificate
                    )));
                } else if (valueof(p_signerIdentifierType) == e_certificate_chain) { // Add the AT certificate + AA EtsiTs103097Certificate
                    v_signerInfo := valueof(
                        m_header_info_signer_info(
                            m_signerIdentifier_certificates(
                                {
                                    v_aaCertificate,
                                    v_atCertificate
                                }
                            )
                    ));*/
                } else if (ischosen(p_signerIdentifierType.digest)) { // Add the AT certificate digest
                    if (ischosen(v_atCertificate.issuer.sha256AndDigest)) {
                    if (ischosen(v_atCertificate.issuer.sha256AndDigest)) {
                        p_securedMessage.content.signedData.hashId := sha256;
                        p_securedMessage.content.signedData.hashId := sha256;
                        p_securedMessage.content.signedData.signer := valueof(m_signerIdentifier_digest(
                        p_securedMessage.content.signedData.signer := valueof(m_signerIdentifier_digest(
@@ -1256,9 +1220,6 @@ module LibItsSecurity_Functions {
                                                                                                        f_calculateDigestSha384FromCertificate(v_atCertificate)
                                                                                                        f_calculateDigestSha384FromCertificate(v_atCertificate)
                                                                                                        ));
                                                                                                        ));
                    }
                    }
                } else {
                    log("*** " & testcasename() & "f_buildGnSecuredCam: TODO ***");
                    stop;
                }
                }
                if (ispresent(v_atCertificate.signature_)) {
                if (ispresent(v_atCertificate.signature_)) {
                    if (ischosen(v_atCertificate.signature_.ecdsaBrainpoolP256r1Signature)) {
                    if (ischosen(v_atCertificate.signature_.ecdsaBrainpoolP256r1Signature)) {
@@ -1281,6 +1242,26 @@ module LibItsSecurity_Functions {


                // Alter protocolVersion
                // Alter protocolVersion
                p_securedMessage.protocolVersion := p_protocolVersion;
                p_securedMessage.protocolVersion := p_protocolVersion;
                // Alter psid
                if (p_alter_psid == true) {
                  p_securedMessage.content.signedData.tbsData.headerInfo.psid := 99;
                }
                // Add generationLocation
                if (p_add_generation_location == true) {
                  p_securedMessage.content.signedData.tbsData.headerInfo.generationLocation := valueof(m_threeDLocation(PX_WGSLATITUDE, PX_WGSLONGITUDE, 0));
                }
                if (p_add_expiry_time == true) {
                  p_securedMessage.content.signedData.tbsData.headerInfo.expiryTime := f_getCurrentTimeUtc() + 3600;
                }
                if (p_add_p2pcd_learning_request == true) {
                  //TODO 
                }
                if (p_add_missing_crl_identifier == true) {
                  //TODO 
                }
                if (p_add_encryption_key == true) {
                  //TODO 
                }
                
                
                return f_buildGnSecuredMessage(p_securedMessage, p_certificateName, p_payloadField);
                return f_buildGnSecuredMessage(p_securedMessage, p_certificateName, p_payloadField);


+7 −1
Original line number Original line Diff line number Diff line
@@ -36,6 +36,12 @@ module LibItsSecurity_Pixits {
     */
     */
    modulepar charstring PX_IUT_DEFAULT_CERTIFICATE := "CERT_IUT_A_AT";
    modulepar charstring PX_IUT_DEFAULT_CERTIFICATE := "CERT_IUT_A_AT";
    
    
    /**
     * @desc The certficate the IUT should use. Default: CERT_TS_B_AT
     * @remark Possible values: CERT_TS_C_AT, CERT_TS_D_AT, or CERT_TS_E_AT
     */
    modulepar charstring PX_AT_CERTIFICATE := "CERT_TS_B_AT";
    
    /**
    /**
     * @desc ITS-AID value for other profile. Default: 38
     * @desc ITS-AID value for other profile. Default: 38
     */
     */
@@ -44,7 +50,7 @@ module LibItsSecurity_Pixits {
    /**
    /**
     * @desc Invalid protocol version. Default: 3
     * @desc Invalid protocol version. Default: 3
     */
     */
    modulepar UInt8 PX_WRONG_PROTOCOL_VERSION := 3;
    modulepar UInt8 PX_WRONG_PROTOCOL_VERSION := 4;
    
    
    /**
    /**
     * @desc Invalid WGS longitude
     * @desc Invalid WGS longitude
+1 −0
Original line number Original line Diff line number Diff line
@@ -37,6 +37,7 @@ module LibItsSecurity_TypesAndValues {
        const charstring cc_taCert_B    := "CERT_TS_B_AT";   /** Default certificate, with circular region, to be used when secured messages are sent from TA to IUT */
        const charstring cc_taCert_B    := "CERT_TS_B_AT";   /** Default certificate, with circular region, to be used when secured messages are sent from TA to IUT */
        const charstring cc_taCert_B1   := "CERT_TS_B_1_AT";
        const charstring cc_taCert_B1   := "CERT_TS_B_1_AT";
        const charstring cc_taCert_B_AA := "CERT_TS_B_1_AA";
        const charstring cc_taCert_B_AA := "CERT_TS_B_1_AA";
        const charstring cc_taCert_A_B  := "CERT_TS_A_B_AT";
        const charstring cc_taCert_C    := "CERT_TS_C_AT"; /** Certificate with a rectangular region, to be used when secured messages are sent from TA to IUT */
        const charstring cc_taCert_C    := "CERT_TS_C_AT"; /** Certificate with a rectangular region, to be used when secured messages are sent from TA to IUT */
        const charstring cc_taCert_C1   := "CERT_TS_C1_AT"; /** Certificate with a rectangular region, to be used when secured messages are sent from TA to IUT */
        const charstring cc_taCert_C1   := "CERT_TS_C1_AT"; /** Certificate with a rectangular region, to be used when secured messages are sent from TA to IUT */
        const charstring cc_taCert_CA1  := "CERT_TS_CA1_AT"; /** Certificate with a rectangular region, to be used when secured messages are sent from TA to IUT */
        const charstring cc_taCert_CA1  := "CERT_TS_CA1_AT"; /** Certificate with a rectangular region, to be used when secured messages are sent from TA to IUT */