EDA.Voice.Crypto.AES (EDA v0.3.0)

Copy Markdown View Source

AES-256-GCM encryption for Discord voice.

Uses Erlang's built-in :crypto module. Implements the aead_aes256_gcm_rtpsize mode where the RTP header stays plaintext.

Summary

Functions

Decrypts an AES-256-GCM encrypted voice packet.

Encrypts an audio frame using AES-256-GCM.

Returns the nonce byte length for this encryption mode.

Functions

decrypt(packet, secret_key, header_size)

@spec decrypt(binary(), binary(), integer()) :: {:ok, binary()} | :error

Decrypts an AES-256-GCM encrypted voice packet.

Returns {:ok, plaintext} or :error.

encrypt(frame, secret_key, nonce)

@spec encrypt(binary(), binary(), integer()) :: binary()

Encrypts an audio frame using AES-256-GCM.

The RTP header (first 12 bytes) is used as AAD (additional authenticated data) and stays plaintext. A 4-byte nonce is appended to the packet.

nonce_length()

Returns the nonce byte length for this encryption mode.