pub struct CertificateLibrary {
pub own_certificates: HashMap<[u8; 8], OwnCertificate>,
pub known_authorization_tickets: HashMap<[u8; 8], Certificate>,
pub known_authorization_authorities: HashMap<[u8; 8], Certificate>,
pub known_root_certificates: HashMap<[u8; 8], Certificate>,
pub revoked: HashSet<[u8; 8]>,
}Expand description
Certificate library holding all trusted and own certificates.
Fields§
§own_certificates: HashMap<[u8; 8], OwnCertificate>§known_root_certificates: HashMap<[u8; 8], Certificate>§revoked: HashSet<[u8; 8]>HashedId8 of revoked CA certificates (CRL, ETSI TS 102 941 clause 6.3.6).
Implementations§
Source§impl CertificateLibrary
impl CertificateLibrary
Sourcepub fn new(
backend: &EcdsaBackend,
root_certificates: Vec<Certificate>,
aa_certificates: Vec<Certificate>,
at_certificates: Vec<Certificate>,
) -> Self
pub fn new( backend: &EcdsaBackend, root_certificates: Vec<Certificate>, aa_certificates: Vec<Certificate>, at_certificates: Vec<Certificate>, ) -> Self
Create and populate a library with initial root, AA and AT certificates.
Sourcepub fn get_issuer_certificate(&self, cert: &Certificate) -> Option<&Certificate>
pub fn get_issuer_certificate(&self, cert: &Certificate) -> Option<&Certificate>
Look up the issuer certificate (root or AA) by the HashedId8 stored
inside cert’s issuer field.
Sourcepub fn add_root_certificate(
&mut self,
backend: &EcdsaBackend,
cert: Certificate,
)
pub fn add_root_certificate( &mut self, backend: &EcdsaBackend, cert: Certificate, )
Add a root CA certificate if it verifies (self-signed).
Add an authorization authority certificate if its issuer is known and it verifies.
Add an authorization ticket if its issuer is known and it verifies.
Sourcepub fn learn_ca_certificate(
&mut self,
backend: &EcdsaBackend,
cert: Certificate,
) -> bool
pub fn learn_ca_certificate( &mut self, backend: &EcdsaBackend, cert: Certificate, ) -> bool
Add an own certificate if its issuer is known and it verifies. Add a CA certificate received from a peer (P2PCD, IEEE 1609.2 clause 8.2.4) when its issuer is a known root and its signature verifies; returns true when it is (now) known.
Sourcepub fn remove_certificate(&mut self, h: &[u8; 8])
pub fn remove_certificate(&mut self, h: &[u8; 8])
Forget a root or AA certificate (e.g. deleted from a CTL) and every certificate issued under it.
Sourcepub fn revoke(&mut self, revoked: &HashSet<[u8; 8]>)
pub fn revoke(&mut self, revoked: &HashSet<[u8; 8]>)
Apply a CRL: the CA certificates revoked are revoked permanently (ETSI
TS 102 941 V2.2.1 clause 6.3.3); they and every certificate issued under
them are no longer trusted, and they cannot be re-added.
pub fn add_own_certificate( &mut self, backend: &EcdsaBackend, cert: OwnCertificate, )
Retrieve an AT by HashedId8.
Sourcepub fn verify_sequence_of_certificates(
&mut self,
certs: &[Certificate],
backend: &EcdsaBackend,
) -> Option<Certificate>
pub fn verify_sequence_of_certificates( &mut self, certs: &[Certificate], backend: &EcdsaBackend, ) -> Option<Certificate>
Verify a sequence of certificates as specified in IEEE 1609.2 signer identifier. The first entry is the AT, subsequent entries form the issuer chain up to a trusted root.
Sourcepub fn get_ca_certificate_by_hashedid3(
&self,
h3: &[u8; 3],
) -> Option<&Certificate>
pub fn get_ca_certificate_by_hashedid3( &self, h3: &[u8; 3], ) -> Option<&Certificate>
Look up an AA or Root CA certificate by HashedId3 (last 3 bytes of HashedId8).
Auto Trait Implementations§
impl Freeze for CertificateLibrary
impl RefUnwindSafe for CertificateLibrary
impl Send for CertificateLibrary
impl Sync for CertificateLibrary
impl Unpin for CertificateLibrary
impl UnsafeUnpin for CertificateLibrary
impl UnwindSafe for CertificateLibrary
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
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
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§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.