pub struct SessionKey { /* private fields */ }Expand description
A negotiated AES-256-CBC session key ready for SecureString
encryption / decryption.
Implementations§
Source§impl SessionKey
impl SessionKey
Sourcepub fn from_bytes(key: [u8; 32]) -> Self
pub fn from_bytes(key: [u8; 32]) -> Self
Wrap a raw 256-bit key.
Sourcepub fn encrypt_secure_string(&self, plaintext: &str) -> Vec<u8> ⓘ
pub fn encrypt_secure_string(&self, plaintext: &str) -> Vec<u8> ⓘ
Encrypt a plaintext string and return IV || ciphertext.
PSRP transports SecureString values by UTF-16LE-encoding the
plaintext, AES-CBC encrypting with PKCS#7 padding, and prefixing
the 16-byte IV.
Sourcepub fn decrypt_secure_string(&self, payload: &[u8]) -> Result<String>
pub fn decrypt_secure_string(&self, payload: &[u8]) -> Result<String>
Decrypt IV || ciphertext back into the plaintext string.
Trait Implementations§
Source§impl Clone for SessionKey
impl Clone for SessionKey
Source§fn clone(&self) -> SessionKey
fn clone(&self) -> SessionKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SessionKey
impl RefUnwindSafe for SessionKey
impl Send for SessionKey
impl Sync for SessionKey
impl Unpin for SessionKey
impl UnsafeUnpin for SessionKey
impl UnwindSafe for SessionKey
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