Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/mls-rs-crypto-hpke/src/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Impressum test_utils.rs

  Sprache: Rust
 

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Copyright by contributors to this project.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

#![cfg(not(mls_build_async))]

use alloc::vec::Vec;

use crate::{
    context::{Context, ContextR, ContextS, EncryptionContext},
    dhkem::DhKem,
    hpke::Hpke,
};

use mls_rs_core::crypto::test_suite::{EncapOutput, TestHpke};
use mls_rs_crypto_traits::{AeadType, DhType, KdfType, KemResult, KemType};

impl<DH: DhType, KDF: KdfType + Clone, AEAD: AeadType + Clone> TestHpke
    for Hpke<DhKem<DH, KDF>, KDF, AEAD>
{
    type ContextR = ContextR<KDF, AEAD>;
    type ContextS = ContextS<KDF, AEAD>;

    fn hpke_context(
        &self,
        key: Vec<u8>,
        base_nonce: Vec<u8>,
        exporter_secret: Vec<u8>,
    ) -> (Self::ContextS, Self::ContextR) {
        let encryption_context =
            EncryptionContext::new(base_nonce, self.aead.clone().unwrap(), key).unwrap();

        let context = Context::new(
            Some(encryption_context),
            exporter_secret.clone(),
            self.kdf.clone(),
        );

        (ContextS(context.clone()), ContextR(context))
    }

    fn encap(&mut self, ikm_e: Vec<u8>, pk_rm: Vec<u8>) -> EncapOutput {
        self.kem.set_test_data(ikm_e);
        let KemResult { enc, shared_secret } = self.kem.encap(&pk_rm.into()).unwrap();

        EncapOutput { enc, shared_secret }
    }

    fn decap(&mut self, enc: Vec<u8>, sk_rm: Vec<u8>, pk_rm: Vec<u8>) -> Vec<u8> {
        self.kem.decap(&enc, &sk_rm.into(), &pk_rm.into()).unwrap()
    }
}

Messung V0.5 in Prozent
C=95 H=100 G=97

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.9Bemerkung:  (vorverarbeitet am  2026-06-21) ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.