[][src]Struct tox_packet::dht::EncryptedCookie

pub struct EncryptedCookie {
    pub nonce: Nonce,
    pub payload: Vec<u8>,
}

Encrypted with symmetric key Cookie.

Serialized form:

LengthContent
24Nonce
88Payload

Fields

nonce: Nonce

Nonce for the current encrypted payload

payload: Vec<u8>

Encrypted payload

Implementations

impl EncryptedCookie[src]

pub fn new(symmetric_key: &Key, payload: &Cookie) -> EncryptedCookie[src]

Create EncryptedCookie from Cookie encrypting it with symmetric_key

pub fn get_payload(
    &self,
    symmetric_key: &Key
) -> Result<Cookie, GetPayloadError>
[src]

Decrypt payload with symmetric key and try to parse it as Cookie.

Returns Error in case of failure:

  • fails to decrypt
  • fails to parse Cookie

pub fn hash(&self) -> Digest[src]

Calculate SHA512 hash of encrypted cookie together with nonce

Trait Implementations

impl Clone for EncryptedCookie[src]

impl Debug for EncryptedCookie[src]

impl Eq for EncryptedCookie[src]

impl FromBytes for EncryptedCookie[src]

impl PartialEq<EncryptedCookie> for EncryptedCookie[src]

impl StructuralEq for EncryptedCookie[src]

impl StructuralPartialEq for EncryptedCookie[src]

impl ToBytes for EncryptedCookie[src]

Auto Trait Implementations

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> 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.