[][src]Struct sync15::KeyBundle

pub struct KeyBundle {
    enc_key: Vec<u8>,
    mac_key: Vec<u8>,
}

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]

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]

Encrypt using the provided IV.

pub fn encrypt_bytes_rand_iv(
    &self,
    cleartext_bytes: &[u8]
) -> Result<(String, String, String)>
[src]

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]

pub fn encrypt_rand_iv(
    &self,
    cleartext: &str
) -> Result<(String, String, String)>
[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CallHasher for T where
    T: Hash

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,