Struct safe_crypto::PublicEncryptKey[][src]

pub struct PublicEncryptKey { /* fields omitted */ }

The public key used encrypt data that can only be decrypted by the corresponding secret key, which is represented by SecretEncryptKey. Use gen_encrypt_keypair() to generate a public and secret key pair.

Methods

impl PublicEncryptKey
[src]

Construct public key from bytes. Useful when it was serialised before.

Convert the PublicEncryptKey into the raw underlying bytes. For anyone who wants to store the public key.

Encrypts serialisable plaintext using anonymous encryption.

Anonymous encryption will use an ephemeral public key, so the recipient won't be able to tell who sent the ciphertext. If you wish to encrypt bytestring plaintext, use anonymously_encrypt_bytes. To use authenticated encryption, use SharedSecretKey.

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

Encrypts bytestring plaintext using anonymous encryption.

Anonymous encryption will use an ephemeral public key, so the recipient won't be able to tell who sent the ciphertext. To use authenticated encryption, use SharedSecretKey.

Returns ciphertext in case of success.

Trait Implementations

impl Debug for PublicEncryptKey
[src]

Formats the value using the given formatter. Read more

impl Hash for PublicEncryptKey
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl PartialEq for PublicEncryptKey
[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 PublicEncryptKey
[src]

impl PartialOrd for PublicEncryptKey
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for PublicEncryptKey
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl Clone for PublicEncryptKey
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for PublicEncryptKey
[src]

impl Display for PublicEncryptKey
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations