Web Crypto: encrypt/decrypt
This page shows the use of the encrypt() and decrypt() functions of the Web Crypto API. It contains four separate examples, one for each encryption algorithm supported:
- "RSA-OAEP"
 - "AES-CTR"
 - "AES-CBC"
 - "AES-GCM"
 
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.
 
Try it:
- 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:".
 
RSA-OAEP
Ciphertext:
            Decrypted:
            
            
          AES-CTR
Ciphertext:
            Decrypted:
            
            
          AES-CBC
Ciphertext:
            Decrypted:
            
            
          AES-GCM
Ciphertext:
            Decrypted: