# Recursive RSA encryption

I have a ciphertext $$C$$ encrypted with public key $$pub_C$$, which contains ciphertext $$B$$ and $$pub_B$$, $$C= E_{pub_C}(B\mathbin\|pub_B)$$

Ciphertext $$B$$ is encrypted with $$pub_B$$ and contains $$pub_A$$ only. $$B = E_{pub_B}(pub_A)$$

I already factorized $$pub_C$$ with Fermat obtaining ciphertext $$B$$ and $$pub_B$$ by decrypting ciphertext $$C$$. Now I'm stuck on factorizing the modulus of this public key so this is the question:

• can I exploit this recursive encryption to factorize $$pub_B$$ modulus?
• Hmm, not unless there is a relation of some sort between B and C, imho. Homework? Why not factorise B if you managed to factorise C?
– tum_
Oct 24 '19 at 21:27
• I edited the question, I mixed public and private keys. The problem now is that I can't factorize the modulus of pubB, I tried lot of attacks.
– user33580
Oct 24 '19 at 22:17
• The aim is to get p, q and d from all the three keys
– user33580
Oct 25 '19 at 7:27
• You need to factor the modulus of $pub_b$. One way the earlier factorization of $pub_c$ could help is if they share a factor. Also, Fermat is not the only factorization method around.
– fgrieu
Oct 25 '19 at 7:59
• pub_C is the double of pub_B and I successfully factorized it
– user33580
Oct 25 '19 at 8:15