[−][src]Struct fog_pack::crypto::Vault
A Vault for storing secret keys.
A Vault can be created from a password and a password security level, or can be decoded from an
encrypted byte vector. It holds private keys and symmetric secret keys, which can be used
through the Vault interface to create a Lockbox or to sign hashes.
Implementations
impl Vault[src]
pub fn new_from_password(
security: PasswordLevel,
password: String
) -> Result<Vault, ()>[src]
security: PasswordLevel,
password: String
) -> Result<Vault, ()>
Create a brand-new empty Vault. Can fail if the OS doesn't let us allocate enough memory for the password hashing algorithm, or if the password is too short or too long.
Consumes the password string in the process and zeroes it out before dropping it.
pub fn write_to_file(&self, f: &mut File) -> Result<()>[src]
Write the entire keystore out to a file.
pub fn encode(&self) -> Vec<u8>[src]
Encrypt the entire keystore and pass it out as a byte vector.
pub fn read_from_file(f: &mut File, password: String) -> Result<Self>[src]
Read the entire keystore from a file, returning a Vault.
Consumes the password string in the process and zeroes it out before dropping it.
pub fn decode(content: Vec<u8>, password: String) -> Result<Self>[src]
Read a keystore from a byte vector, returning a Vault. Consumes both the byte vector and the password string. The byte vector is used for in-place decryption, then is zeroed out. The password string is likewise zeroed out.
pub fn new_key(&mut self) -> Key[src]
Create a new key and add to permanent store.
pub fn new_stream(&mut self) -> StreamKey[src]
Create a new Stream and add to permanent store.
pub fn key_to_perm(&mut self, k: &Key) -> bool[src]
Moves both the Key and Identity to the permanent store.
pub fn stream_to_perm(&mut self, stream: &StreamKey) -> bool[src]
Moves the given Stream to the permanent store.
pub fn has_stream(&self, stream: &StreamKey) -> bool[src]
Checks to see if we have the given Stream.
pub fn owns_identity(&self, id: &Identity) -> bool[src]
Checks to see if we know the Key for the given Identity.
pub fn has_key(&self, key: &Key) -> bool[src]
Checks to see if we have the given Key.
pub fn drop_key(&mut self, k: Key)[src]
Drops the given key from every store.
pub fn drop_stream(&mut self, stream: StreamKey)[src]
Drops the given stream from every store.
pub fn sign(&self, hash: &Hash, key: &Key) -> Result<Signature, CryptoError>[src]
pub fn encrypt_using_stream(
&self,
data: LockboxContent,
stream: &StreamKey
) -> Result<Lockbox, CryptoError>[src]
&self,
data: LockboxContent,
stream: &StreamKey
) -> Result<Lockbox, CryptoError>
Create a Lockbox using a StreamKey.
pub fn encrypt_using_identity(
&self,
data: LockboxContent,
id: &Identity
) -> Result<Lockbox, CryptoError>[src]
&self,
data: LockboxContent,
id: &Identity
) -> Result<Lockbox, CryptoError>
Create a Lockbox using an Identity.
pub fn encrypt_using_identity_keep_key(
&mut self,
data: LockboxContent,
id: &Identity
) -> Result<(Lockbox, StreamKey), CryptoError>[src]
&mut self,
data: LockboxContent,
id: &Identity
) -> Result<(Lockbox, StreamKey), CryptoError>
Create a Lockbox using an Identity and keep the StreamKey used for it.
pub fn decrypt(&mut self, lock: Lockbox) -> Result<LockboxContent, CryptoError>[src]
Attempt to open a Lockbox and return the contents
Auto Trait Implementations
impl RefUnwindSafe for Vault
impl Send for Vault
impl Sync for Vault
impl Unpin for Vault
impl UnwindSafe for Vault
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,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,