This is a small demo using the Web Crypto API and OpenSSL to do file encryption with an RSA keypair.
- Generate the keypair
- Extract public key
- Create webpage
- Encrypt in browser
- Decrypt in command line
# openssl genrsa -out key.pem 2048 openssl rsa -in key.pem -pubout -out public.pem- Place the source from index.html next to public.pem from the previous step
- Serve it somehow
- Visit the file you are serving from the previous step
- Type a message in the text box, click encrypt
- Download the file by clicking the link
openssl pkeyutl -decrypt -inkey key.pem -pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256 -in .\message.enc