Skip to main content

SecurityGate

Struct SecurityGate 

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

Entscheidet pro Topic ob/wie ausgehende Submessages verschluesselt oder signiert werden muessen.

Implementations§

Source§

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

Source

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

Konstruktor.

Source

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

Entscheidet, ob ausgehende Submessage fuer topic_name wrapped werden muss.

Source

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

Wrap ausgehende Submessage wenn Governance es verlangt. Protection-Kind None liefert das Original-Byte-Slice unveraendert zurueck (Passthrough).

§Errors

Siehe SecurityGateError.

Source

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

Unwrap eingehende Submessage. Wenn das Format KEIN SEC_PREFIX zeigt, aber Governance SIGN/ENCRYPT verlangt → Policy- Violation. Wenn Governance None und die Bytes kein SEC_PREFIX, einfach passthrough.

§Errors

Siehe SecurityGateError.

Loopback-only: dieses Convenience-Entry nutzt den lokalen Slot fuer Key-Lookup; echte Cross-Participant-Decoding laeuft ueber Self::decode_inbound_message mit remote_slot.

Source

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

Registriert einen Remote-Peer. Der zurueckgegebene Handle ist der CryptoHandle im lokalen Plugin, an dem der Remote-Key danach via Self::set_remote_token angelegt wird.

§Errors

Siehe SecurityGateError.

Source

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

Liefert den Crypto-Token des lokalen Participants (zu senden an Remote via SEDP-Participant-CryptoToken-Submessage).

§Errors

CryptoSetup/Crypto wenn der lokale Handle nicht existiert.

Source

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

Akzeptiert einen Remote-Crypto-Token und installiert ihn unter dem uebergebenen Remote-Handle.

§Errors

Siehe SecurityGateError.

Source

pub fn message_protection(&self) -> ProtectionKind

Ist fuer diese Domain ein RTPS-Message-Level-Schutz konfiguriert? Schaut in das erste matchende <domain_rule> und liefert den rtps_protection_kind.

Source

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

Wrap eine komplette RTPS-Message (inkl. 20-byte Header) wenn rtps_protection_kind != None. Sonst passthrough.

§Errors

Siehe SecurityGateError.

Source

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

Unwrap eine eingehende RTPS-Message. remote_slot ist der CryptoHandle unter dem der Sender-Key registriert ist (liefert register_remote + set_remote_token zurueck).

Implementation-Detail: der Plugin-Trait nutzt local als Key-Slot-Identifier (siehe OMG §8.5.1.9.4 Mapping), daher reichen wir remote_slot als local-Arg an den Codec durch — das ist der Slot in dem Alice’s Master-Key liegt.

§Errors

Siehe SecurityGateError.

Auto Trait Implementations§

§

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>

§

impl<'c, P> !UnwindSafe 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.