pub struct KeyBundle { /* private fields */ }
Implementations§
source§impl KeyBundle
impl KeyBundle
sourcepub fn new(enc: Vec<u8>, mac: Vec<u8>) -> Result<KeyBundle>
pub fn new(enc: Vec<u8>, mac: Vec<u8>) -> Result<KeyBundle>
Construct a key bundle from the already-decoded encrypt and hmac keys. Panics (asserts) if they aren’t both 32 bytes.
pub fn new_random() -> Result<KeyBundle>
pub fn from_ksync_bytes(ksync: &[u8]) -> Result<KeyBundle>
pub fn from_ksync_base64(ksync: &str) -> Result<KeyBundle>
pub fn from_base64(enc: &str, mac: &str) -> Result<KeyBundle>
pub fn encryption_key(&self) -> &[u8] ⓘ
pub fn hmac_key(&self) -> &[u8] ⓘ
pub fn to_b64_array(&self) -> [String; 2]
sourcepub fn decrypt(
&self,
enc_base64: &str,
iv_base64: &str,
hmac_base16: &str,
) -> Result<String>
pub fn decrypt( &self, enc_base64: &str, iv_base64: &str, hmac_base16: &str, ) -> Result<String>
Decrypt the provided ciphertext with the given iv, and decodes the result as a utf8 string.
sourcepub fn encrypt_bytes_with_iv(
&self,
cleartext_bytes: &[u8],
iv: &[u8],
) -> Result<(String, String)>
pub fn encrypt_bytes_with_iv( &self, cleartext_bytes: &[u8], iv: &[u8], ) -> Result<(String, String)>
Encrypt using the provided IV.
sourcepub fn encrypt_bytes_rand_iv(
&self,
cleartext_bytes: &[u8],
) -> Result<(String, String, String)>
pub fn encrypt_bytes_rand_iv( &self, cleartext_bytes: &[u8], ) -> Result<(String, String, String)>
Generate a random iv and encrypt with it. Return both the encrypted bytes and the generated iv.
pub fn encrypt_with_iv( &self, cleartext: &str, iv: &[u8], ) -> Result<(String, String)>
pub fn encrypt_rand_iv( &self, cleartext: &str, ) -> Result<(String, String, String)>
Trait Implementations§
impl Eq for KeyBundle
impl StructuralPartialEq for KeyBundle
Auto Trait Implementations§
impl Freeze for KeyBundle
impl RefUnwindSafe for KeyBundle
impl Send for KeyBundle
impl Sync for KeyBundle
impl Unpin for KeyBundle
impl UnwindSafe for KeyBundle
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>
Read more