docs

core::crypto::aead

이 페이지의 내용

API 참조는 영어로만 있습니다. 표준 라이브러리 소스의 영어 문서 주석에서 만듭니다.

Authenticated encryption with associated data: AES-GCM (NIST SP 800-38D, 96-bit nonces) and ChaCha20-Poly1305 (RFC 8439). Tags are 16 bytes, appended to the ciphertext. The key material is in secret storage; per-message state is in locals.

Structs

AeadSource

pub struct Aead

A key ready for seal / open.

  • pub fn new<B: AsBytes>(alg: AeadAlgorithm, key: B) throws (ValueError) -> Aead§

    Source

    A cipher for alg keyed by key. Throws ValueError when the key is not the algorithm's key length.

  • pub const fn algorithm(self) -> AeadAlgorithm§

    Source

    The cipher this key is for.

  • pub fn wipe(self)§

    Source

    Overwrite the key material with zeros now (every copy shares it); seal and open are meaningless afterwards.

  • pub fn seal<N: AsBytes, A: AsBytes, P: AsBytes>(self, nonce: N, aad: A, plaintext: P) throws (ValueError) -> List<u8>§

    Source

    plaintext encrypted, then the tag.

  • pub fn open<N: AsBytes, A: AsBytes, C: AsBytes>(self, nonce: N, aad: A, ciphertext_and_tag: C) throws (ValueError) -> List<u8> | none§

    Source

    The plaintext, or none when the tag does not match (nothing is decrypted then).

Trait implementations 2

Enums

AeadAlgorithmSource

pub enum AeadAlgorithm

The AEAD ciphers Aead implements.

  • Aes128Gcm§

    Source
  • Aes256Gcm§

    Source
  • ChaCha20Poly1305§

    Source
  • pub const fn key_len(self) -> usize§

    Source

    The key length in bytes: 16 for AES-128-GCM, else 32.

  • pub const fn nonce_len(self) -> usize§

    Source

    The nonce length in bytes: 12.

  • pub const fn tag_len(self) -> usize§

    Source

    The tag length in bytes: 16.