The second crypto challenge was about RSA.
Alice wants to send Bob a confidential message. They both remember the crypto lecture about RSA. So Bob uses openssl to create key pairs. Finally, Alice encrypts the message with Bob’s public keys and sends it to Bob. Clever Eve was able to intercept it. Can you help Eve to decrypt the message?
File: crypto60.zip
The file contained three public keys and one file with three messages, each encrypted with one of the three public keys.
First off, we open the files using an ASN.1 viewer to obtain each public modulus. After having found the moduli, I used msieve to factor them. Having found p and q, we use the following Python code to obtain the flag:
e = 65537L p = [17963604736595708916714953362445519, 16549930833331357120312254608496323, 17357677172158834256725194757225793] q = [20016431322579245244930631426505729, 16514150337068782027309734859141427, 19193025210159847056853811703017693] N = [x * y for x,y in zip(p,q)] for i in range(0,3): private_key = RSA.construct((N[i],e,d[i])) cipher = PKCS1_v1_5.new(private_key) print pkcs1_unpad(private_key.decrypt(decoded_encs[i]))
The flag is
IW{WEAK_RSA_K3YS_4R3_SO_BAD!}