logo
pub struct KeypairBytes {
    pub secret_key: [u8; 32],
    pub public_key: Option<[u8; 32]>,
}
Available on crate feature pkcs8 only.
Expand description

Ed25519 keypair serialized as bytes.

This type is primarily useful for decoding/encoding PKCS#8 private key files (either DER or PEM) encoded using the following traits:

PKCS#8 private key files encoded with PEM begin with:

-----BEGIN PRIVATE KEY-----

Note that this type operates on raw bytes and performs no validation that keys represent valid Ed25519 field elements.

Fields

secret_key: [u8; 32]

Ed25519 secret key.

Little endian serialization of an element of the Curve25519 scalar field, prior to “clamping” (i.e. setting/clearing bits to ensure the scalar is actually a valid field element)

public_key: Option<[u8; 32]>

Ed25519 public key (if available).

Compressed Edwards-y encoded curve point.

Implementations

Parse raw keypair from a 64-byte input.

Serialize as a 64-byte keypair.

Returns
  • Some(bytes) if the public_key is present.
  • None if the public_key is absent (i.e. None).

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize PKCS#8 private key from ASN.1 DER-encoded data (binary format). Read more

Deserialize PKCS#8-encoded private key from PEM. Read more

Executes the destructor for this type. Read more

Serialize a [SecretDocument] containing a PKCS#8-encoded private key.

Serialize this private key as PEM-encoded PKCS#8 with the given LineEnding.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. 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.

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.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.