[][src]Struct sodiumoxide::crypto::box_::curve25519xsalsa20poly1305::Nonce

#[must_use]pub struct Nonce(pub [u8; 24]);

Nonce for asymmetric authenticated encryption

Implementations

impl Nonce[src]

pub fn from_slice(bs: &[u8]) -> Option<Nonce>[src]

from_slice() creates an object from a byte slice

This function will fail and return None if the length of the byte-slice isn't equal to the length of the object

pub fn increment_le(&self) -> Nonce[src]

increment_le() treats the nonce as an unsigned little-endian number and returns an incremented version of it.

WARNING: this method does not check for arithmetic overflow. It is the callers responsibility to ensure that any given nonce value is only used once. If the caller does not do that the cryptographic primitives in sodiumoxide will not uphold any security guarantees (i.e. they will break)

pub fn increment_le_inplace(&mut self)[src]

increment_le_inplace() treats the nonce as an unsigned little-endian number and increments it.

WARNING: this method does not check for arithmetic overflow. It is the callers responsibility to ensure that any given nonce value is only used once. If the caller does not do that the cryptographic primitives in sodiumoxide will not uphold any security guarantees.

Trait Implementations

impl AsRef<[u8]> for Nonce[src]

impl Clone for Nonce[src]

impl Copy for Nonce[src]

impl Debug for Nonce[src]

impl<'de> Deserialize<'de> for Nonce[src]

impl Eq for Nonce[src]

impl Hash for Nonce[src]

impl Index<Range<usize>> for Nonce[src]

Allows a user to access the byte contents of an object as a slice.

WARNING: it might be tempting to do comparisons on objects by using x[a..b] == y[a..b]. This will open up for timing attacks when comparing for example authenticator tags. Because of this only use the comparison functions exposed by the sodiumoxide API.

type Output = [u8]

The returned type after indexing.

impl Index<RangeFrom<usize>> for Nonce[src]

Allows a user to access the byte contents of an object as a slice.

WARNING: it might be tempting to do comparisons on objects by using x[a..] == y[a..]. This will open up for timing attacks when comparing for example authenticator tags. Because of this only use the comparison functions exposed by the sodiumoxide API.

type Output = [u8]

The returned type after indexing.

impl Index<RangeFull> for Nonce[src]

Allows a user to access the byte contents of an object as a slice.

WARNING: it might be tempting to do comparisons on objects by using x[] == y[]. This will open up for timing attacks when comparing for example authenticator tags. Because of this only use the comparison functions exposed by the sodiumoxide API.

type Output = [u8]

The returned type after indexing.

impl Index<RangeTo<usize>> for Nonce[src]

Allows a user to access the byte contents of an object as a slice.

WARNING: it might be tempting to do comparisons on objects by using x[..b] == y[..b]. This will open up for timing attacks when comparing for example authenticator tags. Because of this only use the comparison functions exposed by the sodiumoxide API.

type Output = [u8]

The returned type after indexing.

impl Ord for Nonce[src]

impl PartialEq<Nonce> for Nonce[src]

impl PartialOrd<Nonce> for Nonce[src]

impl Serialize for Nonce[src]

Auto Trait Implementations

impl RefUnwindSafe for Nonce

impl Send for Nonce

impl Sync for Nonce

impl Unpin for Nonce

impl UnwindSafe for Nonce

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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.