packet/crypto_utils library

Functions

aeadEncrypt(Uint8List key, Uint8List iv, int packetNumber, Uint8List plaintext, Uint8List aad) Uint8List?
Performs AES-GCM encryption following the QUIC nonce construction.
aes128Ecb(Uint8List sample, Uint8List hpKey) Uint8List
aesEcbEncrypt(Uint8List keyBytes, Uint8List plaintext) Uint8List
Performs AES in ECB mode for Header Protection.
aesEcbEncryptPrimitive({required Uint8List key, required Uint8List plaintext}) Uint8List
aesGcmDecrypt(Uint8List ciphertext, Uint8List tag, Uint8List key, Uint8List nonce, Uint8List aad) Uint8List?
Performs raw AES-GCM decryption (equivalent to JS aes_gcm_decrypt). This function is not QUIC-specific as it takes a pre-calculated nonce.
aesGcmDecryptPrimitive(Uint8List key, Uint8List nonce, Uint8List ciphertext, Uint8List tag, Uint8List aad) Uint8List
computeNonce(Uint8List iv, int packetNumber) Uint8List
Calculates the QUIC AEAD nonce. Nonce is computed as IV XOR (big-endian 64-bit Packet Number). The IV is 12 bytes. The 64-bit Packet Number is left-padded with zeros and XORed with the rightmost 8 bytes of the IV.