Skip to main content

PskCryptoPlugin

Struct PskCryptoPlugin 

Source
pub struct PskCryptoPlugin { /* private fields */ }
Expand description

PSK-Crypto-Plugin. Class-Id "DDS:Crypto:PSK:AES-GCM-GMAC:1.2", Wire-Layout = AES-GCM-Plugin.

Implementations§

Source§

impl PskCryptoPlugin

Source

pub fn new() -> Self

Konstruktor mit Default-Suite AES-GCM-128.

Source

pub fn with_suite(suite: Suite) -> Self

Konstruktor mit expliziter Suite.

Source

pub fn suite(&self) -> Suite

Aktive Suite (fuer Tests / Metrics).

Source

pub fn register_psk(&mut self, psk_id: u64, key: Vec<u8>) -> SecurityResult<()>

Registriert einen Pre-Shared-Key. Der Caller adressiert ihn spaeter via register_psk_remote ueber den gleichen psk_id-Namespace. Im PSK-Pfad gibt es keinen Random-Phase, d.h. Encrypt-Tokens werden via register_psk_remote direkt ohne RNG generiert.

§Errors

BadArgument wenn der Key leer ist.

Source

pub fn register_psk_remote( &mut self, local: CryptoHandle, remote_identity: IdentityHandle, psk_id: u64, session_id: [u8; 4], ) -> SecurityResult<CryptoHandle>

Registriert einen Remote-Slot fuer einen bekannten PSK. Der Plugin leitet via HKDF einen Per-Peer-Master-Key ab und schreibt ihn als Wire-Token in den AES-GCM-Slot. Beide Seiten muessen denselben PSK + dieselbe session_id verwenden, damit die Decrypt-Seite passt.

§Errors

BadArgument wenn psk_id unbekannt; sonstige Crypto-Fehler.

Source

pub fn register_psk_local( &mut self, psk_id: u64, session_id: [u8; 4], ) -> SecurityResult<CryptoHandle>

Registriert auch den lokalen Slot deterministisch aus PSK + session_id — ueblicherweise aufgerufen statt register_local_participant wenn man pure-PSK-Sym-Keys haben will (beide Seiten rechnen den Key offline aus).

§Errors

Wie Self::register_psk_remote.

Trait Implementations§

Source§

impl CryptographicPlugin for PskCryptoPlugin

Source§

fn register_local_participant( &mut self, identity: IdentityHandle, properties: &[(&str, &str)], ) -> SecurityResult<CryptoHandle>

Erzeugt Participant-Crypto-Material aus dem Handshake- SharedSecret.
Source§

fn register_matched_remote_participant( &mut self, local: CryptoHandle, remote_identity: IdentityHandle, shared_secret: SharedSecretHandle, ) -> SecurityResult<CryptoHandle>

Erzeugt Crypto-Material fuer einen Remote-Participant.
Source§

fn register_local_endpoint( &mut self, participant: CryptoHandle, is_writer: bool, properties: &[(&str, &str)], ) -> SecurityResult<CryptoHandle>

Erzeugt Crypto-Material fuer einen lokalen DataWriter/Reader.
Source§

fn create_local_participant_crypto_tokens( &mut self, local: CryptoHandle, remote: CryptoHandle, ) -> SecurityResult<Vec<u8>>

Erzeugt das ParticipantCryptoTokens-Blob, das an den Remote- Participant gesendet wird (enthaelt verschluesseltes Key-Material).
Source§

fn set_remote_participant_crypto_tokens( &mut self, local: CryptoHandle, remote: CryptoHandle, tokens: &[u8], ) -> SecurityResult<()>

Verarbeitet die Tokens vom Remote-Participant. Danach sind die Keys fuer encrypted Submessages wechselseitig bekannt.
Source§

fn encrypt_submessage( &self, local: CryptoHandle, remote_list: &[CryptoHandle], plaintext: &[u8], aad_extension: &[u8], ) -> SecurityResult<Vec<u8>>

Encrypt + Sign einer RTPS-Submessage. Input: plain submessage bytes. Output: SecureSubmessage-Payload (ciphertext + tag). Read more
Source§

fn decrypt_submessage( &self, local: CryptoHandle, remote: CryptoHandle, ciphertext: &[u8], aad_extension: &[u8], ) -> SecurityResult<Vec<u8>>

Decrypt + Verify. Output: plain submessage bytes. aad_extension muss byte-identisch zur Sender-AAD sein (sonst Tag-Mismatch). Read more
Source§

fn encrypt_submessage_multi( &self, local: CryptoHandle, receivers: &[(CryptoHandle, u32)], plaintext: &[u8], aad_extension: &[u8], ) -> SecurityResult<(Vec<u8>, Vec<ReceiverMac>)>

Encrypt+Sign mit Receiver-Specific-MACs (Spec §7.3.6.3). Produziert einen Ciphertext (Sender-Key) plus pro Remote einen 16-byte Truncated-HMAC. Read more
Source§

fn decrypt_submessage_with_receiver_mac( &self, local: CryptoHandle, remote: CryptoHandle, own_key_id: u32, own_mac_key_handle: CryptoHandle, ciphertext: &[u8], macs: &[ReceiverMac], aad_extension: &[u8], ) -> SecurityResult<Vec<u8>>

Verify Receiver-Specific-MAC + Decrypt. Read more
Source§

fn plugin_class_id(&self) -> &str

Plugin-Class-Id (z.B. “DDS:Crypto:AES-GCM-GMAC:1.2”).
Source§

impl Default for PskCryptoPlugin

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.