Add the key length to the key context

This commit is contained in:
Rodolphe Bréard 2024-04-20 19:02:55 +02:00
parent 434b3b8bd6
commit f1660e212e
5 changed files with 29 additions and 17 deletions

View file

@ -3,6 +3,7 @@ use crate::error::{Error, Result};
use aes_gcm::aead::{Aead, KeyInit, Payload};
use aes_gcm::{Aes128Gcm, Key, Nonce};
pub(crate) const AES128_KEY_SIZE: usize = 128;
// 96 bits (12 bytes)
// Reason: NIST Special Publication 800-38D
// https://doi.org/10.6028/NIST.SP.800-38D

View file

@ -3,6 +3,7 @@ use crate::error::{Error, Result};
use chacha20poly1305::aead::{Aead, KeyInit, Payload};
use chacha20poly1305::{Key, XChaCha20Poly1305, XNonce};
pub(crate) const KEY_SIZE: usize = 256;
// X-variant: the nonce's size is 192 bits (24 bytes)
const NONCE_SIZE: usize = 24;