Abstract:
In the present disclosure, implementations of Diffie-Hellman key agreement are provided that, when embodied in software, resist extraction of cryptographically sensitive parameters during software execution by white-box attackers. Four embodiments are taught that make extraction of sensitive parameters difficult during the generation of the public key and the computation of the shared secret. The embodiments utilize transformed random numbers in the derivation of the public key and shared secret. The traditional attack model for Diffie-Hellman implementations considers only black-box attacks, where attackers analyze only the inputs and outputs of the implementation. In contrast, white-box attacks describe a much more powerful type of attacker who has total visibility into the software implementation as it is being executed.

Description:
RELATED APPLICATION DATA 
     This application claims priority to International Patent Application No. PCT/CA2012/000114, filed Feb. 9, 2012, the disclosure of which is hereby incorporated by reference in its entirety 
     FIELD OF THE INVENTION 
     The present invention relates to methods of generating and protecting cryptographic keys, and is particularly concerned with doing so in a white-box attack environment. 
     BACKGROUND OF THE INVENTION 
     Traditionally, cryptographic implementations were designed to resist only black-box attacks. These are attacks where an adversary attempts to deduce the cryptographic key inside the implementation by analyzing only inputs and outputs. In a black-box attack, it is assumed that the adversary knows what family of cryptographic algorithm they are targeting (e.g., AES, DES, RSA, etc.), but all other details (e.g. execution time, power consumption, memory accesses) are unavailable to them. In essence, a black-box attacker treats the implementation as a mathematical function. However, a white-box attacker is a much more powerful type of adversary and can analyze all parts of the implementation. Rather than just study inputs and outputs, a white-box attacker can see everything that goes on inside the implementation. For example, if the attacker is targeting cryptographic software running on, say, a PC or mobile phone, then they can execute that software inside a debugger and examine memory and register values during its execution. Conventional software implementations of cryptographic algorithms are completely insecure against white-box attackers since the cryptographic key can be observed in memory. New implementations of cryptographic algorithms that resist white-box attacks have recently been proposed (e.g., AES [1], DES [2], ECDSA [3], SHA [4]); however, there have not yet been any proposals for protecting key agreement algorithms, such as Diffie-Hellman [5]. 
     The systems and methods disclosed herein provide techniques for implementing a key agreement scheme that resists white-box attacks. 
     SUMMARY OF THE INVENTION 
     An object of the present invention is to provide methods for protecting cryptographic keys and other sensitive parameters from a white-box attacker in implementations of key agreement schemes such as Diffie-Hellman. 
     Elliptic curve Diffie-Hellman (ECDH) is a variant of traditional Diffie-Hellman (DH) where computations are done in an algebraic group defined by points on an elliptic curve. ECDH is defined in the document “SEC 1: Elliptic Curve Cryptography, Version 2.0” [8] and in “Suite B Implementer&#39;s Guide to NIST SP 800-56A” [7]. Introductory information on elliptic curve cryptography and ECDH can be found in the text “Guide to Elliptic Curve Cryptography” by Hankerson, Menezes and Vanstone [9]. At high level, ECDH works as follows: two parties exchange public keys and combine them with their respective private keys to derive a shared secret. Even though their respective private keys are different, the mathematics underlying ECDH ensures that each party will derive the same shared secret. Private keys are typically just random numbers, and a corresponding public key is computed from a private key using a mathematical operation that is computationally easy to evaluate but very computationally expensive to invert. 
     ECDH is utilized in a number of cryptographic protocols including Transport Layer Security (TLS), which is used to secure Internet web browsing, and the Full Authentication protocol, which is part of the Digital Transmission Content Protection (DTCP) system [10]. The shared key established using ECDH can be used to build a secure channel between end-parties (i.e. using symmetric key cryptography for message confidentiality and authentication). Any attacker sitting between the end-parties that records and analyzes messages exchanged during the ECDH scheme should not be able to recover the shared key unless they carry out some computation which is widely believed to be infeasible. However, in some applications, the attacker does not sit between the end-parties; instead, the attacker is able to observe the ECDH computations taking place at one of the end-parties. This is a potential concern in DTCP. 
     DTCP is a digital rights management (DRM) scheme and is commonly used to enforce permissions on video content in home networks. For example, a user might wish to stream video from their set-top box to a personal device like a laptop or mobile phone. If the rights associated with the video content permit this activity, the set-top box will initiate ECDH with the personal device to derive a shared key; the shared key is used to encrypt video content as it is transmitted to the personal device where it will be played. If an attacker was able to determine the shared key, then it would be able to record the video stream and decrypt it outside the DRM system, thereby freeing it from any restrictions. In this scenario, a legitimate user may act as an attacker if they are motivated to free video content from the DRM system. Users are able to observe the computations that take place on their personal device using a debugger and other tools. For this reason, malicious users can be modeled as white-box attackers. This leads to the following question: can an ECDH shared secret be computed in a white-box environment without exposing the shared secret to an attacker? 
     In the present disclosure, four embodiments of ECDH that are resistant to white-box attacks are provided; these embodiments can be used to build software implementations that are able to derive cryptographic keys and establish trust in hostile execution environments. Although our description focuses on the elliptic curve variant of Diffie-Hellman, one skilled in the art will appreciate that these embodiments can easily be adapted to any Diffie-Hellman scheme; this includes, in particular, Diffie-Hellman schemes where the underlying algebraic group is a subgroup of a finite field. 
     The four embodiments generate and manipulate transformed random numbers. A transformed random number is an obfuscated or masked form of an original random number. In each embodiment, a transformed random number, denoted by {circumflex over (r)} or {circumflex over ({circumflex over (r)})}, is used to generate an ECDH public key. The same transformed random number is then used to generate the shared secret. The resultant public key, generated using the transformed random number, will be the same as what would be generated using the original random number. This property also holds for generation of the shared secret. To accomplished this, some auxillary elliptic curve points must be pre-computed and utilized in the computations. 
     In the first embodiment, we generate a transformed random number {circumflex over (r)} using a linear transformation defined by two instance-specific, compile time, random numbers k 1  and k 2  chosen from the interval 1 to n−1 where n denotes the size of the underlying elliptic curve group. In the second embodiment, we generate a transformed random number {circumflex over (r)} using a linear transformation defined by one instance-specific, compile time, random number k 1 , chosen from the interval 1 to n−1. This approach is similar to the first embodiment except that only one compile time random number is used to generate the transformed random number {circumflex over (r)}. In the third embodiment, a transformed random number {circumflex over ({circumflex over (r)})} is generated by applying a pseudo-Hadamard transformation [11] to the transformed random number {circumflex over (r)} that is generated in the first embodiment. In the fourth embodiment, a transformed random number {circumflex over ({circumflex over (r)})} is generated applying a pseudo-Hadamard transformation to the transformed-random number {circumflex over (r)} that is generated in the second embodiment. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The present invention will be further understood from the following detailed description with reference to the drawings in which: 
         FIG. 1  illustrates public key generation for White-Box Elliptic Curve Diffie-Hellman (WB-ECDH) in accordance with a first embodiment of the present disclosure; 
         FIG. 2  illustrates shared secret generation for White-Box Elliptic Curve Diffie-Hellman (WB-ECDH) in accordance with the first embodiment of the present disclosure; 
         FIG. 3  illustrates public key generation for White-Box Elliptic Curve Diffie-Hellman (WB-ECDH) in accordance with a second embodiment of the present disclosure; 
         FIG. 4  illustrates shared secret generation for White-Box Elliptic Curve Diffie-Hellman (WB-ECDH) in accordance with the second embodiment of the present disclosure; 
         FIG. 5  illustrates public key generation for White-Box Elliptic Curve Diffie-Hellman (WB-ECDH) in accordance with a third embodiment of the present disclosure; 
         FIG. 6  illustrates shared secret generation for White-Box Elliptic Curve Diffie-Hellman (WB-ECDH) in accordance with the third embodiment of the present disclosure; 
         FIG. 7  illustrates public key generation for White-Box Elliptic Curve Diffie-Hellman (WB-ECDH) in accordance with a fourth embodiment of the present disclosure; and 
         FIG. 8  illustrates shared secret generation for White-Box Elliptic Curve Diffie-Hellman (WB-ECDH) in accordance with the fourth embodiment of the present disclosure. 
     
    
    
     SYMBOLS USED TO DESCRIBE THE PREFERRED EMBODIMENT 
     The following symbols are used within this disclosure to describe embodiments of the present disclosure. 
     
       
         
               
               
             
           
               
                   
               
               
                 Symbols 
                 Description 
               
               
                   
               
             
             
               
                 q 
                 An ECC domain parameter; the field size. 
               
               
                 FR 
                 Field Representation indicator. An indication of the basis 
               
               
                   
                 used for representing field elements. For the Suite B curves, 
               
               
                   
                 FR is NULL. 
               
               
                 a, b 
                 ECC domain parameters; two field elements that define the  
               
               
                   
                 equation of an elliptic curve. 
               
               
                 SEED 
                 An ECC domain parameter; an initialization value that is  
               
               
                   
                 used during domain parameter generation that can also be  
               
               
                   
                 used to provide assurance at a later time that 
               
               
                   
                 the resulting domain parameters were generated arbitrarily. 
               
               
                 G 
                 An ECC domain parameter, which is a distinguished point on an 
               
               
                   
                 elliptic curve that generates the subgroup of order n. 
               
               
                 h 
                 An ECC domain parameter; the cofactor, which is the order  
               
               
                   
                 of the elliptic curve divided by the order of the point G. 
               
               
                   
                 For the Suite B curves, h = 1. 
               
               
                 n 
                 An ECC domain parameter; the order of the point G. 
               
               
                 D 
                 The set of ECC domain parameters, (q, FR, a, b{, SEED},  
               
               
                   
                 G, n, h). 
               
               
                 d e, A , d e, B   
                 Party A&#39;s and Party B&#39;s ephemeral private keys. These  
               
               
                   
                 are integers in the range [1, n − 1]. 
               
               
                 d s, A , d s, B   
                 Party A&#39;s and Party B&#39;s static private keys. These are integers in  
               
               
                   
                 the range [1, n − 1]. 
               
               
                 O 
                 The point at infinity; a special point in an elliptic curve group 
               
               
                   
                 that serves as the (additive) identity. 
               
               
                 Q e, A , Q e, B   
                 Party A&#39;s and Party B&#39;s ephemeral public keys. These are points 
               
               
                   
                 on the elliptic curve defined by the domain parameters. 
               
               
                 Q s, A , Q s, B   
                 Party A&#39;s and Party B&#39;s static public keys. These are points on the 
               
               
                   
                 elliptic curve defined by the domain parameters. 
               
               
                 x p , y p   
                 Elements of the finite field of size q, representing, respectively, 
               
               
                   
                 the x and y coordinates of a point P. For Suite B curves,  
               
               
                   
                 these are integers in the interval [0, q − 1]. 
               
               
                 Z 
                 A shared secret that is used to derive secret keying material 
               
               
                   
                 using a key derivation function. 
               
               
                   
               
             
          
         
       
     
     Elliptic Curve Diffie-Hellman Schemes 
     ECDH is recommended by the NSA in their Suite B cryptography guidelines [6]. More precisely, Suite B recommends the use of Ephemeral Unified ECDH (EU-ECDH) and One-Pass ECDH (OP-ECDH). These two ECDH schemes are described in the Suite B implementer&#39;s guide [7]. In the Ephemeral Unified scheme, each party generates an ephemeral key pair each time they want to compute a new shared secret. In the One-Pass scheme, an ephemeral key pair is generated by only one party; the other party uses a static key pair, which may be reused in the computation of many shared secrets. The implementer&#39;s guide states that EU-ECDH is preferred over OP-ECDH; however, there are some scenarios where EU-ECDH cannot be used. This is the case, for example, in store-and-forward communication systems where one party is not available to contribute an ephemeral public key. In scenarios like this, OP-ECDH can be used. 
     Exposure of Sensitive Parameters 
     In both the EU-ECDH and OP-ECDH schemes, there are two main phases of computation: key pair generation and shared secret computation. The steps required in each phase are described in detail in the implementer&#39;s guide [7]; however, the computations in those steps leak sensitive parameters to white-box attackers. 
     The procedure for key pair generation in [7] specifies that the key pair (private key d A  and public key Q A ) be generated based on a random number r as follows: d A =r+1, and Q A =d A G. Note that “d A G” denotes the elliptic curve point formed by adding the generator G to itself d A  times. The procedure for shared secret computation specifies that the shared secret, Z, be computed as the x-coordinate of an elliptic curve point P defined as follows: P=d A Q B =(r+1)Q B , where d A  is party A&#39;s private key and Q B  is party B&#39;s public key. 
     Straightforward implementations of key pair generation and shared secret computation on party A&#39;s device will expose the secret key d A  in that device&#39;s memory. This is apparent for the computations that produce d A =r+1, Q A =d A G, and P=d A Q B . Thus, a white-box attacker that examines memory-dumps of party A&#39;s device will be able to deduce the private key, d A , as well as the shared secret, Z. To maintain security against white-box attackers, the computations executed for key pair generation and shared secret computation must be protected. 
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
       FIG. 1  illustrates the process of key pair generation for our proposed White-Box Elliptic Curve Diffie-Hellman (WB-ECDH) implementation, in accordance with a first embodiment of the present disclosure.  FIG. 2  illustrates the process of shared secret computation. 
     Key Pair Generation. 
     Each static and ephemeral private key d and public key Q shall be generated using the appropriate domain parameters, D, which must be selected from one of the two sets of domain parameters specified in the list of Suite B elliptic curves and domain parameters (see Appendix A of [7]). Henceforth, we assume that domain parameters have been appropriately selected. 
     Target: 
     Compute Q=dG without disclosing d inside the memory of one party&#39;s machine, where Q=dG=(r+1)G, r is the random number. Q is the public key, and may represent any one of Q e,A , Q e,B  or Q s,B  depending on the particular ECDH scheme (EU-ECDH or OP-ECDH). d is the private key, and, similarly, it may represent any one of d e,A , d e,B  or d s,B . 
     Transformed Random Number: 
     In this embodiment, the transformation t of a random number r is denoted as {circumflex over (r)} and defined as {circumflex over (r)}=t(r)=k 1 r+k 2  mod n, where k 1  and k 2  are two instance-specific, compile time, random numbers and k 1 , k 2 εZ n * (note that Z n * denotes the set of integers in the range 1 to n−1 that are relatively prime to the domain parameter n). Thus, {circumflex over (r)}=k 1 r+k 2  mod n and r=k 1   −1 {circumflex over (r)}−k 2 k 1   −1  mod n. It is important to note that the output of the random bit generator (RBG) used in key pair generation is interpreted as producing transformed random numbers. This means that the transformation t(r) does not have to be explicitly applied by the implementation—the transformation is implicit in the way in which the output of the RBG is interpreted. 
     Precomputation: 
     Once the instance-specific, compile time, random numbers k 1  and k 2  are selected, two auxiliary elliptic curve points are pre-computed: Ĝ=k 1   −1 G and U 2 =(k 1 −k 2 )Ĝ. These two points are computed during an off-line set-up phase where the implementation is not subject to white-box attacks (e.g. at compilation time). 
     The steps of key pair generation are as follows: 
     Input: 
     None. 
     Output:
         1. Status: The status returned from the key pair generation procedure. The status will indicate SUCCESS or an ERROR.   2. {circumflex over (r)} A transformed random number.   3. Q: The generated public key.       

     Process:
         1. Set N=len(n) (i.e. set N equal to the bit length of the domain parameter n). Check that N is valid, that is, N=256 or N=384 (the only valid lengths for Suite B).   2. If N is invalid, then return an ERROR indication.   3. Set requested_security_strength=the security strength associated with N (either 128 when using P-256 or 192 when using P-384).   4. Obtain a string of N bits (b′ 1 , b′ 2 , . . . , b′ N ) from a Random Bit Generator (RBG) with a security strength of requested_security_strength or more, which generates the transformed random number {circumflex over (r)}=k 1 r+k 2  mod n. If an ERROR indication is returned, then return the ERROR indication.   5. Compute U 1 ={circumflex over (r)}Ĝ (recall that Ĝ=k 1   −1 G was precomputed).   6. Compute Q=U 1 +U 2  (recall that U 2 =(k 1 −k 2 )Ĝ was precomputed).   7. Return SUCCESS, {circumflex over (r)} and Q.       

     Verification: 
     It can be shown that the previous procedure produces a public key that is compatible with the original procedure given in [7]. The original procedure produces a public key Q=(r+1)G; for the new procedure, we have 
                   Q   =       ⁢       U   1     +     U   2                   =       ⁢         r   ^     ⁢     G   ^       +       (       k   1     -     k   2       )     ⁢     G   ^                     =       ⁢         r   ^     ⁢     k     -   1       ⁢   G     +       (       k   1     -     k   2       )     ⁢     k   1     -   1       ⁢   G                   =       ⁢       (         k   1     -   1       ⁢     r   ^       -       k   2     ⁢     k   1     -   1         +       k   1     ⁢     k   1     -   1           )     ⁢   G                 =       ⁢       (         k   1     -   1       ⁢     r   ^       -       k   2     ⁢     k   1     -   1         +   1     )     ⁢   G                 =       ⁢       (     r   +   1     )     ⁢   G                 
