Struct rcgen::KeyPair[][src]

pub struct KeyPair { /* fields omitted */ }

A key pair used to sign certificates and CSRs

Implementations

impl KeyPair[src]

pub fn from_pem(pem_str: &str) -> Result<Self, RcgenError>[src]

Parses the key pair from the ASCII PEM format

impl KeyPair[src]

pub fn generate(alg: &'static SignatureAlgorithm) -> Result<Self, RcgenError>[src]

Generate a new random key pair for the specified signature algorithm

pub fn public_key_raw(&self) -> &[u8][src]

Get the raw public key of this key pair

The key is in raw format, as how ring::signature::KeyPair::public_key would output, and how ring::signature::verify would accept.

pub fn is_compatible(&self, signature_algorithm: &SignatureAlgorithm) -> bool[src]

Check if this key pair can be used with the given signature algorithm

pub fn compatible_algs(
    &self
) -> impl Iterator<Item = &'static SignatureAlgorithm>
[src]

Returns (possibly multiple) compatible SignatureAlgorithm’s that the key can be used with

pub fn public_key_der(&self) -> Vec<u8>[src]

Return the key pair’s public key in DER format

The key is formatted according to the SubjectPublicKeyInfo struct of X.509 see https://tools.ietf.org/html/rfc5280#section-4.1

pub fn public_key_pem(&self) -> String[src]

Return the key pair’s public key in PEM format

The returned string can be interpreted with openssl pkey --inform PEM -pubout -pubin -text

pub fn serialize_der(&self) -> Vec<u8>[src]

Serializes the key pair (including the private key) in PKCS#8 format in DER

pub fn serialize_pem(&self) -> String[src]

Serializes the key pair (including the private key) in PKCS#8 format in PEM

Trait Implementations

impl Debug for KeyPair[src]

impl TryFrom<&'_ [u8]> for KeyPair[src]

type Error = RcgenError

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for KeyPair

impl Send for KeyPair

impl Sync for KeyPair

impl Unpin for KeyPair

impl UnwindSafe for KeyPair

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.