$29
Network Security
RSA: introduction
Chosen ciphertext attack
PEM format
The decrypter on the server
SummaryRSA: introduction
Public key encryption
Components of RSA
n - the modulus of the keys, created as a product of two large prime numbers, p and q
(n, e) - the public key
(n, d) - the private key
Encryption with public key
Key pair: public and private key
■ Public key: open to the public
■ Private key: confidential
Messages encrypted with one key can only be decrypted by the other key
ciphertext = plaintext e mod n
Decrytption with private key
plaintext = cipthertext d mod n
cipthtext d mod n = plaintext ed mod n = plaintext 1 mod nChosen ciphertext attack
●Components of RSA
●C - the ciphertext you want to attack ( C = P e mod n )
n - the modulus of the keys, created as a product of two large prime numbers, p and q
(n, e) - the public key
(n, d) - the private key
Attack steps:
choose X where X is relatively prime to n
create Y = C*X e mod n
get Z = decrypted Y
Z = Y d = (C*X e ) d = C d *X ed = C d *X = P ed *X = P*X mod n
find out X -1 , the modular inverse of X
P = Z*X -1 mod nPEM format
The public key is in PEM format
Extract n and e from the public keyThe decryper on the server
nc 140.113.194.66 8888 (linux command)
input ciphertext and you’ll get the decrypted one backSummary
●
You are given:
●
Your goal:
●
to retrieve flag, it should be like FLAG{.......}
You should deliver:
●
pub.pem: the RSA public key
flag.enc: the encrypted message
decrypter.py: the source code of the decrypter running on the server
flag: the decrypted message
report.pdf: a report about how you decrypt flag.enc
any code or script you write
Pack all the files into STUDENT_ID.zip
All kind of plagiarism is strictly forbidden. If you plagiarize, you will fail the course
and/or face disciplinary action. Also, do not DoS our server!