Cost:
 
     In our proposed key pair generation procedure, the cost of elliptic curve computations is as follows. Three elliptic curve point multiplications are required, two of which are offline and one is online. One elliptic curve point addition is required. 
     Shared Secret Computation. 
     Party A computes the shared secret Z, which is the x-coordinate of an elliptic curve point, using the appropriate domain parameters D, party B&#39;s public key (Q B ), and their transformed random number {circumflex over (r)} A . Party B computes the shared secret in an analogously, using party A&#39;s public key and their own transformed random number. We continue 
     Target: 
     Compute P=(r A +1)Q B  without disclosing r A  (party A&#39;s random number) inside the memory of party A&#39;s machine. 
     Precomputation: 
     Let k 1(A)  and k 2(A)  denote party A&#39;s instance-specific, compile time, random numbers. Party A should pre-compute the integer values s=k 1(A)   −1  mod n and t=k 1(A) −k 2(A) mod n. These two values are computed during an off-line set-up phase where the implementation is not subject to white-box attacks (e.g. at compilation time). If party B&#39;s public key is known in advance, as is the case in OP-ECDH, then further pre-computation can be done. When doing OP-ECDH, the elliptic curve points {circumflex over (Q)} B     1   =sQ B =k 1(A)   −1 Q B  and {circumflex over (Q)} B     3   =t{circumflex over (Q)} B     1   =(k 1(A) −k 2(A) ){circumflex over (Q)} B     1    should be computed off-line. 
     The steps of shared secret computation are as follows: 
     Input:
         1. {circumflex over (r)} A : Party A&#39;s transformed random number (recall that r A =k 1(A)   −1 {circumflex over (r)} A −k 2(A) k 1(A)   −1  mod n).   2. Q B : The other party&#39;s (party B) public key.       

     Output: 
     The shared secret Z or an error indicator. 
     Process:
         1. Compute points {circumflex over (Q)} B     1   =sQ B =k 1(A)   −1 Q B ; {circumflex over (Q)} B     2   ={circumflex over (r)} A {circumflex over (Q)} B     1   ; and {circumflex over (Q)} B     3   =t{circumflex over (Q)} B     1   =(k 1(A) −k 2(A) ){circumflex over (Q)} B     1        2. Compute P={circumflex over (Q)} B     2   +{circumflex over (Q)} B     3        3. If P=O, the point at infinity, output an error indicator.   4. Z=x P  where x P  is the x-coordinate of P.       

     Verification: 
     It can be shown that the previous procedure, which is summarized in  FIG. 2 , produces a shared secret that is compatible with the original procedure given in [7]. The original procedure produces a shared secret equal to (r A +1)Q B ; for the new procedure, we have 
     
       
         
           
             
               
                 
                   P 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         Q 
                         ^ 
                       
                       
                         B 
                         2 
                       
                     
                     + 
                     
                       
                         Q 
                         ^ 
                       
                       
                         B 
                         3 
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         
                           r 
                           ^ 
                         
                         A 
                       
                       ⁢ 
                       
                         
                           Q 
                           ^ 
                         
                         
                           B 
                           1 
                         
                       
                     
                     + 
                     
                       
                         ( 
                         
                           
                             k 
                             
                               1 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                           
                           - 
                           
                             k 
                             
                               2 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         
                           Q 
                           ^ 
                         
                         
                           B 
                           1 
                         
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         
                           r 
                           ^ 
                         
                         A 
                       
                       ⁢ 
                       
                         k 
                         
                           1 
                           ⁢ 
                           
                             ( 
                             A 
                             ) 
                           
                         
                         
                           - 
                           1 
                         
                       
                       ⁢ 
                       
                         Q 
                         B 
                       
                     
                     - 
                     
                       
                         k 
                         
                           2 
                           ⁢ 
                           
                             ( 
                             A 
                             ) 
                           
                         
                       
                       ⁢ 
                       
                         k 
                         
                           1 
                           ⁢ 
                           
                             ( 
                             A 
                             ) 
                           
                         
                         
                           - 
                           1 
                         
                       
                       ⁢ 
                       
                         Q 
                         B 
                       
                     
                     + 
                     
                       
                         k 
                         
                           1 
                           ⁢ 
                           
                             ( 
                             A 
                             ) 
                           
                         
                       
                       ⁢ 
                       
                         k 
                         
                           1 
                           ⁢ 
                           
                             ( 
                             A 
                             ) 
                           
                         
                         
                           - 
                           1 
                         
                       
                       ⁢ 
                       
                         Q 
                         B 
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           
                             k 
                             
                               1 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                             
                               - 
                               1 
                             
                           
                           ⁢ 
                           
                             
                               r 
                               ^ 
                             
                             A 
                           
                         
                         - 
                         
                           
                             k 
                             
                               2 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                           
                           ⁢ 
                           
                             k 
                             
                               1 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                             
                               - 
                               1 
                             
                           
                         
                         + 
                         
                           
                             k 
                             
                               1 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                           
                           ⁢ 
                           
                             k 
                             
                               1 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                             
                               - 
                               1 
                             
                           
                         
                       
                       ) 
                     
                     ⁢ 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           r 
                           A 
                         
                         + 
                         1 
                       
                       ) 
                     
                     ⁢ 
                     
                       Q 
                       B 
                     
                   
                 
               
             
           
         
       
     
     Cost: 
     In our proposed shared secret computation procedure, the cost of elliptic curve computations is as follows. Three elliptic curve point multiplications required. For OP-ECDH, two of the point multiplications are off-line and one is online; for EU-ECDH, all three point multiplications are online. One elliptic curve point addition is required. 
     The second embodiment of the disclosure is a reduced version of the first embodiment. The second embodiment is described with reference to  FIGS. 3 and 4 . The main concern in this design is computational efficiency. 
     Key Pair Generation. 
     We now describe key pair generation. 
     Target: 
     Compute Q=dG without disclosing d inside the memory of one party&#39;s machine. 
     Transformed Random Number: 
     In this embodiment, the transformation of the random number r is defined as {circumflex over (r)}=t(r)=k 1 r mod n, where k 1  is an instance specific, compile time random number selected from the set Z n *. Thus, {circumflex over (r)}=k 1 r mode and r=k 1   −1 {circumflex over (r)} mod n. 
     Precomputation: 
     Once the instance-specific, compile time, random number k 1  is selected, an auxiliary elliptic curve point is pre-computed: Ĝ=k 1   −1 G. As in the first embodiment, this point should be computed during an off-line set-up phase where the implementation is not subject to white-box attacks (e.g. at compilation time). 
     The steps of key pair generation are as follows: 
     Input and Output are the same as that of the first embodiment. 
     Process:
         1. Steps 1, 2 and 3 are the same as of the first embodiment.   4. Obtain a string of N bits (b′ 1 , b′ 2 , . . . , b′ N ) from a Random Bit Generator (RBG) with a security strength of requested_security_strength or more, which generates the transformed random number {circumflex over (r)}=k 1 r mod n. If an ERROR indication is returned, then return the ERROR indication.   5. Compute U 1 ={circumflex over (r)}Ĝ (recall that Ĝ=k 1   −1 G was pre-computed).   6. Compute Q=U 1 +G   7. Return SUCCESS, {circumflex over (r)} and Q.       

     Verification: 
     The following sequence of identities show that the previous procedure produces a public key that is compatible with the original procedure given in [7]: 
     
       
         
           
             
               
                 
                   Q 
                   = 
                     
                   ⁢ 
                   
                     
                       U 
                       1 
                     
                     + 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         r 
                         ^ 
                       
                       * 
                       
                         G 
                         ^ 
                       
                     
                     + 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         r 
                         ^ 
                       
                       * 
                       
                         k 
                         1 
                         
                           - 
                           1 
                         
                       
                       * 
                       G 
                     
                     + 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           
                             k 
                             1 
                             
                               - 
                               1 
                             
                           
                           * 
                           
                             r 
                             ^ 
                           
                         
                         + 
                         1 
                       
                       ) 
                     
                     * 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         r 
                         + 
                         1 
                       
                       ) 
                     
                     ⁢ 
                     G 
                   
                 
               
             
           
         
       
     
     Cost: 
     The costs of elliptic curve computations for key pair generation are now as follows. Two elliptic curve point multiplications are required (one online and one offline). One elliptic curve point addition is required. 
     Shared Secret Computation: 
     We explain shared secret computation from the perspective of Party A. Party A will use the appropriate domain parameters D, the other party&#39;s public key (Q B ), and their transformed random number {circumflex over (r)} A  to compute Z, which is the x-coordinate of an elliptic curve point P. 
     Target: 
     Compute P=(r A +1)Q B  without disclosing r A  inside the memory of party A&#39;s machine. 
     Precomputation: 
     Let k 1(A)  denote party A&#39;s instance-specific, compile time, random number. Party A should pre-compute the integer values s=k 1(A)   −1  mod n. This value should be computed during an off-line set-up phase where the implementation is not subject to white-box attacks (e.g. at compilation time). If party B&#39;s public key is known in advance, as is the case in OP-ECDH, then further pre-computation can be done. When doing OP-ECDH, the elliptic curve point {circumflex over (Q)} B     1   =sQ B =k 1(A)   −1 Q B  should be computed off-line. 
     The steps are as follows: 
     Input:
         1. {circumflex over (r)} A : Party A&#39;s transformed random number (recall that r A =k 1(A)   −1 {circumflex over (r)} A  mod n).   2. Q B : The other party&#39;s (party B) public key.       

     Output: 
     The shared secret Z or an error indicator. 
     Process:
         1. Compute points {circumflex over (Q)} B     1   =sQ B =k 1(A)   −1 Q B ; and {circumflex over (Q)} B     2   ={circumflex over (r)} A {circumflex over (Q)} B     1        2. P={circumflex over (Q)} B     2   +Q B      3. If P=O, the point at infinity, output an error indicator.   4. Z=x P  where x P  is the x-coordinate of P.       

     Verification: 
     It can be shown that the previous procedure, which is summarized in  FIG. 4 , produces a shared secret that is compatible with the original procedure given in [7]. Consider the following sequence of identities: 
     
       
         
           
             
               
                 
                   P 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         Q 
                         ^ 
                       
                       
                         B 
                         2 
                       
                     
                     + 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         
                           r 
                           ^ 
                         
                         A 
                       
                       * 
                       
                         
                           Q 
                           ^ 
                         
                         
                           B 
                           1 
                         
                       
                     
                     + 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         
                           r 
                           ^ 
                         
                         A 
                       
                       * 
                       
                         k 
                         
                           1 
                           ⁢ 
                           
                             ( 
                             A 
                             ) 
                           
                         
                         
                           - 
                           1 
                         
                       
                       * 
                       
                         Q 
                         B 
                       
                     
                     + 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           
                             k 
                             
                               1 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                             
                               - 
                               1 
                             
                           
                           * 
                           
                             
                               r 
                               ^ 
                             
                             A 
                           
                         
                         + 
                         1 
                       
                       ) 
                     
                     * 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           r 
                           A 
                         
                         + 
                         1 
                       
                       ) 
                     
                     * 
                     
                       Q 
                       B 
                     
                   
                 
               
             
           
         
       
     
     Cost: 
     The costs of elliptic curve computations for shared secret computation are now as follows. Two elliptic curve point multiplications are required. For OP-ECDH, one point multiplication is off-line and one is online. For EU-ECDH, both point multiplications are online. One elliptic curve point addition is required (for both OP-ECDH and EU-ECDH). 
     The second embodiment is a reduced version of the first embodiment. One instance specific random number is removed from the first embodiment, which reduces the number of elliptic curve computations, but possibly sacrifices security strength. This methodology is suitable for those applications where computational efficiency is a prime concern. 
     The third embodiment is described with reference to  FIGS. 5 and 6 . 
     Key Pair Generation: 
     The third embodiment is an enhanced version of the first embodiment where security strength is a prime concern. The computational cost of this embodiment is higher. 
     Target: 
     Compute Q=dG without disclosing d inside the memory of one party&#39;s machine. 
     Transformed Random Numbers: 
     In this methodology, the Random Bit Generator generates two transformed random numbers {circumflex over ({circumflex over (r)})} 11  and {circumflex over ({circumflex over (r)})} 22  that, in combination, encode two random numbers r 1  and r 2 . The resultant public key, Q, may be generated using either r 1  or r 2 , and this choice may be made at runtime within the key pair generation procedure. Thus, our proposed procedure can compute Q=dG=(r 1 +1)G or Q=dG=(r 2 +1)G. The values {circumflex over ({circumflex over (r)})} 11  and {circumflex over ({circumflex over (r)})} 22  output by the RBG are interpreted as being produced by two layers of transformations. One layer corresponds to the same transformation technique of the first embodiment; namely, a linear transform using instance specific, compile time random numbers drawn from the set Z n *. The second layer is a pseudo-Hadamard transformation [11], which ensures that r 1  and r 2  can only be recovered from the combination of both {circumflex over ({circumflex over (r)})} 11  and {circumflex over ({circumflex over (r)})} 22 . 
     More precisely, {circumflex over ({circumflex over (r)})} 11  and {circumflex over ({circumflex over (r)})} 22  are interpreted as follows:
 
 {circumflex over ({circumflex over (r)})}   11   ={circumflex over (r)}   1   +{circumflex over (r)}   2  mod 2 N  
 
 {circumflex over ({circumflex over (r)})}   22   ={circumflex over (r)}   1 +2 {circumflex over (r)}   2  mod 2 N .
 
