Skip to main content

SharedSecretProvider

Trait SharedSecretProvider 

Source
pub trait SharedSecretProvider: Send + Sync {
    // Required method
    fn get_shared_secret(&self, handle: SharedSecretHandle) -> Option<Vec<u8>>;

    // Provided method
    fn get_shared_secret_challenges(
        &self,
        _handle: SharedSecretHandle,
    ) -> Option<([u8; 32], [u8; 32])> { ... }
}
Expand description

Lookup bridge between AuthenticationPlugin and crate::crypto::CryptographicPlugin.

After the handshake the authentication plugin produces a SharedSecretHandle and knows the associated 32 bytes from x25519 + HKDF-SHA256. The crypto plugin needs exactly these bytes to derive its per-peer master key — instead of generating a random key and routing it as an opaque token through the governance.

Implementors must be Send + Sync so that the crypto plugin can hold the provider via Arc<dyn SharedSecretProvider>.

Required Methods§

Source

fn get_shared_secret(&self, handle: SharedSecretHandle) -> Option<Vec<u8>>

Returns the raw bytes of the shared key. None if the handle is unknown (handshake not yet completed or already discarded).

Provided Methods§

Source

fn get_shared_secret_challenges( &self, _handle: SharedSecretHandle, ) -> Option<([u8; 32], [u8; 32])>

Returns (challenge1, challenge2) of the associated handshake (challenge1 = initiator, challenge2 = replier). These feed into the VolatileSecure key derivation (DDS-Security §9.5.3.5, calculate_kx_keys) — both peers derive the same Kx key from (SharedSecret, challenge1, challenge2). Default None for providers without challenge tracking (e.g. PSK/mock); their Kx path then uses the fallback.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§