pub struct PkiEnvironment { /* private fields */ }Expand description
The PKI environment which can be initialized independently from a CoreCrypto session.
Implementations§
Source§impl PkiEnvironment
impl PkiEnvironment
Source§impl PkiEnvironment
impl PkiEnvironment
Sourcepub async fn new(
hooks: Arc<dyn PkiEnvironmentHooks>,
database: Database,
) -> Result<PkiEnvironment>
pub async fn new( hooks: Arc<dyn PkiEnvironmentHooks>, database: Database, ) -> Result<PkiEnvironment>
Create a new PKI Environment
Sourcepub async fn get_trust_anchors(&self) -> Vec<Certificate> ⓘ
pub async fn get_trust_anchors(&self) -> Vec<Certificate> ⓘ
Return certificates that are used as trust anchors.
Sourcepub fn hooks(&self) -> Arc<dyn PkiEnvironmentHooks>
pub fn hooks(&self) -> Arc<dyn PkiEnvironmentHooks>
Get the hooks.
Sourcepub async fn add_trust_anchor(&self, cert: Certificate) -> Result<()>
pub async fn add_trust_anchor(&self, cert: Certificate) -> Result<()>
Adds the certificate as a trust anchor to the PKI environment.
The certificate is saved to the database, and included in the PKI environment for future validation.
§Caution
Adding a trust anchor will replace any existing trust anchor. This limitation will be relaxed in the future.
Sourcepub async fn add_intermediate_cert(&self, cert: Certificate) -> Result<()>
pub async fn add_intermediate_cert(&self, cert: Certificate) -> Result<()>
Adds the certificate to the PKI environment.
The certificate is saved to the database, and included in the PKI environment for future validation.
CRL (Certificate Revocation List) distribution points are extracted from the certificate and an attempt is made to fetch a CRL from each one.
Sourcepub async fn validate_cert(
&self,
cert: &Certificate,
) -> RustyX509CheckResult<()>
pub async fn validate_cert( &self, cert: &Certificate, ) -> RustyX509CheckResult<()>
Validate an end-entity X509 certificate.
Performs validation of the provided certificate in the context defined by the set of trust anchors and intermediate certificates contained in this PKI environment. Revocation check is performed and time of interest is set to the time of the call.
Sourcepub async fn validate_credential<'a>(
&'a self,
credential: CredentialRef<'a>,
) -> CredentialAuthenticationStatus
pub async fn validate_credential<'a>( &'a self, credential: CredentialRef<'a>, ) -> CredentialAuthenticationStatus
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PkiEnvironment
impl !RefUnwindSafe for PkiEnvironment
impl Send for PkiEnvironment
impl Sync for PkiEnvironment
impl Unpin for PkiEnvironment
impl UnsafeUnpin for PkiEnvironment
impl !UnwindSafe for PkiEnvironment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more