pub struct AesGcmCryptoPlugin { /* private fields */ }Expand description
AES-GCM Crypto-Plugin. Keys werden in einem internen Slab
gehalten; Lookup per CryptoHandle. Welche Suite lokal erzeugte
Keys haben, bestimmt local_suite — Remote-Keys kommen mit ihrer
eigenen Suite-ID via Token.
Implementations§
Source§impl AesGcmCryptoPlugin
impl AesGcmCryptoPlugin
Sourcepub fn with_suite(suite: Suite) -> Self
pub fn with_suite(suite: Suite) -> Self
Konstruktor mit expliziter Suite (Aes128Gcm oder Aes256Gcm).
Sourcepub fn with_secret_provider(
suite: Suite,
provider: Arc<dyn SharedSecretProvider>,
) -> Self
pub fn with_secret_provider( suite: Suite, provider: Arc<dyn SharedSecretProvider>, ) -> Self
Baut einen Plugin-Slot mit echtem DH-abgeleiteten Per-Peer-Key
. Der SharedSecretProvider liefert die rohen Bytes
aus einem abgeschlossenen Authentication-Handshake; wir leiten
via HKDF-SHA256 einen deterministischen Master-Key ab, den beide
Seiten ohne Token-Exchange berechnen koennen.
Mit Provider: register_matched_remote_participant nutzt den
uebergebenen SharedSecretHandle, um den Per-Peer-Key aus dem
PKI-Handshake zu ziehen. Ohne Provider bleibt das v1.4-Verhalten
(Random-Key + Token-Exchange).
Sourcepub fn local_suite(&self) -> Suite
pub fn local_suite(&self) -> Suite
Lokale Suite (fuer Tests / Metrics).
Sourcepub fn encrypts_remaining(&self, handle: CryptoHandle) -> SecurityResult<u64>
pub fn encrypts_remaining(&self, handle: CryptoHandle) -> SecurityResult<u64>
Zaehl der verbleibenden sicheren Encrypts auf einem Slot.
Wrapping-Point: Suite::max_encrypts() (2^48 per Default).
Caller sollte bei 0 einen Key-Refresh anstossen .
§Errors
BadArgument wenn der Handle nicht existiert.
Sourcepub fn rotate_key(&mut self, handle: CryptoHandle) -> SecurityResult<()>
pub fn rotate_key(&mut self, handle: CryptoHandle) -> SecurityResult<()>
Erzwingt einen neuen Master-Key im Slot. Nach rotate_key ist
der alte Key futsch — Gegenseite muss per
CryptographicPlugin::create_local_participant_crypto_tokens
einen neuen Token ziehen und via
CryptographicPlugin::set_remote_participant_crypto_tokens
synchronisieren.
§Errors
BadArgument wenn der Handle nicht existiert; CryptoFailed
wenn die RNG versagt.
Trait Implementations§
Source§impl CryptographicPlugin for AesGcmCryptoPlugin
impl CryptographicPlugin for AesGcmCryptoPlugin
Source§fn register_local_participant(
&mut self,
_identity: IdentityHandle,
_properties: &[(&str, &str)],
) -> SecurityResult<CryptoHandle>
fn register_local_participant( &mut self, _identity: IdentityHandle, _properties: &[(&str, &str)], ) -> SecurityResult<CryptoHandle>
Source§fn register_matched_remote_participant(
&mut self,
_local: CryptoHandle,
_remote_identity: IdentityHandle,
shared_secret: SharedSecretHandle,
) -> SecurityResult<CryptoHandle>
fn register_matched_remote_participant( &mut self, _local: CryptoHandle, _remote_identity: IdentityHandle, shared_secret: SharedSecretHandle, ) -> SecurityResult<CryptoHandle>
Source§fn register_local_endpoint(
&mut self,
_participant: CryptoHandle,
_is_writer: bool,
_properties: &[(&str, &str)],
) -> SecurityResult<CryptoHandle>
fn register_local_endpoint( &mut self, _participant: CryptoHandle, _is_writer: bool, _properties: &[(&str, &str)], ) -> SecurityResult<CryptoHandle>
Source§fn create_local_participant_crypto_tokens(
&mut self,
local: CryptoHandle,
_remote: CryptoHandle,
) -> SecurityResult<Vec<u8>>
fn create_local_participant_crypto_tokens( &mut self, local: CryptoHandle, _remote: CryptoHandle, ) -> SecurityResult<Vec<u8>>
ParticipantCryptoTokens-Blob, das an den Remote-
Participant gesendet wird (enthaelt verschluesseltes
Key-Material).Source§fn set_remote_participant_crypto_tokens(
&mut self,
_local: CryptoHandle,
remote: CryptoHandle,
tokens: &[u8],
) -> SecurityResult<()>
fn set_remote_participant_crypto_tokens( &mut self, _local: CryptoHandle, remote: CryptoHandle, tokens: &[u8], ) -> SecurityResult<()>
Source§fn encrypt_submessage(
&self,
local: CryptoHandle,
_remote_list: &[CryptoHandle],
plaintext: &[u8],
aad_extension: &[u8],
) -> SecurityResult<Vec<u8>>
fn encrypt_submessage( &self, local: CryptoHandle, _remote_list: &[CryptoHandle], plaintext: &[u8], aad_extension: &[u8], ) -> SecurityResult<Vec<u8>>
SecureSubmessage-Payload (ciphertext + tag). Read moreSource§fn decrypt_submessage(
&self,
local: CryptoHandle,
_remote: CryptoHandle,
ciphertext: &[u8],
aad_extension: &[u8],
) -> SecurityResult<Vec<u8>>
fn decrypt_submessage( &self, local: CryptoHandle, _remote: CryptoHandle, ciphertext: &[u8], aad_extension: &[u8], ) -> SecurityResult<Vec<u8>>
aad_extension
muss byte-identisch zur Sender-AAD sein (sonst Tag-Mismatch). Read moreSource§fn encrypt_submessage_multi(
&self,
local: CryptoHandle,
receivers: &[(CryptoHandle, u32)],
plaintext: &[u8],
aad_extension: &[u8],
) -> SecurityResult<(Vec<u8>, Vec<ReceiverMac>)>
fn encrypt_submessage_multi( &self, local: CryptoHandle, receivers: &[(CryptoHandle, u32)], plaintext: &[u8], aad_extension: &[u8], ) -> SecurityResult<(Vec<u8>, Vec<ReceiverMac>)>
Receiver-Specific-MACs (Spec
§7.3.6.3). Produziert einen Ciphertext (Sender-Key) plus
pro Remote einen 16-byte Truncated-HMAC. Read more