Skip to main content

SecurityGate

Struct SecurityGate 

Source
pub struct SecurityGate<'c, P: CryptographicPlugin> { /* private fields */ }
Expand description

Decides per topic whether/how outgoing submessages must be encrypted or signed.

Implementations§

Source§

impl<'c, P: CryptographicPlugin> SecurityGate<'c, P>

Source

pub fn new(domain_id: u32, governance: Governance, crypto: &'c mut P) -> Self

Constructor.

Source

pub fn outbound_protection(&self, topic_name: &str) -> ProtectionKind

Decides whether the outgoing submessage for topic_name must be wrapped.

Source

pub fn encode_outbound( &mut self, topic_name: &str, plaintext: &[u8], ) -> Result<Vec<u8>, SecurityGateError>

Wraps the outgoing submessage if governance requires it. Protection kind None returns the original byte slice unchanged (passthrough).

§Errors

See SecurityGateError.

Source

pub fn decode_inbound( &mut self, topic_name: &str, wire: &[u8], ) -> Result<Vec<u8>, SecurityGateError>

Unwraps an incoming submessage. If the format shows NO SEC_PREFIX but governance requires SIGN/ENCRYPT → policy violation. If governance is None and the bytes are not a SEC_PREFIX, simply passthrough.

§Errors

See SecurityGateError.

Loopback-only: this convenience entry uses the local slot for key lookup; real cross-participant decoding goes via Self::decode_inbound_message with remote_slot.

Source

pub fn register_remote( &mut self, remote_identity: IdentityHandle, shared_secret: SharedSecretHandle, ) -> Result<CryptoHandle, SecurityGateError>

Registers a remote peer. The returned handle is the CryptoHandle in the local plugin at which the remote key is then created via Self::set_remote_token.

§Errors

See SecurityGateError.

Source

pub fn local_token(&mut self) -> Result<Vec<u8>, SecurityGateError>

Returns the crypto token of the local participant (to be sent to the remote via the SEDP ParticipantCryptoToken submessage).

§Errors

CryptoSetup/Crypto if the local handle does not exist.

Source

pub fn set_remote_token( &mut self, remote: CryptoHandle, token: &[u8], ) -> Result<(), SecurityGateError>

Accepts a remote crypto token and installs it under the supplied remote handle.

§Errors

See SecurityGateError.

Source

pub fn message_protection(&self) -> ProtectionKind

Is an RTPS message-level protection configured for this domain? Looks into the first matching <domain_rule> and returns the rtps_protection_kind.

Source

pub fn encode_outbound_message( &mut self, message: &[u8], ) -> Result<Vec<u8>, SecurityGateError>

Wraps a complete RTPS message (incl. 20-byte header) if rtps_protection_kind != None. Otherwise passthrough.

§Errors

See SecurityGateError.

Source

pub fn decode_inbound_message( &mut self, remote_slot: CryptoHandle, wire: &[u8], ) -> Result<Vec<u8>, SecurityGateError>

Unwraps an incoming RTPS message. remote_slot is the CryptoHandle under which the sender key is registered (returned by register_remote + set_remote_token).

Implementation detail: the plugin trait uses local as the key-slot identifier (see OMG §8.5.1.9.4 mapping), so we pass remote_slot as the local arg through to the codec — that is the slot where Alice’s master key lives.

§Errors

See SecurityGateError.

Auto Trait Implementations§

§

impl<'c, P> !UnwindSafe for SecurityGate<'c, P>

§

impl<'c, P> Freeze for SecurityGate<'c, P>

§

impl<'c, P> RefUnwindSafe for SecurityGate<'c, P>
where P: RefUnwindSafe,

§

impl<'c, P> Send for SecurityGate<'c, P>

§

impl<'c, P> Sync for SecurityGate<'c, P>

§

impl<'c, P> Unpin for SecurityGate<'c, P>

§

impl<'c, P> UnsafeUnpin for SecurityGate<'c, P>

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.