Skip to content

Commit

Permalink
fixup! feat: add support for ChaCha20/Poly1305 to COSE module
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsastrix committed Aug 27, 2024
1 parent 417ac63 commit 1a6566e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/token/cose/crypto_impl/rustcrypto/encrypt/chacha_poly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use rand::CryptoRng;
use rand::RngCore;

impl<RNG: RngCore + CryptoRng> RustCryptoContext<RNG> {
/// Perform a ChaCha20/Poly1305 encryption operation on `plaintext` and the additional
/// authenticated data `aad` using the given `iv` and `key`.
pub(super) fn encrypt_chacha20_poly1305(
key: &CoseSymmetricKey<'_, <Self as CryptoBackend>::Error>,
plaintext: &[u8],
Expand All @@ -16,6 +18,8 @@ impl<RNG: RngCore + CryptoRng> RustCryptoContext<RNG> {
Self::encrypt_aead::<ChaCha20Poly1305>(key, plaintext, aad, iv)
}

/// Perform a ChaCha20/Poly1305 decryption operation on `ciphertext_with_tag` and the additional
/// authenticated data `aad` using the given `iv` and `key`.
pub(super) fn decrypt_chacha20_poly1305(
key: &CoseSymmetricKey<'_, <Self as CryptoBackend>::Error>,
ciphertext_with_tag: &[u8],
Expand Down

0 comments on commit 1a6566e

Please sign in to comment.