Struct const_decoder::Pem

source ·
pub struct Pem;
Expand description

Decoder for the PEM file format (Base64 with additional header / trailer lines).

Examples

// X.25519 private key generated using OpenSSL:
// `openssl genpkey -algorithm X25519`.
const PRIVATE_KEY: [u8; 48] = Pem::decode(
    b"-----BEGIN PRIVATE KEY-----
      MC4CAQAwBQYDK2VuBCIEINAOV4yAyaoM2wmJPApQs3byDhw7oJRG47V0VHwGnctD
      -----END PRIVATE KEY-----",
);

Implementations

Decodes input into a byte array.

Panics
  • Panics if the provided length is insufficient or too large for input.
  • Panics if input contains invalid chars.

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

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.