Commit cb38b100 authored by YannGarcia's avatar YannGarcia
Browse files

Closed bug issue #2 (ITS/TS.ITS#2)

parent 7dc348f6
Loading
Loading
Loading
Loading
+132 −20
Original line number Diff line number Diff line
@@ -123,6 +123,29 @@ module LibItsSecurity_Functions {
            
        } // End of function f_signWithEcdsaBrainpoolp384r1WithSha384
        
        /**
         * @desc    Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on standard IEEE 1609.2
         * @param   p_toBeSignedSecuredMessage    The data to be signed
         * @param   p_certificateIssuer           The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
         * @param   p_privateKey                  The private key for signature
         * @return  The signature value
         */
        function f_signWithEcdsaNistp384WithSha384(
                                                   in octetstring p_toBeSignedSecuredMessage,
                                                   in Oct48 p_certificateIssuer,
                                                   in Oct48 p_privateKey
        ) return octetstring {
          //log(">>> f_signWithEcdsaNistp384WithSha384: ", p_toBeSignedSecuredMessage);
          //log(">>> f_signWithEcdsaNistp384WithSha384: ", p_certificateIssuer);
          //log(">>> f_signWithEcdsaNistp384WithSha384: ", p_privateKey);
            return fx_signWithEcdsaNistp384WithSha384(
                p_toBeSignedSecuredMessage,
                p_certificateIssuer,
                p_privateKey
            );
            
        } // End of function f_signWithEcdsaBrainpoolp384r1WithSha384
        
        function f_decrypt(
                           in octetstring         p_encryptPrivateKey,
                           in EtsiTs103097Data    p_encrypedSecuredMessage,
@@ -618,6 +641,65 @@ module LibItsSecurity_Functions {
                p_ecdsaBrainpoolp384PublicKeyY);
        } // End of function f_verifyWithEcdsaBrainpoolp384r1WithSha384_1
        
        /**
         * @Desc    Verify the signature of the specified data
         * @param   p_toBeVerifiedData          The data to be verified
         * @param   p_certificateIssuer         The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
         * @param   p_signature                 The signature
         * @param   p_ecdsaBrainpoolp384PublicKeyX   The public key (x coordinate)
         * @param   p_ecdsaBrainpoolp384PublicKeyY   The public key (y coordinate)
         * @param   p_compressed_mode The compressed mode, 0 if the latest bit of Y-coordinate is 0, 1 otherwise
         * @return  true on success, false otherwise
         */
        function f_verifyWithEcdsaNistp384WithSha384(
                                                     in octetstring p_toBeVerifiedData,
                                                     in Oct48 p_certificateIssuer,
                                                     in Oct96 p_signature,
                                                     in Oct48 p_ecdsaBrainpoolp384PublicKeyCompressed,
                                                     in integer p_compressed_mode
        ) return boolean {
//            log("f_verifyWithEcdsaNistp384WithSha384: toBeVerifiedData", p_toBeVerifiedData);
//            log("f_verifyWithEcdsaNistp384WithSha384: toBeVerifiedData length", lengthof(p_toBeVerifiedData));
//            log("f_verifyWithEcdsaNistp384WithSha384: signature", p_signature);
//            log("f_verifyWithEcdsaNistp384WithSha384: ecdsaBrainpoolp384PublicKeyCompressed", p_ecdsaBrainpoolp384PublicKeyCompressed);
            return fx_verifyWithEcdsaNistp384WithSha384(
                                                        p_toBeVerifiedData,
                                                        p_certificateIssuer,
                                                        p_signature,
                                                        p_ecdsaBrainpoolp384PublicKeyCompressed,
                                                        p_compressed_mode
                                                        );
        } // End of function f_verifyWithEcdsaNistp384WithSha384
        
        /**
         * @Desc    Verify the signature of the specified data
         * @param   p_toBeVerifiedData          The data to be verified
         * @param   p_certificateIssuer         The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
         * @param   p_signature                 The signature
         * @param   p_ecdsaBrainpoolp384PublicKeyX   The public key (x coordinate)
         * @param   p_ecdsaBrainpoolp384PublicKeyY   The public key (y coordinate)
         * @return  true on success, false otherwise
         */
        function f_verifyWithEcdsaNistp384WithSha384_1( // TODO To be removed
                                                       in octetstring p_toBeVerifiedData,
                                                       in Oct48 p_certificateIssuer,
                                                       in Oct96 p_signature,
                                                       in Oct48 p_ecdsaBrainpoolp384PublicKeyX,
                                                       in Oct48 p_ecdsaBrainpoolp384PublicKeyY
        ) return boolean {
//            log("f_verifyWithEcdsaNistp384WithSha384_1: toBeVerifiedData", p_toBeVerifiedData);
//            log("f_verifyWithEcdsaNistp384WithSha384_1: toBeVerifiedData length", lengthof(p_toBeVerifiedData));
//            log("f_verifyWithEcdsaNistp384WithSha384_1: signature", p_signature);
//            log("f_verifyWithEcdsaNistp384WithSha384_1: ecdsaBrainpoolp384PublicKeyX", p_ecdsaBrainpoolp384PublicKeyX);
//            log("f_verifyWithEcdsaNistp384WithSha384_1: ecdsaBrainpoolp384PublicKeyY", p_ecdsaBrainpoolp384PublicKeyY);
            return fx_verifyWithEcdsaNistp384WithSha384_1(
                p_toBeVerifiedData,
                p_certificateIssuer,
                p_signature,
                p_ecdsaBrainpoolp384PublicKeyX,
                p_ecdsaBrainpoolp384PublicKeyY);
        } // End of function f_verifyWithEcdsaNistp384WithSha384_1
        
        /**
         * @desc    Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm.
         *          This function should not be used by the ATS
@@ -2721,6 +2803,14 @@ module LibItsSecurity_Functions {
             */
            external function fx_signWithEcdsaBrainpoolp256r1WithSha256(in octetstring p_toBeSignedSecuredMessage, in Oct32 p_certificateIssuer, in Oct32 p_privateKey) return octetstring;
            
            /**
             * @desc    Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature
             * @param   p_certificateIssuer           The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
             * @param   p_privateKey                  The private key for signature
             * @return  The signature value
             */
            external function fx_signWithEcdsaNistp384WithSha384(in octetstring p_toBeSignedSecuredMessage, in Oct48 p_certificateIssuer, in Oct48 p_privateKey) return octetstring;
            
            /**
             * @desc    Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature
             * @param   p_certificateIssuer           The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
@@ -2795,6 +2885,28 @@ module LibItsSecurity_Functions {
             */
            external function fx_verifyWithEcdsaBrainpoolp384r1WithSha384_1(in octetstring p_toBeVerifiedData, in Oct48 p_certificateIssuer, in Oct96 p_signature, in Oct48 p_ecdsaBrainpoolp384PublicKeyX, in Oct48 p_ecdsaBrainpoolp384PublicKeyY) return boolean;
            
            /**
             * @desc    Verify the signature of the specified data
             * @param   p_toBeVerifiedData          The data to be verified
             * @param   p_certificateIssuer         The certificate issuer
             * @param   p_signature                 The signature
             * @param   p_ecdsaBrainpoolp384PublicKeyCompressed   The compressed public key
             * @param   p_compressed_mode            The compressed mode, 0 if the latest bit of Y-coordinate is 0, 1 otherwise
             * @return  true on success, false otherwise
             */
            external function fx_verifyWithEcdsaNistp384WithSha384(in octetstring p_toBeVerifiedData, in Oct48 p_certificateIssuer, in Oct96 p_signature, in Oct48 p_ecdsaBrainpoolp384PublicKeyCompressed, in integer p_compressed_mode) return boolean;
            
            /**
             * @desc    Verify the signature of the specified data
             * @param   p_toBeVerifiedData          The data to be verified
             * @param   p_certificateIssuer         The hash of the canonical certificate issuer
             * @param   p_signature                 The signature
             * @param   p_ecdsaBrainpoolp384PublicKeyX   The public key (x coordinate)
             * @param   p_ecdsaBrainpoolp384PublicKeyY   The public key (y coordinate)
             * @return  true on success, false otherwise
             */
            external function fx_verifyWithEcdsaNistp384WithSha384_1(in octetstring p_toBeVerifiedData, in Oct48 p_certificateIssuer, in Oct96 p_signature, in Oct48 p_ecdsaBrainpoolp384PublicKeyX, in Oct48 p_ecdsaBrainpoolp384PublicKeyY) return boolean;
            
            /**
             * @desc    Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm.
             *          This function should not be used by the ATS