We interpret {circumflex over ({circumflex over (r)})} 11  and {circumflex over ({circumflex over (r)})} 22  as being the result of a pseudo-Hadamard transform applied to the values {circumflex over (r)} 1  and {circumflex over (r)} 2 . Note that N is equal to the bit length of the domain parameter n, and {circumflex over (r)} 1  and {circumflex over (r)} 2  are transformed values that encode r 1  and r 2  respectively. To recover {circumflex over (r)} 2  from {circumflex over ({circumflex over (r)})} 11  and {circumflex over ({circumflex over (r)})} 22 , we compute {circumflex over ({circumflex over (r)})} 22 −{circumflex over ({circumflex over (r)})} 11  mod 2 N ; and to recover {circumflex over (r)} 1  we compute 2{circumflex over ({circumflex over (r)})} 11 −{circumflex over ({circumflex over (r)})} 22  mod 2 N . The definition of {circumflex over (r)} 1  and {circumflex over (r)} 2  is
 
 {circumflex over (r)}   1   =k   11   r   1   +k   12  mod  n  
 
 {circumflex over (r)}   2   =k   21   r   2   +k   22  mod  n  
 
Here, k 11 , k 12 , k 21 , k 22  are instance specific, compile time random numbers drawn from the set Z n *. As in the first embodiment, we have r 1 =k 11   −1 {circumflex over (r)} 1 −k 12 k 11   −1  mod n and r 2 =k 21   −1 {circumflex over (r)} 2 −k 22 k 21   −1  mod n.
 
     Precomputation: 
     Once the instance-specific, compile time, random numbers k 11 , k 12 , k 21 , k 22  are selected, two sets of auxiliary elliptic curve points are pre-computed: Ĝ 11 =k 11   −1 G, Ĝ 12 =k 11   −1 Ĝ 11 , U 12 =(k 11 −k 12 )Ĝ 11  and Ĝ 21 =k 21   −1 G, Ĝ 22 =k 21   −1 Ĝ 21 , U 22 =(k 21 −k 22 )Ĝ 21 . As in the first embodiment, these points should be computed during an off-line set-up phase where the implementation is not subject to white-box attacks (e.g. at compilation time). 
     The steps of key pair generation are as follows: 
     Input and Output are the same as that of the first embodiment. 
     Process:
         1. Steps 1, 2 and 3 are the same as that of the first embodiment.   4. Obtain strings of N bits (b′ 11 , b′ 12 , . . . , b′ IN ) and (b′ 21 , b′ 22 , . . . , b′ 2N ) from a Random Bit Generator (RBG) with a security strength of requested_security_strength or more, which generates the transformed random numbers {circumflex over ({circumflex over (r)})} 11 =({circumflex over (r)} 1 +{circumflex over (r)} 2 )mod 2 N  and {circumflex over ({circumflex over (r)})} 22 =({circumflex over (r)} 1 +2{circumflex over (r)} 2 )mod 2 N . If an ERROR indication is returned, then return the ERROR indication.   5. If (“r 1 ” is chosen), then
           a. Compute u 11 =(2{circumflex over ({circumflex over (r)})} 11 −{circumflex over ({circumflex over (r)})} 22  mod 2 N )k 11  mod n.   b. Compute Q=u 11 Ĝ 12 +U 12  (recall that Ĝ 12  and U 12  were pre-computed)   
           6. If (“r 2 ” is chosen), then
           c. Compute u 21 =({circumflex over ({circumflex over (r)})} 22 −{circumflex over ({circumflex over (r)})} 11  mod 2 N )k 21 .   d. Q=u 21 *Ĝ 22 +U 22  (recall that Ĝ 22  and U 22  were pre-computed)   
           7. Return SUCCESS, {circumflex over ({circumflex over (r)})} 11 , {circumflex over ({circumflex over (r)})} 22  and Q.       

     Verification: 
     The procedure is illustrated in  FIG. 5  and it can be verified that the resultant Q is equal to either (r 1 +1)G or (r 2 +1)G as follows: 
     
       
         
           
             
               
                 
                   Q 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         u 
                         11 
                       
                       ⁢ 
                       
                         
                           G 
                           ^ 
                         
                         12 
                       
                     
                     + 
                     
                       U 
                       12 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         ( 
                         
                           
                             2 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 
                                   r 
                                   ^ 
                                 
                                 ^ 
                               
                               11 
                             
                           
                           - 
                           
                             
                               
                                 
                                   r 
                                   ^ 
                                 
                                 ^ 
                               
                               22 
                             
                             ⁢ 
                             mod 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               2 
                               N 
                             
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         k 
                         11 
                       
                       ⁢ 
                       
                         k 
                         11 
                         
                           - 
                           1 
                         
                       
                       * 
                       
                         
                           G 
                           ^ 
                         
                         11 
                       
                     
                     + 
                     
                       U 
                       12 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         
                           r 
                           ^ 
                         
                         1 
                       
                       ⁢ 
                       
                         k 
                         11 
                         
                           - 
                           1 
                         
                       
                       ⁢ 
                       G 
                     
                     + 
                     
                       
                         ( 
                         
                           
                             k 
                             11 
                           
                           - 
                           
                             k 
                             12 
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         
                           G 
                           ^ 
                         
                         11 
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           
                             k 
                             11 
                             
                               - 
                               1 
                             
                           
                           ⁢ 
                           
                             
                               r 
                               ^ 
                             
                             1 
                           
                         
                         - 
                         
                           
                             k 
                             12 
                           
                           ⁢ 
                           
                             k 
                             11 
                             
                               - 
                               1 
                             
                           
                         
                         + 
                         
                           
                             k 
                             11 
                           
                           ⁢ 
                           
                             k 
                             11 
                             
                               - 
                               1 
                             
                           
                         
                       
                       ) 
                     
                     ⁢ 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           r 
                           1 
                         
                         + 
                         1 
                       
                       ) 
                     
                     ⁢ 
                     G 
                   
                 
               
             
           
         
       
       
         
           
             
               
                 
                   Q 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         u 
                         21 
                       
                       * 
                       
                         
                           G 
                           ^ 
                         
                         22 
                       
                     
                     + 
                     
                       U 
                       22 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         ( 
                         
                           
                             
                               
                                 r 
                                 ^ 
                               
                               ^ 
                             
                             22 
                           
                           - 
                           
                             
                               
                                 
                                   r 
                                   ^ 
                                 
                                 ^ 
                               
                               11 
                             
                             ⁢ 
                             mod 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               2 
                               N 
                             
                           
                         
                         ) 
                       
                       * 
                       
                         k 
                         21 
                       
                       * 
                       
                         k 
                         21 
                         
                           - 
                           1 
                         
                       
                       * 
                       
                         
                           G 
                           ^ 
                         
                         21 
                       
                     
                     + 
                     
                       U 
                       22 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         
                           r 
                           ^ 
                         
                         2 
                       
                       * 
                       
                         k 
                         21 
                         
                           - 
                           1 
                         
                       
                       * 
                       G 
                     
                     + 
                     
                       
                         ( 
                         
                           
                             k 
                             21 
                           
                           - 
                           
                             k 
                             22 
                           
                         
                         ) 
                       
                       * 
                       
                         
                           G 
                           ^ 
                         
                         21 
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           
                             k 
                             21 
                             
                               - 
                               1 
                             
                           
                           * 
                           
                             
                               r 
                               ^ 
                             
                             2 
                           
                         
                         - 
                         
                           
                             k 
                             22 
                           
                           * 
                           
                             k 
                             21 
                             
                               - 
                               1 
                             
                           
                         
                         + 
                         
                           
                             k 
                             21 
                           
                           * 
                           
                             k 
                             21 
                             
                               - 
                               1 
                             
                           
                         
                       
                       ) 
                     
                     * 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           r 
                           2 
                         
                         + 
                         1 
                       
                       ) 
                     
                     ⁢ 
                     G 
                   
                 
               
             
           
         
       
     
     Shared Secret Computation: 
     We explain shared secret computation from the perspective of Party A. Party A will use the appropriate domain parameters D, the other party&#39;s public key (Q B ), and their own transformed random numbers {circumflex over ({circumflex over (r)})} 11(A) ,{circumflex over ({circumflex over (r)})} 22(A)  to compute Z. 
     Target: 
     Without disclosing r 1(A)  and r 2(A)  inside the memory of the party A&#39;s machine, compute P=(r 1(A) +1)Q B  or P=(r 2(A) +1)Q B  depending on whether r 1(A) +1 or r 2(A) +1 was selected as party A&#39;s private key. 
     Precomputation: 
     Let k 11(A) , k 12(A) , k 21(A) , k 22(A)  denote party A&#39;s instance-specific, compile time, random numbers. Party A should pre-compute the integer values s 1 =k 11(A)   −1  mod n and s 2 =k 21(A)   −1  mod n. These values should be computed during an off-line set-up phase where the implementation is not subject to white-box attacks (e.g. at compilation time). If party B&#39;s public key is known in advance, as is the case in OP-ECDH, then further pre-computation can be done. When doing OP-ECDH, the elliptic curve points {circumflex over (Q)} B     11   =s 1 Q B =k 11(A)   −1 Q B , {circumflex over (Q)} B     12   =(k 11(A) −k 12(A) ){circumflex over (Q)} B     11   , {circumflex over (Q)} B     21   =s 2 Q B =k 21(A)   −1 Q B , and {circumflex over (Q)} B     22   =(k 21(A) −k 22(A) ){circumflex over (Q)} B     21    should be computed off-line. 
     The steps are as follows: 
     Input:
         1. {circumflex over ({circumflex over (r)})} 11(A) ,{circumflex over ({circumflex over (r)})} 22(A) : Party A&#39;s transformed random numbers.   2. Q B : The other party&#39;s (party B) public key.       

     Output: 
     The shared secret Z or an error indicator. 
     Process:
         1. If (“r 1 ” was chosen), then
           A. Compute {circumflex over (Q)} B     11   =s 1 Q B , {circumflex over (Q)} B     12   =(k 11(A) −k 12(A) ){circumflex over (Q)} B     11    and {circumflex over (Q)} B     13   =(2{circumflex over ({circumflex over (r)})} 11(A) −{circumflex over ({circumflex over (r)})} 22(A) mod 2 N ){circumflex over (Q)} B     11    (recall that s 1  was pre-computed).   B. P={circumflex over (Q)} B     12   +{circumflex over (Q)} B     13        C. If P=O, the point at infinity, output an error indicator.   D. Z=x P  where x P  is the x-coordinate of P.   
           2. If (“r 2 ” was chosen), then
           A. Compute {circumflex over (Q)} B     21   =s 2 Q B , {circumflex over (Q)} B     22   =(k 21(A) −k 22(A) ){circumflex over (Q)} B     21    and {circumflex over (Q)} B     23   =({circumflex over ({circumflex over (r)})} 22(A) −{circumflex over ({circumflex over (r)})} 11(A) mod 2 N ){circumflex over (Q)} B     21    (recall that s 2  was pre-computed).   B. P={circumflex over (Q)} B     22   +{circumflex over (Q)} B     23        C. If P=O, the point at infinity, output an error indicator.   D. Z=x P  where x P  is the x-coordinate of P.   
               

     Verification: 
     The procedure is illustrated in  FIG. 6 . The correctness of the procedure can be verified as follows: 
     
       
         
           
             
               
                 
                   P 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         Q 
                         ^ 
                       
                       
                         B 
                         12 
                       
                     
                     + 
                     
                       
                         Q 
                         ^ 
                       
                       
                         B 
                         13 
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         Q 
                         ^ 
                       
                       
                         B 
                         12 
                       
                     
                     + 
                     
                       
                         ( 
                         
                           
                             2 
                             * 
                             
                               
                                 
                                   r 
                                   ^ 
                                 
                                 ^ 
                               
                               
                                 11 
                                 ⁢ 
                                 
                                   ( 
                                   A 
                                   ) 
                                 
                               
                             
                           
                           - 
                           
                             
                               
                                 
                                   r 
                                   ^ 
                                 
                                 ^ 
                               
                               
                                 22 
                                 ⁢ 
                                 
                                   ( 
                                   A 
                                   ) 
                                 
                               
                             
                             ⁢ 
                             mod 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               2 
                               N 
                             
                           
                         
                         ) 
                       
                       * 
                       
                         
                           Q 
                           ^ 
                         
                         
                           B 
                           11 
                         
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           
                             k 
                             
                               11 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                             
                               - 
                               1 
                             
                           
                           * 
                           
                             
                               r 
                               ^ 
                             
                             
                               1 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                           
                         
                         - 
                         
                           
                             k 
                             
                               12 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                           
                           * 
                           
                             k 
                             
                               11 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                             
                               - 
                               1 
                             
                           
                         
                         + 
                         
                           
                             k 
                             11 
                           
                           * 
                           
                             k 
                             11 
                             
                               - 
                               1 
                             
                           
                         
                       
                       ) 
                     
                     * 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           r 
                           
                             1 
                             ⁢ 
                             
                               ( 
                               A 
                               ) 
                             
                           
                         
                         + 
                         1 
                       
                       ) 
                     
                     ⁢ 
                     
                       Q 
                       B 
                     
                   
                 
               
             
           
         
       
       
         
           
             
               
                 
                   P 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         Q 
                         ^ 
                       
                       
                         B 
                         22 
                       
                     
                     + 
                     
                       
                         Q 
                         ^ 
                       
                       
                         B 
                         23 
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         Q 
                         ^ 
                       
                       
                         B 
                         22 
                       
                     
                     + 
                     
                       
                         ( 
                         
                           
                             
                               
                                 r 
                                 ^ 
                               
                               ^ 
                             
                             
                               22 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                           
                           - 
                           
                             
                               
                                 
                                   r 
                                   ^ 
                                 
                                 ^ 
                               
                               
                                 11 
                                 ⁢ 
                                 
                                   ( 
                                   A 
                                   ) 
                                 
                               
                             
                             ⁢ 
                             mod 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               2 
                               N 
                             
                           
                         
                         ) 
                       
                       * 
                       
                         
                           Q 
                           ^ 
                         
                         
                           B 
                           21 
                         
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           
                             k 
                             
                               21 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                             
                               - 
                               1 
                             
                           
                           * 
                           
                             
                               r 
                               ^ 
                             
                             
                               2 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                           
                         
                         - 
                         
                           
                             k 
                             
                               22 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                           
                           * 
                           
                             k 
                             
                               21 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                             
                               - 
                               1 
                             
                           
                         
                         + 
                         
                           
                             k 
                             21 
                           
                           * 
                           
                             k 
                             21 
                             
                               - 
                               1 
                             
                           
                         
                       
                       ) 
                     
                     * 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           r 
                           
                             2 
                             ⁢ 
                             
                               ( 
                               A 
                               ) 
                             
                           
                         
                         + 
                         1 
                       
                       ) 
                     
                     ⁢ 
                     
                       Q 
                       B 
                     
                   
                 
               
             
           
         
       
     
     The third embodiment may be the most resistant to white-box attacker. In this embodiment, two random numbers use to make it more difficult for the attacker to follow the execution path of the program. Furthermore, two transformations are used to mask the random numbers. As a result, computational efficiency is degraded. The third embodiment is suitable for those applications where security strength is the main concern. 
     The fourth embodiment is described with reference to  FIGS. 7 and 8 . 
     Key Pair Generation: 
     The fourth embodiment is an enhanced version of the second embodiment. 
     Target: 
     Compute Q=dG without disclosing d inside the memory of one party&#39;s machine. 
     Transformed Random Numbers: 
     As was done the in third embodiment, the fourth embodiment uses the random bit generator to generate two transformed random numbers {circumflex over ({circumflex over (r)})} 11  and {circumflex over ({circumflex over (r)})} 22  that, in combination, encode two random numbers r 1  and r 2 . The resultant public key, Q, may be generated using either r 1  or r 2 , and this choice may be made at runtime within the key pair generation procedure. The values {circumflex over ({circumflex over (r)})} 11  and {circumflex over ({circumflex over (r)})} 22  output by the RBG are interpreted as being produced by two layers of transformations. One layer corresponds to the transformation technique of the second embodiment; namely, a linear transform using instance specific, compile time random numbers drawn from the set Z n *. The second layer is a pseudo-Hadamard transformation, as in the third embodiment. 
     More precisely, {circumflex over ({circumflex over (r)})} 11  and {circumflex over ({circumflex over (r)})} 22  are interpreted as follows:
 
 {circumflex over ({circumflex over (r)})}   11   ={circumflex over (r)}   1   +{circumflex over (r)}   2  mod 2 N  
 
 {circumflex over ({circumflex over (r)})}   22   ={circumflex over (r)}   1 +2 {circumflex over (r)}   2  mod 2 N .
 
