[−][src]Struct sync15::KeyBundle
Fields
enc_key: Vec<u8>
mac_key: Vec<u8>
Implementations
impl KeyBundle
[src][−]
pub fn new(enc: Vec<u8>, mac: Vec<u8>) -> Result<KeyBundle>
[src][−]
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>
[src]
pub fn from_ksync_bytes(ksync: &[u8]) -> Result<KeyBundle>
[src]
pub fn from_ksync_base64(ksync: &str) -> Result<KeyBundle>
[src]
pub fn from_base64(enc: &str, mac: &str) -> Result<KeyBundle>
[src]
pub fn encryption_key(&self) -> &[u8]
[src]
pub fn hmac_key(&self) -> &[u8]
[src]
pub fn to_b64_array(&self) -> [String; 2]
[src]
pub fn decrypt(
&self,
enc_base64: &str,
iv_base64: &str,
hmac_base16: &str
) -> Result<String>
[src][−]
&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.
pub fn encrypt_bytes_with_iv(
&self,
cleartext_bytes: &[u8],
iv: &[u8]
) -> Result<(String, String)>
[src][−]
&self,
cleartext_bytes: &[u8],
iv: &[u8]
) -> Result<(String, String)>
Encrypt using the provided IV.
pub fn encrypt_bytes_rand_iv(
&self,
cleartext_bytes: &[u8]
) -> Result<(String, String, String)>
[src][−]
&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)>
[src]
&self,
cleartext: &str,
iv: &[u8]
) -> Result<(String, String)>
pub fn encrypt_rand_iv(
&self,
cleartext: &str
) -> Result<(String, String, String)>
[src]
&self,
cleartext: &str
) -> Result<(String, String, String)>
Trait Implementations
impl Clone for KeyBundle
[src][+]
impl Debug for KeyBundle
[src][+]
impl Eq for KeyBundle
[src]
impl Hash for KeyBundle
[src][+]
impl PartialEq<KeyBundle> for KeyBundle
[src][+]
impl StructuralEq for KeyBundle
[src]
impl StructuralPartialEq for KeyBundle
[src]
Auto Trait Implementations
impl RefUnwindSafe for KeyBundle
impl Send for KeyBundle
impl Sync for KeyBundle
impl Unpin for KeyBundle
impl UnwindSafe for KeyBundle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> CallHasher for T where
T: Hash,
[+]
T: Hash,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[+]
V: MultiLane<T>,