Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/VDM/VDMPP/SmokingPP/java/src/gui/resources/   (Vienna Development Method ©)  Datei vom 13.4.2020 mit Größe 1 kB image not shown  

Quelle  rxdak.rs   Sprache: Rust

 

//! Rendezvous Initiator/Responder Device Authentication Key (RIDAK/RRDAK) utilities.
use super::{AuthenticationKey, rxdxk};
use crate::crypto::{blake2b::Blake2bMac256, chacha20, digest::FixedOutput as _};

#[inline]
fn derive_keys(ak: &AuthenticationKey) -> (chacha20::Key, chacha20::Key) {
    let ridak = Blake2bMac256::new_with_salt_and_personal(Some(&ak.0), b"rida", b"3ma-rendezvous")
        .expect("Blake2bMac256 failed")
        .finalize_fixed();
    let rrdak = Blake2bMac256::new_with_salt_and_personal(Some(&ak.0), b"rrda", b"3ma-rendezvous")
        .expect("Blake2bMac256 failed")
        .finalize_fixed();
    (ridak, rrdak)
}

/// RID's encrypt/decrypt context used for initial authentication.
pub(super) struct ForRid {
    pub(super) ridak: rxdxk::Encrypt,
    pub(super) rrdak: rxdxk::Decrypt,
}

/// RRD's encrypt/decrypt context used for initial authentication.
pub(super) struct ForRrd {
    pub(super) ridak: rxdxk::Decrypt,
    pub(super) rrdak: rxdxk::Encrypt,
}

impl ForRid {
    pub(super) fn new(ak: &AuthenticationKey, pid: u32) -> Self {
        let (ridak, rrdak) = derive_keys(ak);
        Self {
            ridak: rxdxk::Encrypt::new(pid, 1, ridak),
            rrdak: rxdxk::Decrypt::new(pid, 1, rrdak),
        }
    }
}

impl ForRrd {
    pub(super) fn new(ak: &AuthenticationKey, pid: u32) -> Self {
        let (ridak, rrdak) = derive_keys(ak);
        Self {
            ridak: rxdxk::Decrypt::new(pid, 1, ridak),
            rrdak: rxdxk::Encrypt::new(pid, 1, rrdak),
        }
    }
}

Messung V0.5 in Prozent
C=94 H=100 G=96

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-09-28) ¤

*© Formatika GbR, Deutschland






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.