pub struct HttpCryptContext { /* private fields */ }Expand description
Precomputed HTTPCrypt state for a fixed destination keypair.
Decoding the base32 peer public key and deriving the short key id used in
the Key header depend only on the destination key, so they are done once
at construction and shared by every request. Everything derived from
ephemeral keys (scalarmult, shared secret, nonce) stays per-request.
Implementations§
Source§impl HttpCryptContext
impl HttpCryptContext
Sourcepub fn new(peer_key_b32: &str) -> Result<Self, RspamdError>
pub fn new(peer_key_b32: &str) -> Result<Self, RspamdError>
Parse a base32-encoded remote public key into a reusable context.
Sourcepub fn key_header(&self, local_pk_b32: &str) -> String
pub fn key_header(&self, local_pk_b32: &str) -> String
Build the Key header value for an ephemeral local public key.
Sourcepub fn encrypt<T, HN, HV>(
&self,
url: &str,
body: &[u8],
headers: T,
) -> Result<HTTPCryptEncrypted, RspamdError>
pub fn encrypt<T, HN, HV>( &self, url: &str, body: &[u8], headers: T, ) -> Result<HTTPCryptEncrypted, RspamdError>
Encrypt a request for the destination this context was built for, generating a fresh ephemeral keypair.
Auto Trait Implementations§
impl Freeze for HttpCryptContext
impl RefUnwindSafe for HttpCryptContext
impl Send for HttpCryptContext
impl Sync for HttpCryptContext
impl Unpin for HttpCryptContext
impl UnsafeUnpin for HttpCryptContext
impl UnwindSafe for HttpCryptContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more