Struct sshkeys::Certificate

source ·
pub struct Certificate {
Show 15 fields pub key_type: KeyType, pub nonce: Vec<u8>, pub key: PublicKey, pub serial: u64, pub cert_type: CertType, pub key_id: String, pub valid_principals: Vec<String>, pub valid_after: u64, pub valid_before: u64, pub critical_options: HashMap<String, String>, pub extensions: HashMap<String, String>, pub reserved: Vec<u8>, pub signature_key: PublicKey, pub signature: Vec<u8>, pub comment: Option<String>,
}
Expand description

A type which represents an OpenSSH certificate key. Please refer to [PROTOCOL.certkeys] for more details about OpenSSH certificates. [PROTOCOL.certkeys]: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?annotate=HEAD

Fields§

§key_type: KeyType

Type of key.

§nonce: Vec<u8>

Cryptographic nonce.

§key: PublicKey

Public key part of the certificate.

§serial: u64

Serial number of certificate.

§cert_type: CertType

Represents the type of the certificate.

§key_id: String

Key identity.

§valid_principals: Vec<String>

The list of valid principals for the certificate.

§valid_after: u64

Time after which certificate is considered as valid.

§valid_before: u64

Time before which certificate is considered as valid.

§critical_options: HashMap<String, String>

Critical options of the certificate. Generally used to control features which restrict access.

§extensions: HashMap<String, String>

Certificate extensions. Extensions are usually used to enable features that grant access.

§reserved: Vec<u8>

The reserved field is currently unused and is ignored in this version of the protocol.

§signature_key: PublicKey

Signature key contains the CA public key used to sign the certificate.

§signature: Vec<u8>

Signature of the certificate.

§comment: Option<String>

Associated comment, if any.

Implementations§

source§

impl Certificate

source

pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Certificate>

Reads an OpenSSH certificate from a given path.

§Example
let cert = sshkeys::Certificate::from_path("/path/to/id_ed25519-cert.pub")?;
source

pub fn from_string(s: &str) -> Result<Certificate>

Reads an OpenSSH certificate from a given string.

§Example
let cert = sshkeys::Certificate::from_string("ssh-rsa AAAAB3NzaC1yc2EAAAA...")?;

Trait Implementations§

source§

impl Debug for Certificate

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.