[−][src]Struct tox_packet::dht::CryptoData
Packet used to send data over net_crypto
connection.
Serialized form:
Length | Content |
---|---|
1 | 0x1b |
2 | Last 2 bytes of the Nonce |
variable | Payload |
Fields
nonce_last_bytes: u16
Last two bytes of Nonce
for the current encrypted payload in BigEndian
format
payload: Vec<u8>
Encrypted payload
Implementations
impl CryptoData
[src]
pub fn nonce_last_bytes(nonce: Nonce) -> u16
[src]
Get last two bytes of Nonce
considering it as BigEndian number.
pub fn new(
shared_secret: &PrecomputedKey,
nonce: Nonce,
payload: &CryptoDataPayload
) -> CryptoData
[src]
shared_secret: &PrecomputedKey,
nonce: Nonce,
payload: &CryptoDataPayload
) -> CryptoData
Create CryptoData
from CryptoDataPayload
encrypting it with
shared_key
.
pub fn get_payload(
&self,
shared_secret: &PrecomputedKey,
nonce: &Nonce
) -> Result<CryptoDataPayload, GetPayloadError>
[src]
&self,
shared_secret: &PrecomputedKey,
nonce: &Nonce
) -> Result<CryptoDataPayload, GetPayloadError>
Decrypt payload with precomputed key and nonce and try to parse it as CryptoDataPayload
.
Returns Error
in case of failure:
- fails to decrypt
- fails to parse
CryptoDataPayload
Trait Implementations
impl Clone for CryptoData
[src]
pub fn clone(&self) -> CryptoData
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for CryptoData
[src]
impl Eq for CryptoData
[src]
impl FromBytes for CryptoData
[src]
impl PartialEq<CryptoData> for CryptoData
[src]
pub fn eq(&self, other: &CryptoData) -> bool
[src]
pub fn ne(&self, other: &CryptoData) -> bool
[src]
impl StructuralEq for CryptoData
[src]
impl StructuralPartialEq for CryptoData
[src]
impl ToBytes for CryptoData
[src]
Auto Trait Implementations
impl RefUnwindSafe for CryptoData
[src]
impl Send for CryptoData
[src]
impl Sync for CryptoData
[src]
impl Unpin for CryptoData
[src]
impl UnwindSafe for CryptoData
[src]
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,
pub 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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>,