We interpret {circumflex over ({circumflex over (r)})} 11  and {circumflex over ({circumflex over (r)})} 22  as being the result of a pseudo-Hadamard transform applied to the values {circumflex over (r)} 1  and {circumflex over (r)} 2 . Note that N is equal to the bit length of the domain parameter n, and {circumflex over (r)} 1  and {circumflex over (r)} 2  are transformed values that encode r 1  and r 2  respectively. To recover {circumflex over (r)} 2  from {circumflex over (r)} 11  and {circumflex over (r)} 22 , we compute {circumflex over ({circumflex over (r)})} 22 −{circumflex over ({circumflex over (r)})} 11  mod 2 N ; and to recover {circumflex over (r)} 1  we compute 2{circumflex over ({circumflex over (r)})} 11 −{circumflex over ({circumflex over (r)})} 22  mod 2 N . The definition of {circumflex over (r)} 1  and {circumflex over (r)} 2  is
 
 {circumflex over (r)}   1   =k   11   r   1  mod  n  
 
 {circumflex over (r)}   2   =k   21   r   2  mod  n  
 
Here, k 11 , k 21  are instance specific, compile time random numbers drawn from the set Z n *. As in the second embodiment, we have r 1 =k 11   −1 {circumflex over (r)} 1  mod n and r 2 =k 21   −1 {circumflex over (r)} 2  mod n.
 
     Precomputation: 
     Once the instance-specific, compile time, random numbers k 11 ,k 21  are selected, two sets of auxiliary elliptic curve points are pre-computed: Ĝ 11 =k 11   −1 G, Ĝ 12 =k 11   −1 Ĝ 11  and Ĝ 21 =k 21   −1 G, Ĝ 22 =k 21   −1 Ĝ 21 . As in the first embodiment, these points should be computed during an off-line set-up phase where the implementation is not subject to white-box attacks (e.g. at compilation time). 
     The steps of key pair generation are as follows: 
     Input and Output are the same as that of the third embodiment. 
     Process:
         1. Steps 1, 2 and 3 are the same as that of the first embodiment.   4. Obtain strings of N bits (b′ 11 , b′ 12 , . . . , b′ 1N ) and (b′ 21 , b′ 22 , . . . , b′ 2N ) from a Random Bit Generator (RBG) with a security strength of requested_security_strength or more, which generates the transformed random numbers {circumflex over ({circumflex over (r)})} 11 =({circumflex over (r)} 1 +{circumflex over (r)} 2 )mod 2 N  and {circumflex over ({circumflex over (r)})} 22 =({circumflex over (r)} 1 +2{circumflex over (r)} 2 )mod 2 N . If an ERROR indication is returned, then return the ERROR indication, and Invalid_Q.   5. If (“r 1 ” is chosen), then
           a. Compute u 11 =(2{circumflex over ({circumflex over (r)})} 11 −{circumflex over ({circumflex over (r)})} 22  mod 2 N )k 11      b. Compute Q=u 11 Ĝ 12 +G (recall that Ĝ 12  was pre-computed).   
           6. If (“r 2 ” is chosen), then
           a. Compute u 21 =({circumflex over ({circumflex over (r)})} 22 −{circumflex over ({circumflex over (r)})} 11  mod 2 N )k 21      b. Q=u 21 *Ĝ 22 +G (recall that Ĝ 22  was pre-computed).   
           7. Return SUCCESS, {circumflex over ({circumflex over (r)})} 11 , {circumflex over ({circumflex over (r)})} 22  and Q.       

     Verification: 
     The computational process is illustrated in  FIG. 7 . Its correctness can be verified as follows: 
     
       
         
           
             
               
                 
                   Q 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         u 
                         11 
                       
                       * 
                       
                         
                           G 
                           ^ 
                         
                         12 
                       
                     
                     + 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         ( 
                         
                           
                             2 
                             * 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 
                                   r 
                                   ^ 
                                 
                                 ^ 
                               
                               11 
                             
                           
                           - 
                           
                             
                               
                                 
                                   r 
                                   ^ 
                                 
                                 ^ 
                               
                               22 
                             
                             ⁢ 
                             mod 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               2 
                               N 
                             
                           
                         
                         ) 
                       
                       * 
                       
                         k 
                         11 
                       
                       * 
                       
                         k 
                         11 
                         
                           - 
                           1 
                         
                       
                       * 
                       
                         
                           G 
                           ^ 
                         
                         11 
                       
                     
                     + 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         
                           r 
                           ^ 
                         
                         1 
                       
                       * 
                       
                         k 
                         11 
                         
                           - 
                           1 
                         
                       
                       * 
                       G 
                     
                     + 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           
                             k 
                             11 
                             
                               - 
                               1 
                             
                           
                           * 
                           
                             
                               r 
                               ^ 
                             
                             1 
                           
                         
                         + 
                         1 
                       
                       ) 
                     
                     * 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           r 
                           1 
                         
                         + 
                         1 
                       
                       ) 
                     
                     ⁢ 
                     G 
                   
                 
               
             
           
         
       
       
         
           
             
               
                 
                   Q 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         u 
                         21 
                       
                       * 
                       
                         
                           G 
                           ^ 
                         
                         22 
                       
                     
                     + 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         ( 
                         
                           
                             
                               
                                 r 
                                 ^ 
                               
                               ^ 
                             
                             22 
                           
                           - 
                           
                             
                               
                                 
                                   r 
                                   ^ 
                                 
                                 ^ 
                               
                               11 
                             
                             ⁢ 
                             mod 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               2 
                               N 
                             
                           
                         
                         ) 
                       
                       * 
                       
                         k 
                         21 
                       
                       * 
                       
                         k 
                         21 
                         
                           - 
                           1 
                         
                       
                       * 
                       
                         
                           G 
                           ^ 
                         
                         21 
                       
                     
                     + 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         
                           r 
                           ^ 
                         
                         2 
                       
                       * 
                       
                         k 
                         21 
                         
                           - 
                           1 
                         
                       
                       * 
                       G 
                     
                     + 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           
                             k 
                             21 
                             
                               - 
                               1 
                             
                           
                           * 
                           
                             
                               r 
                               ^ 
                             
                             2 
                           
                         
                         + 
                         1 
                       
                       ) 
                     
                     * 
                     G 
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           r 
                           2 
                         
                         + 
                         1 
                       
                       ) 
                     
                     ⁢ 
                     G 
                   
                 
               
             
           
         
       
     
     Shared Secret Computation. 
     As before, we explain shared secret computation from the perspective of Party A. Party A will use the appropriate domain parameters D, the other party&#39;s public key (Q B ), and their own transformed random numbers {circumflex over ({circumflex over (r)})} 11(A) ,{circumflex over ({circumflex over (r)})} 22(A)  to compute Z. 
     Target: 
     Without disclosing r 1(A)  and r 2(A)  inside the memory of the party A&#39;s machine, compute P=(r 1(A) +1)Q B  or P=(r 2(A) +1)Q B  depending on whether r 1(A) +1 or r 2(A) +1 was selected as party A&#39;s private key. 
     Precomputation: 
     Let k 11(A) , k 21(A)  denote party A&#39;s instance-specific, compile time, random numbers. Party A should pre-compute the integer values s 1 =k 11(A)   −1  mod n and s 2 =k 21(A)   −1  mod n. These values should be computed during an off-line set-up phase where the implementation is not subject to white-box attacks (e.g. at compilation time). If party B&#39;s public key is known in advance, as is the case in OP-ECDH, then further pre-computation can be done. When doing OP-ECDH, the elliptic curve points {circumflex over (Q)} B     11   =s 1 Q B =k 11(A)   −1 Q B  and {circumflex over (Q)} B     21   =s 2 Q B =k 21(A)   −1 Q B  should be computed off-line. 
     The steps of shared secret computation are as follows: 
     Input:
         1. {circumflex over ({circumflex over (r)})} 11(A) ,{circumflex over ({circumflex over (r)})} 22(A) : Party A&#39;s transformed random numbers.   2. Q B : The other party&#39;s (party B) public key.       

     Output: 
     The shared secret Z or an error indicator. 
     Process:
         1. If (“r 1 ” was chosen), then
           A. Compute {circumflex over (Q)} B     11   =s 1 Q B  and {circumflex over (Q)} B     12   =(2{circumflex over ({circumflex over (r)})} 11(A) −{circumflex over ({circumflex over (r)})} 22(A) mod 2 N ){circumflex over (Q)} B     11        B. Compute P={circumflex over (Q)} B     12   +Q B      C. If P=O, the point at infinity, output an error indicator.   D. Z=x P  where x P  is the x-coordinate of P.   
           2. If (“r 2 ” was chosen), then
           A. Compute {circumflex over (Q)} B     21   =s 2 Q B ; and {circumflex over (Q)} B     22   =({circumflex over ({circumflex over (r)})} 22(A) −{circumflex over ({circumflex over (r)})} 11(A) mod 2 N ){circumflex over (Q)} B     21        B. Compute P={circumflex over (Q)} B     2   +Q B      C. If P=O, the point at infinity, output an error indicator.   D. Z=x P  where x P  is the x-coordinate of P.   
               

     Verification: 
     The computational process is illustrated in  FIG. 8 . Its correctness can be verified as follows: 
     
       
         
           
             
               
                 
                   P 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         Q 
                         ^ 
                       
                       
                         B 
                         12 
                       
                     
                     + 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         ( 
                         
                           
                             2 
                             * 
                             
                               
                                 
                                   r 
                                   ^ 
                                 
                                 ^ 
                               
                               
                                 11 
                                 ⁢ 
                                 
                                   ( 
                                   A 
                                   ) 
                                 
                               
                             
                           
                           - 
                           
                             
                               
                                 
                                   r 
                                   ^ 
                                 
                                 ^ 
                               
                               
                                 22 
                                 ⁢ 
                                 
                                   ( 
                                   A 
                                   ) 
                                 
                               
                             
                             ⁢ 
                             mod 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               2 
                               N 
                             
                           
                         
                         ) 
                       
                       * 
                       
                         
                           Q 
                           ^ 
                         
                         
                           B 
                           11 
                         
                       
                     
                     + 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           
                             k 
                             
                               11 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                             
                               - 
                               1 
                             
                           
                           * 
                           
                             
                               r 
                               ^ 
                             
                             
                               1 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                           
                         
                         + 
                         1 
                       
                       ) 
                     
                     * 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           r 
                           
                             1 
                             ⁢ 
                             
                               ( 
                               A 
                               ) 
                             
                           
                         
                         + 
                         1 
                       
                       ) 
                     
                     ⁢ 
                     
                       Q 
                       B 
                     
                   
                 
               
             
           
         
       
       
         
           
             
               
                 
                   P 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         Q 
                         ^ 
                       
                       
                         B 
                         22 
                       
                     
                     + 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       
                         ( 
                         
                           
                             
                               
                                 r 
                                 ^ 
                               
                               ^ 
                             
                             
                               22 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                           
                           - 
                           
                             
                               
                                 
                                   r 
                                   ^ 
                                 
                                 ^ 
                               
                               
                                 11 
                                 ⁢ 
                                 
                                   ( 
                                   A 
                                   ) 
                                 
                               
                             
                             ⁢ 
                             mod 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               2 
                               N 
                             
                           
                         
                         ) 
                       
                       * 
                       
                         
                           Q 
                           ^ 
                         
                         
                           B 
                           21 
                         
                       
                     
                     + 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           
                             k 
                             
                               21 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                             
                               - 
                               1 
                             
                           
                           * 
                           
                             
                               r 
                               ^ 
                             
                             
                               2 
                               ⁢ 
                               
                                 ( 
                                 A 
                                 ) 
                               
                             
                           
                         
                         + 
                         1 
                       
                       ) 
                     
                     * 
                     
                       Q 
                       B 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                   ⁢ 
                   
                     
                       ( 
                       
                         
                           r 
                           
                             2 
                             ⁢ 
                             
                               ( 
                               A 
                               ) 
                             
                           
                         
                         + 
                         1 
                       
                       ) 
                     
                     ⁢ 
                     
                       Q 
                       B 
                     
                   
                 
               
             
           
         
       
     
     The fourth embodiment attempts to reach a compromise between security and computational efficiency. 
     Table A shows the computational comparison among the proposed White-Box ECDH design embodiments. Table A allows the four embodiments to be ranked in terms of their computational cost. The embodiments can also be approximately ranked in descending order of security strength as embodiment 3, embodiment 1, embodiment 4, embodiment 2. 
     Numerous modifications, variations and adaptations may be made to the particular embodiments described above without departing from the scope patent disclosure, which is defined in the claims. 
     
       
         
               
             
               
               
               
               
             
               
               
               
               
               
             
               
               
               
               
               
               
             
           
               
                 TABLE A 
               
             
             
               
                   
               
               
                 Computational comparison among the proposed White-Box ECDH design methodologies 
               
             
          
           
               
                   
                 Multiplication 
                 Addition 
                 Subtraction 
               
               
                   
                 (Elliptic Curve Point) 
                 (Elliptic Curve Point) 
                 (Scalar) 
               
               
                   
               
             
          
           
               
                 KEY PAIR 
                 EMBODIMENT 1 
                 1 (online) 
                 1 (online) 
                 1 
               
               
                 GENERATION 
                   
                 2 (offline) 
                   
                   
               
               
                   
                 EMBODIMENT 2 
                 1 (online) 
                 1 (online) 
                 0 
               
               
                   
                   
                 1 (offline) 
                   
                   
               
               
                   
                 EMBODIMENT 3 
                 1 (online) 
                 1 (online) 
                 2 
               
               
                   
                   
                 3 (offline) 
                   
                   
               
               
                   
                   
                 Scalar: 2 (for r 1 ) and 1 (for r 2 ) 
                   
                   
               
               
                   
                 EMBODIMENT 4 
                 1 (online) 
                 1 (online) 
                 1 
               
               
                   
                   
                 2 (offline) 
                   
                   
               
               
                   
                   
                 Scalar: 2 (for r 1 ) and 1 (for r 2 ) 
                   
                   
               
               
                   
                 STANDARD BLACK-BOX 
                 1 
                 0 
                 0 
               
             
          
           
               
                 SHARED SECRET 
                 EMBODIMENT 1 
                 OP- ECDH 
                 1 (online) 
                 1 (online) 
                 1 
               
               
                 COMPUTATION 
                   
                   
                 2 (offline) 
                   
                   
               
               
                   
                   
                 EU- ECDH 
                 3 (online) 
                 1 (online) 
                 1 
               
               
                   
                 EMBODIMENT 2 
                 OP- ECDH 
                 2 (offline) 
                 1 (online) 
                 0 
               
               
                   
                   
                 EU- ECDH 
                 2 (online) 
                 1 (online) 
                 0 
               
               
                   
                 EMBODIMENT 3 
                 OP- ECDH 
                 1 (online) 
                 1 (online) 
                 2 
               
               
                   
                   
                   
                 2 (offline) 
                   
                   
               
               
                   
                   
                   
                 Scalar: 1 (for r 1 ) and 0 (for r 2 ) 
                   
                   
               
               
                   
                   
                 EU- ECDH 
                 3 (online) 
                 1 (online) 
                 2 
               
               
                   
                   
                   
                 Scalar: 1 (for r 1 ) and 0 (for r 2 ) 
                   
                   
               
               
                   
                 EMBODIMENT 4 
                 OP- ECDH 
                 1 (online) 
                 1 (online) 
                 1 
               
               
                   
                   
                   
                 1 (offline) 
                   
                   
               
               
                   
                   
                   
                 Scalar: 1 (for r 1 ) and 0 (for r 2 ) 
                   
                   
               
               
                   
                   
                 EU- ECDH 
                 2 (online) 
                 1 (online) 
                 1 
               
               
                   
                   
                   
                 Scalar: 1 (for r 1 ) and 0 (for r 2 ) 
                   
                   
               
               
                   
                 STANDARD BLACK- 
                 OP- ECDH 
                 1 (offline) 
                 0 
                 0 
               
               
                   
                 BOX 
                 EU- ECDH 
                 1 (online) 
                 0 
                 0 
               
               
                   
               
             
          
         
       
     
     REFERENCES 
     
         
         [1] S. Chow, P. Eisen, H. Johnson, P. C. Van Oorschot, “White-Box Cryptography and an AES Implementation”, In Nyberg, K., Heys, H. M., eds.: Selected Areas in Cryptography 2002 (SAC 2002), Lecture Notes in Computer Science (LNCS), Volume 2595, Springer Verlag, pp. 250-270, 2003. 
         [2] S. Chow, P. Eisen, H. Johnson, P. C. Van Oorschot, “A White-Box DES Implementation for DRM Applications”, In Proceedings of ACM CCS-9 Workshop DRM, Springer, pp. 1-15, 2002. 
         [3] WB ECDSA, International Patent Application No. PCT/CA2010/000486 filed Mar. 31, 2010. 
         [4] WB SHA, International Patent Application No. PCT/CA2011/050172 filed Mar. 31, 2011. 
         [5] W. Diffie, M. Hellman, “New Directions in Cryptography”, IEEE Transactions on Information Theory, Vol. 22, Issue. 6, pp. 644-654, November 1976. 
         [6] NSA Suite B Cryptography, Available from http://www.nsa.gov/ia/programs/suiteb_cryptography/ 
         [7] Suite B Implementer&#39;s Guide to NIST SP 800-56A: National institute of Standards and Technology (NIST), July, 2009. (Available at http://www.nsa.gov/ia/_files/SuiteB_Implementer_G-113808.pdf) 
         [8] Standards for Efficient Cryptography; “SEC 1: Elliptic Curve Cryptography, Version 2.0”, Contact: Daniel R. L. Brown, Certicom Research, © 2009 Certicom Corp, May 2009. 
         [9] D. Hankerson, A. Menezes, S. Vanstone, “Guide to Elliptic Curve Cryptography”, Springer-Verlag Publication, ISBN 0-387-95273-X, 2004. 
         [10] Hitachi Ltd., Intel Corporation, Panasonic Corporation, Sony Corporation, Toshiba Corporation, “Digital Transmission Content Protection Specification Volume 1 (Informational Version)”, Revision 1.7, December, 2011. 
         [11] James L. Massey. “SAFER K-64: A Byte-Oriented Block-Ciphering Algorithm”, In Ross Anderson, ed.: Fast Software Encryption &#39;93, Lecture Notes in Computer Science, Volume 809, Springer Verlag, pp. 1-17, 1994.