Skip to main content

Identity

Struct Identity 

Source
pub struct Identity { /* private fields */ }

Implementations§

Source§

impl Identity

Source

pub fn type_id() -> usize

Source

pub fn import_pkcs12_first(data: &[u8], password: &str) -> Result<Self>

Examples found in repository?
examples/02_identity_pkcs12.rs (line 8)
6fn main() -> Result<(), Box<dyn std::error::Error>> {
7    let identity =
8        Identity::import_pkcs12_first(&support::fixture("test-identity.p12"), "password")?;
9    let certificate = identity.certificate()?;
10    println!(
11        "label={:?} chain_count={} subject={:?}",
12        identity.label()?,
13        identity.chain_count(),
14        certificate.subject_summary()?
15    );
16    Ok(())
17}
Source

pub fn from_certificate_and_private_key( certificate: &Certificate, private_key: &PrivateKey, ) -> Result<Self>

Source

pub fn with_certificate(certificate: &Certificate) -> Result<Self>

Source

pub fn preferred( name: &str, key_usage: &[&str], valid_issuers: &[Vec<u8>], ) -> Result<Option<Self>>

Source

pub fn set_preferred( identity: Option<&Self>, name: &str, key_usage: &[&str], ) -> Result<()>

Source

pub fn copy_system_identity(domain: &str) -> Result<Self>

Source

pub fn set_system_identity(domain: &str, identity: Option<&Self>) -> Result<()>

Source

pub fn actual_domain(&self) -> Result<Option<String>>

Source

pub fn label(&self) -> Result<Option<String>>

Examples found in repository?
examples/02_identity_pkcs12.rs (line 12)
6fn main() -> Result<(), Box<dyn std::error::Error>> {
7    let identity =
8        Identity::import_pkcs12_first(&support::fixture("test-identity.p12"), "password")?;
9    let certificate = identity.certificate()?;
10    println!(
11        "label={:?} chain_count={} subject={:?}",
12        identity.label()?,
13        identity.chain_count(),
14        certificate.subject_summary()?
15    );
16    Ok(())
17}
Source

pub fn chain_count(&self) -> usize

Examples found in repository?
examples/02_identity_pkcs12.rs (line 13)
6fn main() -> Result<(), Box<dyn std::error::Error>> {
7    let identity =
8        Identity::import_pkcs12_first(&support::fixture("test-identity.p12"), "password")?;
9    let certificate = identity.certificate()?;
10    println!(
11        "label={:?} chain_count={} subject={:?}",
12        identity.label()?,
13        identity.chain_count(),
14        certificate.subject_summary()?
15    );
16    Ok(())
17}
Source

pub fn certificate(&self) -> Result<Certificate>

Examples found in repository?
examples/02_identity_pkcs12.rs (line 9)
6fn main() -> Result<(), Box<dyn std::error::Error>> {
7    let identity =
8        Identity::import_pkcs12_first(&support::fixture("test-identity.p12"), "password")?;
9    let certificate = identity.certificate()?;
10    println!(
11        "label={:?} chain_count={} subject={:?}",
12        identity.label()?,
13        identity.chain_count(),
14        certificate.subject_summary()?
15    );
16    Ok(())
17}
Source

pub fn private_key_attributes(&self) -> Result<Value>

Trait Implementations§

Source§

impl Debug for Identity

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.