Struct wireguard_control::backends::userspace::Key[][src]

pub struct Key(_);
Expand description

Represents a WireGuard encryption key.

WireGuard makes no meaningful distinction between public, private and preshared keys - any sequence of 32 bytes can be used as either of those.

This means that you need to be careful when working with Keys, especially ones created from external data.

Implementations

Generates and returns a new private key.

Generates and returns a new preshared key.

Generates a public key for this private key.

Generates an all-zero key.

Converts the key to a standardized base64 representation, as used by the wg utility and wg-quick.

Converts a base64 representation of the key to the raw bytes.

This can fail, as not all text input is valid base64 - in this case Err(InvalidKey) is returned.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.