Commit 295e7c5d authored by filatov's avatar filatov
Browse files

certificate loading routines has been changed

parent 8a073c35
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -128,15 +128,15 @@ module LibItsSecurity_Functions {
                
                // Load certificates if required
                if (ispresent(p_certificateName) and (valueof(p_certificateName) != cc_taCert_A)) {
                    if (f_readCertificate(valueof(p_certificateName) & ".AA_CERT", p_aaCertificate) == false) {
                    if (f_readCertificate(valueof(p_certificateName), p_atCertificate) == false){
                    	return false;
                    }
                    if (f_readCertificate(valueof(p_certificateName) & ".AT_CERT", p_atCertificate) == false) {
                    if (f_readCertificate(oct2str(p_aaCertificate.signer_info.signerInfo.digest), p_aaCertificate) == false) {
                        return false;
                    }
                } else {
                    p_aaCertificate := vc_aaCertificate;
                    p_atCertificate := vc_atCertificate;
                    p_aaCertificate := vc_aaCertificate;
                }
                // Store the certificte to build this message
                vc_lastAtCertificateUsed := p_atCertificate;
@@ -548,7 +548,7 @@ module LibItsSecurity_Functions {
                }
                
                // Load certificates
                if (f_readCertificate(p_certificateName & ".AT_CERT", v_atCertificate) == false) {
                if (f_readCertificate(p_certificateName, v_atCertificate) == false) {
                    return v_hashedId8;
                }
                
@@ -796,9 +796,10 @@ module LibItsSecurity_Functions {
                // Setup certificates memory cache
                if (fx_loadCertificates(PX_ROOT_PATH_FOR_SECURITY, p_configId) == true) {
                    // Setup security component variables
                    f_readCertificate(cc_taCert_A & ".AA_CERT", vc_aaCertificate);
                    f_readCertificate(cc_taCert_A & ".AT_CERT", vc_atCertificate);
                    f_readPrivateKeys(cc_taCert_A & ".AT_PRIVATE_KEYS", vc_signingPrivateKey, vc_encryptPrivateKey);
                    if(f_readCertificate(cc_taCert_A, vc_atCertificate)){
                        f_readCertificate(oct2str(vc_atCertificate.signer_info.signerInfo.digest), vc_aaCertificate); 
                        f_readPrivateKeys(cc_taCert_A, vc_signingPrivateKey, vc_encryptPrivateKey);
                    }
                    
                    return true;
                }
+4 −4
Original line number Diff line number Diff line
@@ -13,18 +13,18 @@ module LibItsSecurity_Pixits {
    /**
     * @desc Root path to access certificate stored in files, identified by certficate ID
     */
    modulepar charstring PX_ROOT_PATH_FOR_SECURITY := "";
    modulepar charstring PX_ROOT_PATH_FOR_SECURITY := "data/certificates";
    
    /**
     * @descConfiguration sub-directory to access certificate stored in files
     */
    modulepar charstring PX_CONFIG_DIRECTORY_FOR_SECURITY := "data/certificates";
    modulepar charstring PX_CONFIG_DIRECTORY_FOR_SECURITY := "cfg01";
    
    /**
     * @desc The certficate the IUT should use. Default: CERT_IUT_A
     * @desc The certficate the IUT should use. Default: CERT_IUT_A_AT
     * @remark If the IUT cannot use the test certificates, set this PIXIT to CERT_NONE
     */
    modulepar charstring PX_DEFAULT_IUT_HASHEDID8 := "CERT_IUT_A";
    modulepar charstring PX_DEFAULT_IUT_HASHEDID8 := "CERT_IUT_A_AT";
    
    /**
     * @desc ITS-AID value for other profile. Default: 38
+17 −17
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ module LibItsSecurity_TestSystem {
            var Certificate vc_aaCertificate;                                   /** Test Adapter AT certificate */
            var Certificate vc_atCertificate;                                   /** Test Adapter AT certificate */
            var Certificate vc_lastAtCertificateUsed;                           /** Last Test Adapter certificate used in 'f_buildGnSecuredXXX' functions */
            var charstring vc_hashedId8ToBeUsed := PX_DEFAULT_IUT_HASHEDID8;    /** Digest value of the certificate couple to be used by the IUT. Default: CERT_IUT_A */
            var charstring vc_hashedId8ToBeUsed := PX_DEFAULT_IUT_HASHEDID8;    /** Digest value of the certificate couple to be used by the IUT. Default: CERT_IUT_A_AT */
            
            // Private keys
            var Oct32 vc_signingPrivateKey; 
@@ -35,25 +35,25 @@ module LibItsSecurity_TestSystem {
            var ThreeDLocation vc_location; 
            
            // Test Adapter certificates & private keys - Valid behavior
            const charstring cc_taCert_A := "CERT_TS_A"; /** Default certificate, without region validity restriction, to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCert_B := "CERT_TS_B"; /** Default certificate, with circular region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCert_C := "CERT_TS_C"; /** Certificate with a rectangular region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCert_D := "CERT_TS_D"; /** Certificate with a polygonal region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCert_E := "CERT_TS_E"; /** Certificate with a region identifier, to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCert_F := "CERT_TS_F"; /** Certificate with a subject type indicating 'enrolment_credentials', to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCert_A := "CERT_TS_A_AT"; /** Default certificate, without region validity restriction, 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_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_D := "CERT_TS_D_AT"; /** Certificate with a polygonal region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCert_E := "CERT_TS_E_AT"; /** Certificate with a region identifier, to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCert_F := "CERT_TS_F_AT"; /** Certificate with a subject type indicating 'enrolment_credentials', to be used when secured messages are sent from TA to IUT */
            // Test Adapter certificates & private keys - Inoportune behavior
            const charstring cc_taCert0101BO := "CERT_TS_01_01_BO"; /**  */
            const charstring cc_taCert0102BO := "CERT_TS_01_02_BO"; /**  */
            const charstring cc_taCert0103BO := "CERT_TS_01_03_BO"; /**  */
            const charstring cc_taCert0104BO := "CERT_TS_01_04_BO"; /**  */
            const charstring cc_taCert0101BO := "CERT_TS_01_01_BO_AT"; /**  */
            const charstring cc_taCert0102BO := "CERT_TS_01_02_BO_AT"; /**  */
            const charstring cc_taCert0103BO := "CERT_TS_01_03_BO_AT"; /**  */
            const charstring cc_taCert0104BO := "CERT_TS_01_04_BO_AT"; /**  */
            
            // IUT certificates & private keys
            const charstring cc_iutCert_A := "CERT_IUT_A"; /** Default certificate, without region validity restriction, to be used when secured messages are sent from TA to IUT */
            const charstring cc_iutCert_B := "CERT_IUT_B"; /** Default certificate, with circular region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_iutCert_C := "CERT_IUT_C"; /** Certificate with a rectangular region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_iutCert_D := "CERT_IUT_D"; /** Certificate with a polygonal region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_iutCert_E := "CERT_IUT_E"; /** Certificate with a region identifier, to be used when secured messages are sent from TA to IUT */
            const charstring cc_iutCert_F := "CERT_IUT_F"; /** Certificate with a subject type indicating 'enrolment_credentials', to be used when secured messages are sent from TA to IUT */
            const charstring cc_iutCert_A := "CERT_IUT_A_AT"; /** Default certificate, without region validity restriction, to be used when secured messages are sent from TA to IUT */
            const charstring cc_iutCert_B := "CERT_IUT_B_AT"; /** Default certificate, with circular region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_iutCert_C := "CERT_IUT_C_AT"; /** Certificate with a rectangular region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_iutCert_D := "CERT_IUT_D_AT"; /** Certificate with a polygonal region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_iutCert_E := "CERT_IUT_E_AT"; /** Certificate with a region identifier, to be used when secured messages are sent from TA to IUT */
            const charstring cc_iutCert_F := "CERT_IUT_F_AT"; /** Certificate with a subject type indicating 'enrolment_credentials', to be used when secured messages are sent from TA to IUT */
        } // End of ItsSecurityBaseComponent
        
    } // End of group componentDefinitions