To encrypt something using RSA algorithm you need modulus
and encryption (public) exponent
pair (n, e)
. That's your public key. To decrypt something using RSA algorithm you need modulus
and decryption (private) exponent
pair (n, d)
. That's your private key.
To encrypt something using RSA public key you treat your plaintext as a number and raise it to the power of e modulus n:
ciphertext = ( plaintext^e ) mod n
To decrypt something using RSA private key you treat your ciphertext as a number and raise it to the power of d modulus n:
plaintext = ( ciphertext^d ) mod n