Skip to main content

PkiAuthenticationPlugin

Struct PkiAuthenticationPlugin 

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

PKI/X.509-based AuthenticationPlugin. Verifies identity certs against a given trust anchor and runs a 3-round PKI-DH handshake (spec §10.3.2.6-8 Tab.56/57/58) with the peer.

Wire (C3.1): three DataHolder tokens DDS:Auth:PKI-DH:1.2+AuthReq / +AuthReply / +AuthFinal. Both sides echo cert_der + dh* + challenge* + hash bindings. The replier signs (kagree || ch1 || dh1 || ch2 || dh2) with the identity private key; the initiator signs (kagree || ch2 || dh2 || ch1 || dh1).

Implementations§

Source§

impl PkiAuthenticationPlugin

Source

pub fn new() -> Self

Constructor.

Source

pub fn set_local_permissions(&mut self, permissions_p7s: Vec<u8>)

Sets the local CMS-signed permissions document (.p7s bytes) that is sent along as c.perm in the HandshakeRequest/Reply. Required for cross-vendor interop with active AccessControl (FastDDS/Cyclone/RTI validate the permissions signature against the permissions_ca).

Source

pub fn set_preferred_kx_suite(&mut self, suite: KxSuite)

Sets the preferred key agreement as initiator. Only for a deliberate vendor-extension choice (e.g. KxSuite::X25519 between pure ZeroDDS peers) — the default EcdhP256 is the spec/cross-vendor choice and should NOT be changed for interop.

Source

pub fn validate_with_config( &mut self, cfg: IdentityConfig, _participant_guid: [u8; 16], ) -> SecurityResult<IdentityHandle>

Programmatic variant: pass IdentityConfig directly instead of a PropertyList. Useful for tests + native Rust callers.

§Errors

See PkiError.

Source

pub fn secret_bytes(&self, handle: SharedSecretHandle) -> Option<&[u8]>

Reads the raw 32-byte SharedSecret bytes. Primarily for tests; in the production path the SharedSecretHandle is passed through to the CryptoPlugin without the caller seeing the bytes.

Trait Implementations§

Source§

impl AuthenticationPlugin for PkiAuthenticationPlugin

Source§

fn validate_local_identity( &mut self, props: &PropertyList, participant_guid: [u8; 16], ) -> SecurityResult<IdentityHandle>

Called once at participant start: validate the local identity (certificate, key, trust anchor) and return a handle. Read more
Source§

fn validate_remote_identity( &mut self, local: IdentityHandle, _remote_participant_guid: [u8; 16], remote_auth_token: &[u8], ) -> SecurityResult<IdentityHandle>

Called as soon as a remote participant has been discovered via SPDP. The plugin validates the remote cert (from remote_auth_token) against its trust store. Read more
Source§

fn get_identity_token(&self, local: IdentityHandle) -> SecurityResult<Vec<u8>>

Returns the IdentityToken for a local identity (spec §9.3.2.4). Published in the SPDP announce as PID_IDENTITY_TOKEN (0x1001). Default: empty token (= the plugin does not support the feature). Read more
Source§

fn get_permissions_token(&self) -> Vec<u8>

Returns the PermissionsToken (spec §7.2.4, PID_PERMISSIONS_TOKEN 0x1002) for the SPDP announce. Strictly per spec the AccessControlPlugin produces it; since ZeroDDS holds the permissions in the auth plugin (set_local_permissions, for the c.perm handshake), the getter lives here. Default: empty (no permissions configured ⇒ AccessControl inactive ⇒ token omitted). Cross-vendor requirement: secure vendors (cyclone/FastDDS) only validate a remote if SPDP carries both tokens (identity + permissions).
Source§

fn set_local_participant_data(&mut self, pdata: Vec<u8>)

Sets the local ParticipantBuiltinTopicData as PL_CDR bytes that are sent along in the handshake as c.pdata (spec §9.3.2.5.2). The replier deserializes c.pdata as a ParameterList and binds the participant_guid to the authenticated identity. Default: no-op.
Source§

fn set_algo_nul_terminate(&mut self, nul: bool)

Cross-vendor quirk: determines whether the next handshake algorithm strings (c.dsign_algo/c.kagree_algo) are emitted + hashed NUL-terminated. OpenDDS compares them with sizeof (incl. \0) and needs the NUL form; FastDDS (#3803) needs them WITHOUT; cyclone is tolerant. Since the handshake runs per-peer, the discovery layer calls this based on the peer’s VendorId BEFORE begin_handshake_request or begin_handshake_reply. Default no-op (NUL-free = spec/FastDDS/ Cyclone-conformant).
Source§

fn begin_handshake_request( &mut self, initiator: IdentityHandle, _replier: IdentityHandle, ) -> SecurityResult<(HandshakeHandle, HandshakeStepOutcome)>

Starts the handshake. Returns the first token that must be sent to the peer. Read more
Source§

fn begin_handshake_reply( &mut self, replier: IdentityHandle, _initiator: IdentityHandle, request_token: &[u8], ) -> SecurityResult<(HandshakeHandle, HandshakeStepOutcome)>

Peer side of the handshake start. request_token is what the initiator sent via begin_handshake_request. Read more
Source§

fn process_handshake( &mut self, handshake: HandshakeHandle, token: &[u8], ) -> SecurityResult<HandshakeStepOutcome>

Pass through follow-up handshake messages. Read more
Source§

fn shared_secret( &self, handshake: HandshakeHandle, ) -> SecurityResult<SharedSecretHandle>

Ends the handshake and returns the final SharedSecret. Failure aborts. Called by the caller after a Complete outcome to pull the secret out of the plugin. Read more
Source§

fn plugin_class_id(&self) -> &str

Identity plugin name (e.g. “DDS:Auth:PKI-DH:1.2”). Announced in SPDP as dds.sec.auth.plugin_class.
Source§

fn get_identity_status_token( &self, _local: IdentityHandle, ) -> Result<Vec<u8>, SecurityError>

Returns the IdentityStatusToken for a local identity (spec §9.3.2.5.1.2). Default: empty. Read more
Source§

fn set_permissions_credential_and_token( &mut self, _local: IdentityHandle, _permissions_credential: &[u8], _permissions_token: &[u8], ) -> Result<(), SecurityError>

Sets the permissions credential and the permissions token on a local identity (spec §9.3.2.4 + §9.3.2.5.4). Fed by the caller layer with the output of the AccessControlPlugin. Read more
Source§

fn get_authenticated_peer_credential_token( &self, _handshake: HandshakeHandle, ) -> Result<Vec<u8>, SecurityError>

Returns the AuthenticatedPeerCredentialToken (spec §9.3.2.5.6). Fetched by the AccessControl layer after a successful handshake to perform the caller subject match. Default: empty. Read more
Source§

impl Default for PkiAuthenticationPlugin

Source§

fn default() -> Self

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

impl SharedSecretProvider for PkiAuthenticationPlugin

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).
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.

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.