Commit acfdf212 authored by garciay's avatar garciay
Browse files

Remove fx_extractPrivateKey() external function

Modify diffie hellman functions
parent 85d3529b
Loading
Loading
Loading
Loading
+7 −25
Original line number Diff line number Diff line
@@ -180,16 +180,6 @@
             */
            external function fx_extractPublicKey(in octetstring p_dgfile, out octetstring p_publicKey) return KeyAgreementAlgorithm;

        	/**
            /**
             * @desc	Extract the private key information from the provided DGxx file content
             * @param	dgfile The DGxx file content
             * @param	key The private key in byte format
             * @return	The algorithm
             * @see		LDS 1.7 2004-05-18 document - Page 90 for DG14/DG15 ASN.1 structure (and use ASN.1 editor to vizualize the files content)
             */
            external function fx_extractPrivateKey(in octetstring p_dgfile, out octetstring p_privateKey) return KeyAgreementAlgorithm;

			/*
        	 * @desc	Compute a Diffie-Hellman shared secret
        	 * @param	p_privateKeyPicc Private key of peer A
@@ -198,7 +188,7 @@
        	 * @return	Diffie-Hellman shared secret
			 * @see		Technical Guideline - Extended Access Control - Appendix D - D.1. Data Group 14
        	 */
            external function fx_computeDhSharedSecret(in octetstring p_privateKeyPicc, in KeyAgreementAlgorithm p_keyAgreementAlgorithm, in octetstring p_publicKeyPcd) return octetstring;
            external function fx_computeDhSharedSecret(in octetstring p_privateKeyPicc, in octetstring p_publicKeyPcd, out octetstring p_keyAgreement) return KeyAgreementAlgorithm;

         	/**
        	 * @desc	Calculate the signature of a data block
@@ -371,23 +361,16 @@
    		return fx_extractPublicKey(p_dgfile, p_publicKey);
    	} // end f_extractPublicKey
    	
    	function f_extractPrivateKey(
    		in octetstring p_dgfile,
    		out octetstring p_privateKey)
    	return KeyAgreementAlgorithm {
    		return fx_extractPrivateKey(p_dgfile, p_privateKey);
    	} // end f_extractPrivateKey
    	
    	function f_extractXcoordinateFromEcPublicKey(in octetstring p_ecPublicKey) return octetstring {
    	    return fx_extractXcoordinateFromEcPublicKey(p_ecPublicKey);    	    
    	} // end f_extractXcoordinateFromEcPublicKey

    	function f_computeSharedSecret(
    		in octetstring p_privateKeyPicc, 
    		in KeyAgreementAlgorithm p_keyAgreementAlgorithm,
    		in octetstring p_publicKeyPcd)
    	return octetstring {    		
    		return fx_computeDhSharedSecret(p_privateKeyPicc, p_keyAgreementAlgorithm, p_publicKeyPcd);
    		in octetstring p_publicKeyPcd,
    		out octetstring p_sharedKey)
    	return KeyAgreementAlgorithm {    		
    		return fx_computeDhSharedSecret(p_privateKeyPicc, p_publicKeyPcd, p_sharedKey);
    	} // end f_computeSharedSecret
    	
    	function f_build3DesKey(in octetstring p_keyPair) return octetstring {
@@ -532,8 +515,7 @@
			// TODO: select private key based on key ref
			f_readFileData(c_fileDG14, 0, -1, v_dg14);
			f_readFileData(c_filePrCA, 0, -1, v_dg14PrivateKey);
			v_algo := f_extractPublicKey(v_dg14, v_dummy); // Is it possible to set a function parameter optional?
			v_k := f_computeSharedSecret(v_dg14PrivateKey, v_algo, p_publicKeyPcd);
			v_algo := f_computeSharedSecret(v_dg14PrivateKey, p_publicKeyPcd, v_k);
								
			// b) The session keys KMAC and KEnc derived from K for Secure Messaging.
			f_deriveKeys(v_k, vc_simu.kEnc, vc_simu.kMac);