Commit 883d2abe authored by filatov's avatar filatov
Browse files

split readPrivateKeys to readSigningKey and readEncryptingKey

parent b18f8a54
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1743,6 +1743,7 @@ module LibItsGeoNetworking_Functions {
            
            // Load certificates
            f_loadCertificates(PX_CONFIG_DIRECTORY_FOR_SECURITY);

            // Initialize vc_location
            f_setGenerationLocation(
                f_getTsLatitude(),
+42 −15
Original line number Diff line number Diff line
@@ -797,14 +797,21 @@ module LibItsSecurity_Functions {
                if (fx_loadCertificates(PX_ROOT_PATH_FOR_SECURITY, p_configId) == true) {
                    // Setup security component variables
                    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);
                    }
                    
                        if(f_readCertificate(oct2str(vc_atCertificate.signer_info.signerInfo.digest), vc_aaCertificate)) {
                            if(f_readSigningKey(cc_taCert_A, vc_signingPrivateKey)) {
					            f_readEncryptingKey(cc_taCert_A, vc_encryptPrivateKey);
                                return true;
                            }
                
                log("f_loadCertificates: Failed to access ", p_configId);
                            log("f_loadCertificates: Failed to load signing key for ", cc_taCert_A);
                        }else{
                            log("f_loadCertificates: Failed to load AA certificate for ", cc_taCert_A);
                        }
                    }else{
                        log("f_loadCertificates: Failed to load AA certificate for ", cc_taCert_A);
                    }
                }else{
                    log("f_loadCertificates: Failed to load certificates from ", PX_ROOT_PATH_FOR_SECURITY);
                }
                return false;
            } // End of function f_loadCertificates
            
@@ -848,19 +855,30 @@ module LibItsSecurity_Functions {
            } // End of function f_readCertificate
            
            /**
            * @desc    Read the private keys for the specified certificate
            * @desc    Read the signing private key for the specified certificate
            * @param   p_keysId            the keys identifier
            * @param   p_signingPrivateKey the signing private key
            * @return  true on success, false otherwise
            */
            function f_readSigningKey(
                                       in charstring p_keysId,
                                       out Oct32 p_signingPrivateKey
            ) runs on ItsSecurityBaseComponent return boolean {
                return fx_readSigningKey(p_keysId, p_signingPrivateKey);
            } // End of function f_readSigningKey
            
            /**
            * @desc    Read the encrypting private keys for the specified certificate
            * @param   p_keysId            the keys identifier
            * @param   p_encryptPrivateKey the encrypt private key
            * @return  true on success, false otherwise
            */
            function f_readPrivateKeys(
            function f_readEncryptingKey(
                                       in charstring p_keysId,
                                       out Oct32 p_signingPrivateKey,
                                       out Oct32 p_encryptPrivateKey
            ) runs on ItsSecurityBaseComponent return boolean {
                return fx_readPrivateKeys(p_keysId, p_signingPrivateKey, p_encryptPrivateKey);
            } // End of function f_readPrivateKeys
                return fx_readEncryptingKey(p_keysId, p_encryptPrivateKey);
            } // End of function f_readEncryptingKey
            
            function f_getCertificateValidityRestriction(
                                                         in template (value) Certificate p_cert,
@@ -986,10 +1004,19 @@ module LibItsSecurity_Functions {
			* @desc    Read the private keys for the specified certificate
			* @param   p_keysId            the keys identifier
			* @param   p_signingPrivateKey the signing private key
			* @return  true on success, false otherwise
			*/

			external function fx_readSigningKey(in charstring p_keysId, out Oct32 p_signingPrivateKey) return boolean;

            /**
            * @desc    Read the private keys for the specified certificate
            * @param   p_keysId            the keys identifier
            * @param   p_encryptPrivateKey the encrypt private key
            * @return  true on success, false otherwise
            */
            external function fx_readPrivateKeys(in charstring p_keysId, out Oct32 p_signingPrivateKey, out Oct32 p_encryptPrivateKey) return boolean;

            external function fx_readEncryptingKey(in charstring p_keysId, out Oct32 p_encryptingPrivateKey) return boolean;

        } // End of group certificatesLoader