Struct safe_crypto::SharedSecretKey[][src]

pub struct SharedSecretKey { /* fields omitted */ }

Precomputed shared secret key. Can be created from a pair of our secret key and the recipient's public key. As a result, we'll get the same key as the recipient with their secret key and our public key.

Methods

impl SharedSecretKey
[src]

Encrypts bytestring plaintext using authenticated encryption.

With authenticated encryption the recipient will be able to verify the authenticity of the sender using a sender's public key. If you want to use anonymous encryption, use the functions provided by PublicId and SecretId.

Returns ciphertext in case of success. Can return an EncryptionError in case of a serialisation error.

Encrypts serialisable plaintext using authenticated encryption.

With authenticated encryption the recipient will be able to verify the authenticity of the sender using a sender's public key. If you wish to encrypt bytestring plaintext, use encrypt_bytes. If you want to use anonymous encryption, use the functions provided by PublicId and SecretId.

Returns ciphertext in case of success. Can return an EncryptionError in case of a serialisation error.

Decrypts bytestring encoded encrypted using authenticated encryption.

With authenticated encryption we will be able to verify the authenticity of the sender using a sender's public key.

Returns plaintext in case of success. Can return EncryptionError in case of a deserialisation error, if the ciphertext is not valid, or if it can not be decrypted.

Decrypts serialised ciphertext encrypted using authenticated encryption.

With authenticated encryption we will be able to verify the authenticity of the sender using a sender's public key.

Returns deserialised type T in case of success. Can return EncryptionError in case of a deserialisation error, if the ciphertext is not valid, or if it can not be decrypted.

Trait Implementations

impl Debug for SharedSecretKey
[src]

Formats the value using the given formatter. Read more

impl PartialEq for SharedSecretKey
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for SharedSecretKey
[src]

impl Clone for SharedSecretKey
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations