Struct trust_graph::Certificate[][src]

pub struct Certificate {
    pub chain: Vec<Trust>,
}

Chain of trusts started from self-signed root trust.

Fields

chain: Vec<Trust>

Implementations

impl Certificate[src]

pub fn new_unverified(chain: Vec<Trust>) -> Self[src]

pub fn issue_root(
    root_kp: &KeyPair,
    for_pk: PublicKey,
    expires_at: Duration,
    issued_at: Duration
) -> Self
[src]

Creates new certificate with root trust (self-signed public key) from a key pair.

pub fn issue(
    issued_by: &KeyPair,
    for_pk: PublicKey,
    extend_cert: &Certificate,
    expires_at: Duration,
    issued_at: Duration,
    cur_time: Duration
) -> Result<Self, CertificateError>
[src]

Adds a new trust into chain of trust in certificate.

pub fn verify(
    cert: &Certificate,
    trusted_roots: &[PublicKey],
    cur_time: Duration
) -> Result<(), CertificateError>
[src]

Verifies that a certificate is valid and you trust to this certificate.

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

Convert certificate to byte format 2 format + 4 version + (64 signature + 32 public key + 8 expiration) * number of trusts

pub fn decode(arr: &[u8]) -> Result<Self, CertificateError>[src]

Trait Implementations

impl Clone for Certificate[src]

impl Debug for Certificate[src]

impl Display for Certificate[src]

impl Eq for Certificate[src]

impl FromStr for Certificate[src]

type Err = CertificateError

The associated error which can be returned from parsing.

impl PartialEq<Certificate> for Certificate[src]

impl StructuralEq for Certificate[src]

impl StructuralPartialEq for Certificate[src]

Auto Trait Implementations

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> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,