Enum p2p::CryptoContext[][src]

pub enum CryptoContext {
    Null,
    Authenticated {
        their_pk: PublicKey,
        our_sk: SecretKey,
    },
    AnonymousDecrypt {
        our_pk: PublicKey,
        our_sk: SecretKey,
    },
    AnonymousEncrypt {
        their_pk: PublicKey,
    },
}

Simplifies encryption/decryption by holding the necessary context - encryption keys. Allows "null" encryption where data is only serialized. See: null object pattern.

Variants

No encryption.

Encryption + authentication

Fields of Authenticated

Their public key.

Our secret key.

No message authentication. Only decrypt operation is allowed.

Fields of AnonymousDecrypt

Our private key.

Our secret key.

No message authentication. Only encrypt operation is allowed.

Fields of AnonymousEncrypt

Their public key.

Methods

impl CryptoContext
[src]

Construct crypto context that encrypts and authenticate messages.

Contructs "null" encryption context which actually does no encryption. In this case data is simply serialized but not encrypted.

Constructs crypto context that is only meant for unauthenticated deryption.

Constructs crypto context that is only meant for unauthenticated encryption.

Serialize given structure and encrypt it.

Decrypt given buffer and deserialize into structure.

Trait Implementations

impl Clone for CryptoContext
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for CryptoContext
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations