RSA Noob
1 minute to read
We are given these numbers:
e: 1
c: 108193852288406505568171818194994500452464483136775497973720445
n: 1522605027922533360535618378132637429718068114961380688657908494580122963258952897654000350692006139
We have the exponent $e$, the modulus $n$ and the ciphertext $c$.
It is clear that we have an RSA cryptosystem. Let’s review how RSA works:
Two prime numbers $p$ and $q$ are chosen so that we have the modulus $n = p \cdot q$. Then an exponent $e$ is chosen (usually 3 or 65537) so that it is coprime with $\phi(n) = (p - 1) \cdot (q - 1)$.
In order to encrypt a message $m$ (in numeric format), this operation must be performed:
$$ c = m ^ e \mod{n} $$
So that $c$ is the ciphertext. And to decrypt the ciphertext, we must first calculate $d = e ^ {-1} \mod{\phi(n)}$ and then compute this:
$$ m = c ^ d \mod{n} $$
At this point, the public key is the set ${e, n}$, whereas the private key is formed by ${p, q}$.
This time, the exponent $e = 1$, so $d = 1$ as well, because it is the multiplicative inverse (1 is the identity element over the multiplication). Hence, $m = c$.
The only thing we need to do is decode the message $m$ from number to ASCII bytes:
$ python3 -q
>>> bytes.fromhex('108193852288406505568171818194994500452464483136775497973720445')
b'CTFlearn{b3tter_up_y0ur_e}'