 Given
 Given  
 for an
RSA cryptosystem is, in practice, at least as difficult as factoring
 for an
RSA cryptosystem is, in practice, at least as difficult as factoring  .
We give a probabilistic algorithm that given a decryption key
determines the factorization of
.
We give a probabilistic algorithm that given a decryption key
determines the factorization of  .
.
Consider an RSA cryptosystem with modulus  and
encryption key
 and
encryption key  .  Suppose we somehow finding an integer
.  Suppose we somehow finding an integer  such 
that
 such 
that 
 
for all
 .  Then
.  Then  satisfies
 satisfies 
 for all
 for all  that are coprime to
that are coprime to  .  As we saw in Section 3.3.1, knowing
.  As we saw in Section 3.3.1, knowing
 leads directly to a factorization of
 leads directly to a factorization of  .  Unfortunately,
knowing
.  Unfortunately,
knowing  does not seem to lead easily to a factorization of
 does not seem to lead easily to a factorization of  .
However, there is a probabilistic procedure that, given an
.
However, there is a probabilistic procedure that, given an  such
that
 such
that 
 , will find a factorization of
, will find a factorization of  with ``high
probability'' (we will not analyze the probability here).
 with ``high
probability'' (we will not analyze the probability here).
 )    
  Let
)    
  Let  be the product of two distinct odd primes, and suppose
 be the product of two distinct odd primes, and suppose
   is an integer such that
 is an integer such that 
 for all
 for all  coprime
  to
 coprime
  to  .  This probabilistic algorithm factors
.  This probabilistic algorithm factors  with ``high
  probability''.  In the steps below,
 with ``high
  probability''.  In the steps below,  always denotes an integer
  coprime to
 always denotes an integer
  coprime to  .
.
Before giving the proof we introduce some more terminology from algebra.
 and
 and  be groups.  A map
 be groups.  A map 
 is a group homomorphism if for all
 
is a group homomorphism if for all  we have
we have 
 .
A group homomorphism is called surjective if
for every
.
A group homomorphism is called surjective if
for every  there is
 there is  such that
 such that 
 .
The kernel of a group homomorphism
.
The kernel of a group homomorphism 
 is the set
is the set 
 of elements
 of elements  such that
 such that 
 .
A group homomorphism is injective if
.
A group homomorphism is injective if 
 .
. 
 is a group and
 is a group and  is a subset of
 is a subset of  , then
, then  is a
  subgroup if
 is a
  subgroup if  is a group under the group operation on
 is a group under the group operation on  .
. is a group homomorphism, then
 is a group homomorphism, then 
 is a subgroup of
is a subgroup of  (see Exercise 2.21).
 (see Exercise 2.21).
We now return to discussing Algorithm 3.3.5.
In step 1, note that  is even since
 is even since 
 , so it makes sense to consider
, so it makes sense to consider  .  It is not practical
to determine whether or not
.  It is not practical
to determine whether or not 
 for all
 for all  ,
because it would require doing a computation for too many
,
because it would require doing a computation for too many  .
Instead, we try a few random
.
Instead, we try a few random  ; if
; if 
 for
the
 for
the  we check, we divide
 we check, we divide  by
 by  .  Also note that if there
exists even a single
.  Also note that if there
exists even a single  such that
 such that 
 , then
half the
, then
half the  have this property, since then
 have this property, since then 
 is
a surjective homomorphism
 is
a surjective homomorphism 
 and the kernel
has index
 and the kernel
has index  .
.
Proposition 2.5.3 implies that if 
 then
 then
 .  In step 2, since
.  In step 2, since 
 , we also have
, we also have 
 and
 and
 , so
, so 
 and
 and
 .  Since
.  Since 
 , there
are three possibilities for these signs, so with probability
, there
are three possibilities for these signs, so with probability  , 
one of the following two possibilities occurs:
, 
one of the following two possibilities occurs:
 and
   and 
 and
   and 
 .  In the first case,
.  In the first case, 
 but
   but 
so
 and we have
factored
 and we have
factored  .  Similarly, in the second case,
.  Similarly, in the second case, 
 and we again factor
 and we again factor  .
.
 and
   and 
has decryption key
 .  We use this information and
Algorithm 3.3.5 to factor
.  We use this information and
Algorithm 3.3.5 to factor  .
If
.
If
 
then
 , so
, so 
 for all
for all  coprime to
 coprime to  .
For each
.
For each  we find that
 we find that
 , so we replace
, so we replace  by
 by 
 
Again, we find with this new
 that 
for each
 that 
for each  ,
, 
 , so we replace
, so we replace  by
 by
 .
Yet again, for each
.
Yet again, for each  ,
, 
 , so we replace
, so we replace  by
by 
 .
This is enough, since
.
This is enough, since 
 .
Then
.
Then 
 
and we have found a factor of
 .  Dividing, we find that
.  Dividing, we find that 
 
sage: def crack_given_decrypt(n, m): ... n = Integer(n); m = Integer(m); # some type checking ... # Step 1: divide out powers of 2 ... while True: ... if is_odd(m): break ... divide_out = True ... for i in range(5): ... a = randrange(1,n) ... if gcd(a,n) == 1: ... if Mod(a,n)^(m//2) != 1: ... divide_out = False ... break ... if divide_out: ... m = m//2 ... else: ... break ... # Step 2: Compute GCD ... while True: ... a = randrange(1,n) ... g = gcd(lift(Mod(a, n)^(m//2)) - 1, n) ... if g != 1 and g != n: ... return g ...We show how to verify Example 3.3.8 using SAGE.
sage: n=32295194023343; e=29468811804857; d=11127763319273 sage: crack_given_decrypt(n, e*d - 1) 737531 sage: factor(n) 737531 * 43788253
We try a much larger example.
sage: e = 22601762315966221465875845336488389513 sage: d = 31940292321834506197902778067109010093 sage: n = 268494924039590992469444675130990465673 sage: p = crack_given_decrypt(n, e*d - 1) sage: p # random output (could be other prime divisor) 13432418150982799907 sage: n % p 0
William 2007-06-01