[−][src]Struct secretbox::SecretBox
Methods
impl SecretBox
[src]
pub fn new<R>(key: R, cipher: CipherType) -> Option<Self> where
R: AsRef<[u8]>,
[src]
R: AsRef<[u8]>,
Creates a new SecretBox instance
Returns None if the passed key is shorter than 32 bytes
pub fn from_random_key<R>(rng: &mut R, cipher: CipherType) -> (Self, [u8; 32]) where
R: Rng + CryptoRng,
[src]
R: Rng + CryptoRng,
Creates a new SecretBox instance with a generated key
pub fn seal(&self, message: &[u8], nonce: [u8; 24]) -> Vec<u8>
[src]
This function returns an encrypted and authenticated copy of the message. The key and nonce pair must be unique for every message.
pub fn easy_seal(&self, message: &[u8]) -> Vec<u8>
[src]
This function works like the above, except that it automatically generates a unique nonce.
pub fn easy_unseal(&self, data: &[u8]) -> Option<Vec<u8>>
[src]
This function works like unseal, except that it finds the nonce automatically.
pub fn unseal(&self, data: &[u8], nonce: [u8; 24]) -> Option<Vec<u8>>
[src]
This function tries to authenticate and decrypt a box
Trait Implementations
impl PartialEq<SecretBox> for SecretBox
[src]
impl Copy for SecretBox
[src]
impl Eq for SecretBox
[src]
impl Clone for SecretBox
[src]
fn clone(&self) -> SecretBox
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for SecretBox
[src]
Auto Trait Implementations
impl Send for SecretBox
impl Unpin for SecretBox
impl Sync for SecretBox
impl UnwindSafe for SecretBox
impl RefUnwindSafe for SecretBox
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,