Web Crypto: encrypt/decrypt
This page shows the use of the
decrypt() functions of the Web Crypto API. It contains four separate examples, one for each encryption algorithm supported:
Each example has five components:
- A text box containing a message to encrypt.
- A representation of the ciphertext.
- A box that will contain the decrypted ciphertext.
- An "Encrypt" button: this encrypts the text box contents, displays part of the ciphertext, and stores the complete ciphertext.
- A "Decrypt" button: this decrypts the ciphertext and writes the result into the "Decrypted" box.
- Press "Encrypt". The ciphertext should appear.
- Press "Decrypt". The decrypted text should appear, and match the original message.
- Edit the text box contents.
- Press "Encrypt" again. A different ciphertext should appear.
- Press "Decrypt" again. The new text box contents should appear next to "Decrypted:".