Commit ac051b74 authored by garciay's avatar garciay
Browse files

STF538: Start Encryption TPs implementation

parent c30f78a2
Loading
Loading
Loading
Loading
+20 −11
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ module LibItsSecurity_Functions {
        function f_signWithEcdsaNistp256WithSha256(
                                                   in octetstring p_toBeSignedSecuredMessage,
                                                   in Oct32 p_privateKey
        ) runs on ItsSecurityBaseComponent return octetstring {
        ) return octetstring {
            return fx_signWithEcdsaNistp256WithSha256(
                p_toBeSignedSecuredMessage,
                p_privateKey
@@ -79,7 +79,7 @@ module LibItsSecurity_Functions {
        function f_signWithEcdsaBrainpoolp256WithSha256(
                                                        in octetstring p_toBeSignedSecuredMessage,
                                                        in Oct32 p_privateKey
        ) runs on ItsSecurityBaseComponent return octetstring {
        ) return octetstring {
            return fx_signWithEcdsaBrainpoolp256WithSha256(
                p_toBeSignedSecuredMessage,
                p_privateKey
@@ -95,7 +95,7 @@ module LibItsSecurity_Functions {
        function f_signWithEcdsaBrainpoolp384WithSha384(
                                                        in octetstring p_toBeSignedSecuredMessage,
                                                        in Oct48 p_privateKey
        ) runs on ItsSecurityBaseComponent return octetstring {
        ) return octetstring {
            return fx_signWithEcdsaBrainpoolp384WithSha384(
                p_toBeSignedSecuredMessage,
                p_privateKey
@@ -115,6 +115,18 @@ module LibItsSecurity_Functions {
            return substr(p_hash, lengthof(p_hash) - 8, 8);
        } // End of function f_HashedId8FromSha256
        
        /**
         * @desc Compute the HashedId8 value from the hash value
         * @param p_hash The hash value
         * @return The HashedId8 value
         * @verdict
         */
        function f_HashedId8FromSha384( 
                                       in Oct48 p_hash
        ) return HashedId8 {
            return substr(p_hash, lengthof(p_hash) - 8, 8);
        } // End of function f_HashedId8FromSha384
        
        /**
         * @desc Compute the HashedId3 value from the HashedId8 value
         * @param p_hashp_hashedId8 The HashedId8 value
@@ -439,7 +451,7 @@ module LibItsSecurity_Functions {
                                                in template (value) ToBeSignedData p_payloadField,
                                                in template (value) HeaderInfo p_mandatoryHeaders,
                                                in template (omit) HeaderInfo p_headerInfo := omit
            ) runs on ItsSecurityBaseComponent return boolean {
            ) return boolean {
                
                // Local variables
                var octetstring v_secPayload, v_signature;
@@ -1421,14 +1433,11 @@ module LibItsSecurity_Functions {
            function f_loadCertificates(
                                        in charstring p_configId
            ) runs on ItsSecurityBaseComponent return boolean {
// FIXME (DF) UNUSED
//                var boolean v_result;
                
                // Setup certificates memory cache
                if (fx_loadCertificates(PX_CERTIFICATE_POOL_PATH, p_configId) == true) {
                    // Setup security component variables
                    /*FIXME if(f_readCertificate(cc_taCert_A, vc_atCertificate)) {
                        if(f_readCertificate(oct2str(vc_atCertificate.issuer), vc_aaCertificate)) {
                    if(f_readCertificate(cc_taCert_A, vc_atCertificate)) {
                        if(f_readCertificate(vc_atCertificate.toBeSigned.id.name, vc_aaCertificate)) {
                            if(f_readSigningKey(cc_taCert_A, vc_signingPrivateKey)) {
                                f_readEncryptingKey(cc_taCert_A, vc_encryptPrivateKey);
                                return true;
@@ -1439,7 +1448,7 @@ module LibItsSecurity_Functions {
                            }
                    }else{
                        log("f_loadCertificates: Failed to load AT certificate for ", cc_taCert_A);
                        }*/
                        }
                } else {
                    log("f_loadCertificates: Failed to load certificates from ", PX_CERTIFICATE_POOL_PATH);
                }
+4 −4
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ module LibItsSecurity_Pics {
    /**
     * Does the IUT support SHA-384 digest
     */
    modulepar boolean PICS_SEC_SHA384 := true;
    modulepar boolean PICS_SEC_SHA384 := false;
    
    /**
     * Does the IUT support NIST P256 algorithm
@@ -37,7 +37,7 @@ module LibItsSecurity_Pics {
    /**
     * Does the IUT support Brainpool P256r1 algorithm
     */
    modulepar boolean PICS_SEC_BRAINPOOL_P256R1 := false;
    modulepar boolean PICS_SEC_BRAINPOOL_P256R1 := true;
    
    /**
     * Does the IUT support Brainpool P384r1 algorithm
@@ -82,12 +82,12 @@ module LibItsSecurity_Pics {
    /**
     * Does the IUT support identified region/UN geographical restriction
     */
    modulepar boolean PICS_SEC_UN_STATS_REGION_DICTIONARY := true;
    //TODO Remove modulepar boolean PICS_SEC_UN_STATS_REGION_DICTIONARY := true;
    
    /**
     * Does the IUT support identified region/ISO31661 geographical restriction
     */
    modulepar boolean PICS_ISO31661_REGION_DICTIONARY := true;
    //TODO Remove modulepar boolean PICS_ISO31661_REGION_DICTIONARY := true;
    
    /**
     * Does the IUT support ITS-AID for Generic profile?
+13 −14
Original line number Diff line number Diff line
@@ -554,6 +554,16 @@ module LibItsSecurity_Templates {
            content         := p_content
        } // End of template m_etsiTs103097Data
        
        /**
         * @desc Generic receive template for EtsiTs103097Data message
         */
        template (present) EtsiTs103097Data mw_etsiTs103097Data(
                                                                template (present) Ieee1609Dot2Content p_content := ?
        ) := {
            protocolVersion := c_protocol_version,
            content         := p_content
        } // End of template mw_etsiTs103097Data
        
        template (value) EtsiTs103097Data m_etsiTs103097Data_unsecured(
                                                                       in template (value) Opaque p_unsecuredData
        ) := {
@@ -589,16 +599,6 @@ module LibItsSecurity_Templates {
            content         := { encryptedData := p_encryptedData }
        } // End of template mw_etsiTs103097Data_encrypted
        
        /**
         * @desc Generic send template for EtsiTs103097Data message
         */
        template (present) EtsiTs103097Data mw_etsiTs103097Data(
                                                                template (present) Ieee1609Dot2Content p_content := ?
        ) := {
            protocolVersion := c_protocol_version,
            content         := p_content
        } // End of template mw_etsiTs103097Data
        
        /**
         * @desc Generic send template for EtsiTs103097Data message
         */
@@ -981,13 +981,12 @@ module LibItsSecurity_Templates {
        template (present) HeaderInfo mw_headerInfo_cam(
                                                        template (present) Psid p_psid := c_its_aid_CAM,
                                                        template (present) Time64 p_generationTime := ?,
                                                        template Time64 p_expiryTime := omit,
                                                        template SequenceOfHashedId3 p_inlineP2pcdRequest := omit,
                                                        template Certificate p_requestedCertificate := omit
        ) modifies mw_ieee1609Dot2_headerInfo := {
            psid                    := c_its_aid_CAM,
            generationTime          := p_generationTime,
            expiryTime              := p_expiryTime,
            expiryTime              := omit,
            generationLocation      := omit,
            inlineP2pcdRequest      := p_inlineP2pcdRequest,
            requestedCertificate    := p_requestedCertificate
@@ -1002,7 +1001,7 @@ module LibItsSecurity_Templates {
                                                     in template (value) Time64 p_generationTime,
                                                     in template (value) ThreeDLocation p_generationLocation,
                                                     in template (omit) Time64 p_expiryTime := omit
        ) modifies mw_ieee1609Dot2_headerInfo := {
        ) modifies m_ieee1609Dot2_headerInfo := {
            generationTime     := p_generationTime,
            expiryTime         := p_expiryTime,
            generationLocation := p_generationLocation
@@ -1499,7 +1498,7 @@ module LibItsSecurity_Templates {
            name := p_name
        } // End of template mw_certificateId_name
        
        template (present) CertificateId mw_certificateId_none := {
        template CertificateId mw_certificateId_none := {
            none_ := NULL
        } // End of template mw_certificateId_none