Skip to main content

SecurityProfile

Struct SecurityProfile 

Source
pub struct SecurityProfile {
    pub gate: Arc<SharedSecurityGate>,
    pub pki: Arc<Mutex<PkiAuthenticationPlugin>>,
    pub identity_handle: IdentityHandle,
    pub adjusted_participant_guid: [u8; 16],
    pub governance: Governance,
    pub permissions: Permissions,
}
Expand description

Fully built security profile. The caller typically only needs gate (attach to RuntimeConfig.security) — pki/identity_handle are needed for later programmatic handshake driving (e.g. for tests that work without SEDP).

Fields§

§gate: Arc<SharedSecurityGate>

Ready-to-consume SharedSecurityGate in Arc form, as RuntimeConfig.security expects it.

§pki: Arc<Mutex<PkiAuthenticationPlugin>>

PKI plugin with a registered local identity. Arc<Mutex>, because it is shared by both the handshake driver (&mut for begin/process_handshake) and the crypto plugin (as a SharedSecretProvider, &self).

§identity_handle: IdentityHandle

Handle of the local participant in the PKI plugin.

§adjusted_participant_guid: [u8; 16]

The DDS-Security §9.3.3-adjusted 16-byte participant GUID (prefix cryptographically bound to the identity). The caller MUST use this GUID (or its prefix) for the runtime/SPDP participant, so that the SPDP beacon, handshake c.pdata and all entity GUIDs are consistent.

§governance: Governance

Parsed governance.

§permissions: Permissions

Parsed permissions.

Implementations§

Source§

impl SecurityProfile

Source

pub fn from_files( cfg: &SecurityProfileConfig, participant_guid: [u8; 16], ) -> Result<Self, SecurityProfileError>

Reads all files, verifies CMS signatures, builds PKI + gate.

participant_guid is the 16-byte DDS GUID of the local participant — embedded by the PKI plugin into the handshake token.

§Errors

SecurityProfileError in the variants Io / Pki / Permissions / GovernanceUtf8.

Source

pub fn from_enclave_dir( enclave_dir: impl AsRef<Path>, domain_id: u32, participant_guid: [u8; 16], ) -> Result<Self, SecurityProfileError>

C7 — loads a profile from an SROS2 enclave directory in one call.

An SROS2 keystore lays each participant’s material out under enclaves/<name>/ and symlinks the standard file names into it:

enclave filerole
cert.pemidentity certificate
key.pemidentity private key (PKCS#8)
identity_ca.cert.pemidentity CA bundle
permissions_ca.cert.pempermissions CA bundle
governance.p7sCMS-signed governance XML
permissions.p7sCMS-signed permissions XML

This replaces the six-path SecurityProfileConfig ceremony with a single directory, mirroring how ros2 security enclaves are consumed.

§Errors

SecurityProfileError::Io when a standard file is absent, plus the Pki/Permissions/Governance variants from Self::from_files.

Source

pub fn from_env( participant_guid: [u8; 16], ) -> Result<Option<Self>, SecurityProfileError>

C7 — “secure by default” env entry point. Loads an enclave from ZERODDS_SECURITY_DIR; the domain comes from ROS_DOMAIN_ID (default 0). Returns Ok(None) when ZERODDS_SECURITY_DIR is unset, so a launch path can opt into security with a single env var:

export ZERODDS_SECURITY_DIR=$ROS_SECURITY_KEYSTORE/enclaves/talker
export ROS_DOMAIN_ID=42
§Errors

Propagates Self::from_enclave_dir errors when the dir is set but the material is missing or invalid.

Trait Implementations§

Source§

impl Debug for SecurityProfile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> Same for T

Source§

type Output = T

Should always be Self
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.