

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: RSA
incomplete
2: RSA vs. ECC
incomplete
3: RSA Key Generation
incomplete
4: Totient and E
incomplete
5: Modular Arithmetic
incomplete
6: Modular Arithmetic
incomplete
7: Encryption
incomplete
8: Multiplicative Inverse
incomplete
9: Private Key
incomplete
10: Decryption
incomplete
11: Encryption and Decryption Explained
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
RSA (which stands for Rivest–Shamir–Adleman, the names of the creators), is another widely used public-key encryption algorithm. ECC is becoming the more modern choice, but RSA is still used in production all across the internet, so it's important to understand how it works.
Click to play video
Our web systems at Passly still use RSA, even though we've moved our native desktop encryption to ECC. Complete the encrypt function.
Use the rsa.EncryptOAEP function to encrypt the message with the public key. Use nil as the label because we don't need it. Follow the patterns in the documentation as well as in the decrypt function if you're concerned about the other parameters.
Because of our simple implementation that just wraps rsa.EncryptOAEP, the last test case is expected to fail for having a message that's too long.