Abstract:
Method and device for generating factors of a RSA modulus N with a predetermined portion N h , the RSA modulus comprising at least two factors. A first prime p is generated; a value N h  that forms a part of modulus N is obtained; a second prime q is generated in an interval dependent from p and N h  so that pq is a RSA modulus that shares N h ; and information enabling the calculation of the modulus/V is outputted.

Description:
FIELD OF THE INVENTION 
       [0001]    The present invention relates generally to public-key encryption algorithms, and in particular to compressed representations of Rivest-Shamir-Adleman (RSA) moduli. 
       BACKGROUND OF THE INVENTION 
       [0002]    This section is intended to introduce the reader to various aspects of art, which may be related to various aspects of the present invention that are described and/or claimed below. This discussion is believed to be helpful in providing the reader with background information to facilitate a better understanding of the various aspects of the present invention. Accordingly, it should be understood that these statements are to be read in this light, and not as admissions of prior art. 
         [0003]    Let N=pq be the product of two large primes. We let e and d denote a pair of public and private exponents, satisfying ed≡1(mod λ(N)), with gcd(e, λ(N))=1 and λ being Carmichael&#39;s function. As N=pq, we have λ(N)=lcm(p−1, q−1). Given x&lt;N, the public operation (e.g., message encryption or signature verification) consists in raising x to the e-th power modulo N, i.e., in computing y=X e  mod N. Then, given y, the corresponding private operation (e.g., decryption of a ciphertext or signature generation) consists in computing y d  mod N. From the definition of e and d, we obviously have that y d ≡x(mod N). The private operation can be carried out at higher speed through Chinese remaindering (CRT mode). Computations are independently performed modulo p and q and then recombined. In this case, private parameters are {p, q, d p , d q , i q } with d p =d mod(p−1), d q =d mod(q−1), and i q =q −1  mod p. We then obtain y d  mod N as CRT(x p , x q )=x q +q [i g (x p −x q )mod p], where x p =y dp  mod p and x q =y dg  mod q. 
         [0004]    To sum up, a (two-factor) RSA modulus N=pq is the product of two large prime numbers p and q, satisfying gcd(λ(N), e)=1. If n denotes the bit-size of N then, for some 1&lt;n 0 &lt;n, p must lie in the range [2 n-n0-1/2 , 2 n-n0 −1] and q in the range [2 n0-1/2 , 2 n0 −1] so that 2 n-1 &lt;N=pq&lt;2 n . For security reasons, so-called balanced moduli are generally preferred, which means n=2n 0 . 
         [0005]    Typical RSA moduli range from 1024 to 4096 bits. It is now customary for applications to require moduli of at least 2048 bits. However, the programs and/or devices running the RSA-enabled applications may be designed to support only 1024-bit moduli. The idea is to compress the moduli so that they can fit in shorter buffers or bandwidths: rather than storing/sending the whole RSA moduli, a lossless compressed representation is used. This also solves compatibility problems between different releases of programs and/or devices. Of independent interest, such techniques can be used for improved efficiency: savings in memory and/or bandwidth. 
         [0006]    Arjen K. Lenstra (Generating RSA moduli with a predetermined portion.  Advances in Cryptology—ASIACRYPT &#39; 98 volume 1514 of  Lecture Notes in Computer Science , pages 1-10. Springer, 1998) proposes generation method, but Lenstra&#39;s method is not suited to constrained devices like smart cards because second prime q is constructed incrementally, which may result in prohibitely too long running times. 
         [0007]    The present invention overcomes problems of the prior art in that it the compressed RSA moduli are carried out through the generation of two primes in a prescribed interval. As a result, they can benefit from efficient prime generation algorithms such as the one proposed by Marc Joye, Pascal Paillier, and Serge Vaudenay (Efficient generation of prime numbers.  Cryptographic Hardware and Embedded Systems—CHES  2000, volume 1965 of  Lecture Notes in Computer Science , pages 340-354. Springer, 2000) and improved by Marc Joye and Pascal Paillier (Fast generation of prime numbers on portable devices: An update.  Cryptographic Hardware and Embedded Systems—CHES  2006, volume 4249 of  Lecture Notes in Computer Science , pages 160-173, Springer, 2006). In particular, they are very well suited in situations where the goal is to generate a 2048-bit RSA modulus N (i.e., n=2048) with fixed public exponent e=2 16 +1 so that (much) less than 2048 bits are needed to store N or a representation of N. 
       SUMMARY OF THE INVENTION 
       [0008]    In a first aspect, the invention is directed to a method of generating factors of a RSA modulus N with a predetermined portion N h . The RSA modulus comprises at least two factors. First, a first prime p is generated, obtaining a value N h  that forms a part of modulus N is obtained, a second prime q is generated, and at least a lossless compressed representation of the modulus N is output, the lossless compressed representation enabling unambiguous recovery of the modulus N. The second prime q is generated in an interval dependent from p and N h  so that pq is a RSA modulus that shares N h . 
         [0009]    In a first preferred embodiment, the predetermined portion N h  heads the RSA modulus. It is advantageous that the RSA modulus is a n-bit modulus and the predetermined portion N h  comprises K bits and the first prime p is generated in the interval pε[2 n-n     0     -1/2 ,2 n-n     0   −1] so that gcd(p−1,e)=1; the second prime q is generated in the interval 
         [0000]    
       
         
           
             q 
             ∈ 
             
               [ 
               
                 
                   
                     
                       
                         2 
                         
                           n 
                           - 
                           κ 
                         
                       
                        
                       
                         N 
                         h 
                       
                     
                     + 
                     1 
                   
                   p 
                 
                 , 
                 
                   
                     
                       
                         2 
                         
                           n 
                           - 
                           κ 
                         
                       
                        
                       
                         ( 
                         
                           
                             N 
                             h 
                           
                           + 
                           1 
                         
                         ) 
                       
                     
                     - 
                     1 
                   
                   p 
                 
               
               ] 
             
           
         
       
     
         [0000]    so that such that gcd(q−1,e)=1; and N=N h ∥N l , where N l =(pq)mod 2 n-κ . 
         [0010]    In a second preferred embodiment, the predetermined portion N h  trails the RSA modulus. It is advantageous that the first prime p is generated in the interval pε[2 n-n     0     -1/2 ,2 n-n0 −1] so that gcd(p−1,e)=1; the second prime q is generated by calculating q=C+q′2 κ , where 
         [0000]    
       
         
           
             C 
             = 
             
               
                 
                   N 
                   h 
                 
                 p 
               
                
               mod 
                
               
                   
               
                
               
                 2 
                 κ 
               
             
           
         
       
     
         [0000]    and q′ is generated in the interval 
         [0000]    
       
         
           
             
               q 
               ′ 
             
             ∈ 
             
               [ 
               
                 
                   
                     
                       2 
                       
                         n 
                         - 
                         1 
                       
                     
                     + 
                     1 
                     - 
                     Cp 
                   
                   
                     
                       2 
                       κ 
                     
                      
                     p 
                   
                 
                 , 
                 
                   
                     
                       2 
                       n 
                     
                     - 
                     Cp 
                   
                   
                     
                       2 
                       κ 
                     
                      
                     p 
                   
                 
               
               ] 
             
           
         
       
     
         [0000]    so that gcd(q−1,e)=1, 
         [0000]    
       
         
           
             
               N 
               l 
             
             = 
             
               ⌊ 
               
                 pq 
                 
                   2 
                   κ 
                 
               
               ⌋ 
             
           
         
       
     
         [0000]    is defined, and Ñ=={N l , s 0 [κ,n]} is output. 
         [0011]    In a third preferred embodiment, N h  is obtained by the encryption of at least a part of the first prime p. 
         [0012]    In a second aspect, the invention is directed to a device for generating factors of a RSA modulus N with a predetermined portion N h , the RSA modulus comprising at least two factors. The device comprises a processor for generating a first prime p; obtaining a value N h  that forms a part of modulus N; and generating a second prime q in an interval dependant from p and N h  so that pq is a RSA modulus that shares N h . The device further comprises an interface for outputting at least a lossless compressed representation of the modulus N that enables unambiguous recovery of the modulus N. 
         [0013]    In a first preferred embodiment, the device is a smartcard. 
         [0014]    “Sharing” is to be interpreted as having the same value for the part that is shared, e.g. hexadecimal 1234567890abcdef and 123456789abcdef0 share 123456789 in the leading part of the numbers. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0015]    The various features and advantages of the present invention and its preferred embodiments will now be described with reference to the accompanying drawings which are intended to illustrate and not to limit the scope of the present invention and in which 
           [0016]      FIG. 1  illustrates a device for RSA moduli generation according to a preferred embodiment of the invention. 
       
    
    
     DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS 
     General Idea 
       [0017]    The general inventive idea consists in fixing a large part of an RSA modulus N (e.g., up to its top half in the preferred embodiment) so that the primes forming N can be drawn arbitrarily from an interval (and not tried incrementally as was suggested in previous proposals). The large part of the RSA modulus is either evaluated from a random short seed using a (public) pseudo-random number generator or shared amongst users. 
         [0018]    This results in faster (and much easier to implement) compression techniques for RSA moduli. Furthermore, the so-produced RSA moduli are indistinguishable from regular RSA moduli (i.e., there is no difference in the output distribution). Finally, they are compatible with state-of-the-art prime generation techniques (in which case there is no extra cost). 
       Preferred Embodiment 
       [0019]    Let 1&lt;κ≦n 0 . An n-bit RSA modulus N, being a product of two large primes p and q, can be generated as follows.
   1. Using a pseudo-random number generator, produce a κ-bit integer N h  from a random seed s 0 :   
 
         [0000]        N   h =(2 κ-1             PRNG ( s   O ))ε[2 κ-1 ,2 κ −1]       Note that OR-ing with 2 κ-1  ensures that the most significant bit of N h  is 1. The skilled person will appreciate that it is naturally also possible to choose the value of N h .       2. Generate a random prime pε[2 n-n     0     -1/2 ,2 n-n     0   −1] such that gcd(p−1,e)=1.   3. Generate a random prime q:     
         [0000]    
       
         
           
             q 
             ∈ 
             
               [ 
               
                 
                   
                     
                       
                         2 
                         
                           n 
                           - 
                           κ 
                         
                       
                        
                       
                         N 
                         h 
                       
                     
                     + 
                     1 
                   
                   p 
                 
                 , 
                 
                   
                     
                       
                         2 
                         
                           n 
                           - 
                           κ 
                         
                       
                        
                       
                         ( 
                         
                           
                             N 
                             h 
                           
                           + 
                           1 
                         
                         ) 
                       
                     
                     - 
                     1 
                   
                   p 
                 
               
               ] 
             
           
         
       
     
         [0000]    such that gcd(q−1,e)=1. If no such prime is found, the process is reiterated.
   4. Define N l =(pq)mod 2 n-κ  and output Ñ={N l , s 0 , [κ, n]}.   
 
         [0025]    Given the representation Ñ, it is now easy to publicly recover the corresponding n-bit RSA modulus N, namely N=N h ∥N l  where N h  is the κ-bit integer obtained as N h =2 κ-1 v PRNG(s 0 ). 
         [0026]    It should be noted that if 2 n-κ ≦p then the range q is chosen from may be empty. This explains why κ should be at most n 0 . Therefore, the previous method compresses at best n-bit RSA moduli up to n 0  bits. The worst case is for balanced RSA moduli (i.e., n=2n 0 ), yielding (at best) a compression ratio of 1÷2. 
       First Alternative Embodiment 
       [0027]    In an alternative embodiment, the trailing bits of modulus N are fixed.
       1. Produce N h =(1         PRNG(s 0 ))ε[1,2 κ −1] from the seed s 0 . N h  may naturally also be chosen.   2. Generate a first prime pε└2 n-n     0     -1/2 ,2 n-n     0   −1┘ and gcd(p−1,e)=1.   3. Let       
 
         [0000]    
       
         
           
             C 
             = 
             
               
                 
                   N 
                   h 
                 
                 p 
               
                
               mod 
                
               
                   
               
                
               
                 2 
                 κ 
               
             
           
         
       
     
         [0000]    generate a second prime q
       q=C+q′κ with       
 
         [0000]    
       
         
           
             
               q 
               ′ 
             
             ∈ 
             
               [ 
               
                 
                   
                     
                       2 
                       
                         n 
                         - 
                         1 
                       
                     
                     + 
                     1 
                     - 
                     Cp 
                   
                   
                     
                       2 
                       κ 
                     
                      
                     p 
                   
                 
                 , 
                 
                   
                     
                       2 
                       n 
                     
                     - 
                     Cp 
                   
                   
                     
                       2 
                       κ 
                     
                      
                     p 
                   
                 
               
               ] 
             
           
         
       
     
         [0000]    and gcd(q−1,e)=1, if any.
       4. Define       
 
         [0000]    
       
         
           
             
               N 
               l 
             
             = 
             
               ⌊ 
               
                 pq 
                 
                   2 
                   κ 
                 
               
               ⌋ 
             
           
         
       
     
         [0000]    and output Ñ={N l , s 0 , [κ,n]}. 
         [0033]    It will be appreciated that it is not necessary to include the most significant bit of N l  in Ñ, as it is sure to be a 1. 
         [0034]    More generally, it is also possible to fix some leading bits and some trailing bits of N. 
       Second Alternative Embodiment 
       [0035]    The proposed methods can be adapted to accommodate RSA moduli that are made of more than 2 factors, for example, 3-prime RSA moduli or RSA moduli of the form N=p r q. For a further description of this, one may advantageously turn to Tsuyoshi Takagi&#39;s paper (Fast RSA-type cryptosystem modulo p k q.  Advances in Cryptology—CRYPTO&#39; 98, volume 1462 of  Lecture Notes in Computer Science , pages 318-326. Springer, 1998). 
       Third Alternative Embodiment 
       [0036]    The proposed methods also apply when the common part of RSA modulus N, say N h , is shared amongst users or is common to all users for a given application. In such a case, there is no need to transmit random seed s 0  (as well as the values of κ and n). 
       Device 
       [0037]      FIG. 1  illustrates a device for RSA moduli generation according to a preferred embodiment of the invention. The generating device  100  comprises at least one processor  110 , at least one memory  120 , communication means  130  that may comprise separate input and output units, and possibly a user interface  140 . The processing means is adapted to perform the method of any of the methods described hereinbefore. 
       Key Escrow 
       [0038]    It will be appreciated that the present invention may advantageously be used for key escrow purposes. In the case of a RSA modulus N=pq, knowledge of about half of the bits of p (or q) suffices to recover the private key using for example lattice reduction techniques. Therefore, if about half (or more) of the bits of p are encrypted using a secret key K and embedded in the representation of public RSA modulus N, then an ‘authority’ that knows K will be able to reconstruct p from N and thus compute the corresponding private RSA key. The encrypted bits of p may be comprised in the predetermined part of the RSA modulus. 
         [0039]    It will further be appreciated that the method according to the invention is particularly advantageous for use in smartcards and other resource constrained devices, as the method uses relatively little resources. 
         [0040]    Each feature disclosed in the description and (where appropriate) the claims and drawings may be provided independently or in any appropriate combination. Features may, where appropriate be implemented in hardware, software, or a combination of the two. 
         [0041]    Reference herein to “one embodiment” or “an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one implementation of the invention. Any appearances of the phrase “in one embodiment” in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments necessarily mutually exclusive of other embodiments. 
         [0042]    Reference numerals appearing in the claims are by way of illustration only and shall have no limiting effect on the scope of the claims.