AES WASM Tool

Introduction

Are you looking for a versatile and convenient tool for AES encryption and decryption? Look no further! The goal of this web-tool is to provide a user-friendly and accessible solution for AES tests directly in the browser.

Making use of WebAssembly (Wasm), this tool is built upon the soft-aes library, originally written in Rust, and the soft-aes-wasm library, which provides a Wasm interface for the soft-aes Rust library, enabling AES encryption and decryption directly within web applications.

Currently, the AES ECB and AES CBC modes are supported, together with the option of PKCS#7 padding and 0x80 padding (ISO/IEC 9797-1 Padding Method 2), and an integrated Cipher-based Message Authentication Code (AES-CMAC) calculation. More features are intended to be implemented.

Important: The implementation does (currently) not incorporate defenses against side-channel attacks. As a result, it should be used for testing, educational purposes and other non-critical applications where advanced protections against such attacks are not a primary concern.

The tool operates securely within a sandboxed environment processed locally in your browser.

Unfold the sections below to see the different interfaces.

Usage Notes

  • Plaintext Encoding: Plaintexts can be encoded in either TEXT (ASCII/UTF-8) or HEX format. For HEX encoding, you can use ":" or "-" as separators between "byte" blocks, or no separator at all.
  • Ciphertext Encoding: Ciphertexts are always HEX encoded with ":" as the separator when provided as outputs. However, when providing ciphertexts as inputs, they can also be provided with "-" or without any separator.
  • AES Algorithm: There's no separate selector for the AES algorithm (AES-128, AES-192, AES-256). Instead, the key length determines the algorithm to be used. You can use a key length of 16 bytes for AES-128, 24 bytes for AES-192, or 32 bytes for AES-256.
  • Padding Options: You have the option to use PKCS#7 padding, "0x80" padding (ISO/IEC 9797-1 Padding Method 2) or no padding. However, when choosing NONE padding, make sure that the block size of the input is a multiple of 16 bytes (AES block size). An error will be generated otherwise.
  • Decryption Output Encoding: If you are decrypting a ciphertext, you can select the encoding format for the decrypted plaintext below the Plaintext output field.
  • Initialization Vector: In the case of CBC mode, an Initialization Vector (IV) must be provided. The IV should always be 16 bytes long. You can provide it in either HEX or TEXT encoding.
  • Note: While using TEXT encoding for keys and IVs is possible, it is primarily recommended for testing purposes. Ensure that they correspond to the input size, for example, using 16 ASCII characters for 16 bytes.
  • AES-CMAC: The AES-CMAC functionality computes a Message Authentication Code (MAC) using the AES algorithm in CMAC mode. For AES-CMAC, you need to provide a message and a key. The message and key can be encoded in HEX or TEXT formats. The computed MAC is displayed in HEX format. This feature is useful for verifying the integrity and authenticity of a message.

To use the interfaces for different modes and operations, unfold the sections below. Within the sections, there are also subsections with examples that can be unfolded, providing more detailed examples on how to use the interfaces.

AES ECB Encrypt

Examples

Example 1 (AES-128)

  • Plaintext: Secret
  • Plaintext Encoding: TEXT
  • Key (AES-128): 00112233445566778899AABBCCDDEEFF
  • Key Encoding: HEX
  • Padding: PKCS7
  • Ciphertext generated: 5F:1D:44:C1:D0:C8:9C:89:0B:68:FF:A5:56:86:8A:23

Example 2 (AES-192)

  • Plaintext: 00112233445566778899AABBCCDDEEFF
  • Plaintext Encoding: HEX
  • Key: 00112233445566778899AABBCCDDEEFF0011223344556677
  • Key Encoding: HEX
  • Padding: NONE
  • Ciphertext generated: 3F:EA:55:C4:9A:68:7D:25:4A:FE:6D:C5:AF:D9:3C:23

Example 3 (AES-256)

  • Plaintext: AnotherSecret
  • Plaintext Encoding: Text
  • Key (AES-256): ThisIsA32CharLongASCIIKey!123456
  • Key Encoding: TEXT
  • Padding: PKCS7
  • Ciphertext generated: 6F:49:85:85:87:04:F5:BF:51:EF:52:DC:17:56:52:F4

AES ECB Decrypt

Examples

Example 1 (AES-128)

  • Ciphertext: 5F1D44C1D0C89C890B68FFA556868A23
  • Key: 00112233445566778899AABBCCDDEEFF
  • Key Encoding: HEX
  • Padding: PKCS7
  • Plaintext generated: Secret
  • Plaintext Encoding: Text

Example 2 (AES-192)

  • Ciphertext: 3FEA55C49A687D254AFE6DC5AFD93C23
  • Key: 00112233445566778899AABBCCDDEEFF0011223344556677
  • Key Encoding: HEX
  • Padding: PKCS7
  • Plaintext: 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF
  • Plaintext Encoding: HEX

Example 3 (AES-256)

  • Ciphertext: 6F:49:85:85:87:04:F5:BF:51:EF:52:DC:17:56:52:F4
  • Key: ThisIsA32CharLongASCIIKey!123456
  • Key Encoding: TEXT
  • Padding: PKCS7
  • Plaintext generated: AnotherSecret
  • Plaintext encoding: TEXT

AES CBC Encrypt

Examples

Example 1 (AES-128)

  • Plaintext: Secret
  • Plaintext Encoding: TEXT
  • Key: 00112233445566778899AABBCCDDEEFF
  • Key Encoding: HEX
  • Initialization Vector: FFEEDDCCBBAA99887766554433221100
  • IV Encoding: HEX
  • Padding: PKCS7
  • Ciphertext generated: 18:1D:0C:48:B4:95:F0:72:D2:14:2D:1F:77:35:DA:96

Example 2 (AES-192)

  • Plaintext: 00112233445566778899AABBCCDDEEFF
  • Plaintext Encoding: HEX
  • Key: 00112233445566778899AABBCCDDEEFF0011223344556677
  • Key Encoding: HEX
  • Initialization Vector: 00000000000000000000000000000000
  • IV Encoding: HEX
  • Padding: NONE
  • Ciphertext generated: 3F:EA:55:C4:9A:68:7D:25:4A:FE:6D:C5:AF:D9:3C:23

AES CBC Decrypt

Examples

Example 1 (AES-128)

  • Ciphertext: 18:1D:0C:48:B4:95:F0:72:D2:14:2D:1F:77:35:DA:96
  • Key: 00112233445566778899AABBCCDDEEFF
  • Key Encoding: HEX
  • Initialization Vector: FFEEDDCCBBAA99887766554433221100
  • IV Encoding: HEX
  • Padding: PKCS7
  • Plaintext generated: Secret
  • Plaintext Encoding: TEXT

Example 2 (AES-192)

  • Ciphertext: 3F:EA:55:C4:9A:68:7D:25:4A:FE:6D:C5:AF:D9:3C:23
  • Key: 00112233445566778899AABBCCDDEEFF0011223344556677
  • Key Encoding: HEX
  • Initialization Vector: 00000000000000000000000000000000
  • IV Encoding: HEX
  • Padding: NONE
  • Plaintext generated: 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF
  • Plaintext Encoding: HEX

AES CMAC Calculation

Example

  • Message: 6bc1bee22e409f96e93d7e117393172a
  • Message Encoding: HEX
  • Key (AES-128): 2b7e151628aed2a6abf7158809cf4f3c
  • Key Encoding: HEX
  • MAC Generated: 07:0A:16:B4:6B:4D:41:44:F7:9B:DD:9D:D0:4A:28:7C