Module: crypto/gcm

This module wraps native AES-GCM en/decryption for both the WebCrypto api as well as node.js' crypto api.

Source:

Requires

Methods

(inner) decrypt(cipher, ciphertext, key, iv) → {Promise.<Uint8Array>}

Decrypt ciphertext input.

Parameters:
Name Type Description
cipher String

The symmetric cipher algorithm to use e.g. 'aes128'

ciphertext Uint8Array

The ciphertext input to be decrypted

key Uint8Array

The encryption key

iv Uint8Array

The initialization vector (12 bytes)

Source:
Returns:

The plaintext output

Type
Promise.<Uint8Array>

(inner) encrypt(cipher, plaintext, key, iv) → {Promise.<Uint8Array>}

Encrypt plaintext input.

Parameters:
Name Type Description
cipher String

The symmetric cipher algorithm to use e.g. 'aes128'

plaintext Uint8Array

The cleartext input to be encrypted

key Uint8Array

The encryption key

iv Uint8Array

The initialization vector (12 bytes)

Source:
Returns:

The ciphertext output

Type
Promise.<Uint8Array>