pub struct SignService {
pub backend: EcdsaBackend,
pub cert_library: CertificateLibrary,
pub cam_handler: CooperativeAwarenessMessageSecurityHandler,
pub other_handler: CooperativeAwarenessMessageSecurityHandler,
pub unknown_ats: Vec<[u8; 3]>,
pub requested_ats: Vec<[u8; 3]>,
pub trust_list_request: Option<TrustListRequestProvider>,
/* private fields */
}Expand description
Signing service for ETSI TS 103 097-secured messages.
Fields§
§backend: EcdsaBackend§cert_library: CertificateLibrary§cam_handler: CooperativeAwarenessMessageSecurityHandler§other_handler: CooperativeAwarenessMessageSecurityHandlerCertificate timer of the messages other than CAM and DENM (clause 7.1.3): the certificate once per second, the digest otherwise.
unknown_ats: Vec<[u8; 3]>HashedId3 values of unknown ATs to include in inlineP2pcdRequest.
requested_ats: Vec<[u8; 3]>HashedId3 values for which we should embed requestedCertificate.
trust_list_request: Option<TrustListRequestProvider>P2P CRL / CTL request for the next CAM (TS 103 601 clause 5.3.4).
Implementations§
Source§impl SignService
impl SignService
pub fn new(backend: EcdsaBackend, cert_library: CertificateLibrary) -> Self
Sourcepub fn with_clock(self, clock: SignClock) -> Self
pub fn with_clock(self, clock: SignClock) -> Self
Use clock instead of the system time (UTC seconds since the Unix epoch).
Sourcepub fn now_secs(&self) -> f64
pub fn now_secs(&self) -> f64
Current UTC time in seconds (the injected clock, or the system time).
Sourcepub fn now_its_us(&self) -> u64
pub fn now_its_us(&self) -> u64
Current ITS time (TAI) in microseconds, as generationTime (Time64).
Sourcepub fn cam_state(&self) -> &CooperativeAwarenessMessageSecurityHandler
pub fn cam_state(&self) -> &CooperativeAwarenessMessageSecurityHandler
Accessor for CAM security handler (cam_state).
Sourcepub fn cam_state_mut(
&mut self,
) -> &mut CooperativeAwarenessMessageSecurityHandler
pub fn cam_state_mut( &mut self, ) -> &mut CooperativeAwarenessMessageSecurityHandler
Mutable accessor for CAM security handler (cam_state).
Sourcepub fn sign_request(&mut self, request: &SNSignRequest) -> SNSignConfirm
pub fn sign_request(&mut self, request: &SNSignRequest) -> SNSignConfirm
Route to the correct profile based on ITS-AID.
§Panics
When no authorization ticket may sign the message; use
SignService::try_sign_request to handle that case.
Sourcepub fn try_sign_request(
&mut self,
request: &SNSignRequest,
) -> Result<SNSignConfirm, SigningError>
pub fn try_sign_request( &mut self, request: &SNSignRequest, ) -> Result<SNSignConfirm, SigningError>
Route to the correct profile based on ITS-AID; Err when no AT may
sign the message (the message shall then not be sent).
Sourcepub fn get_present_at(&self, its_aid: u64) -> Option<&OwnCertificate>
pub fn get_present_at(&self, its_aid: u64) -> Option<&OwnCertificate>
Find the own certificate that may sign for the given ITS-AID now.
Sourcepub fn get_present_at_for_signging(
&self,
its_aid: u64,
) -> Option<&OwnCertificate>
pub fn get_present_at_for_signging( &self, its_aid: u64, ) -> Option<&OwnCertificate>
Parity alias for Python get_present_at_for_signging.
Sourcepub fn select_at(
&self,
its_aid: u64,
permissions: &[u8],
location: Option<&GenerationLocation>,
) -> Option<&OwnCertificate>
pub fn select_at( &self, its_aid: u64, permissions: &[u8], location: Option<&GenerationLocation>, ) -> Option<&OwnCertificate>
Select the AT to sign with (IEEE Std 1609.2-2016 clause 5.2.3.2.2):
its appPermissions contain the ITS-AID with an SSP granting the
requested permissions, the current time lies in the validity period
of its chain and, when location is given, the position lies in the
region of its chain.
Sourcepub fn get_known_at_for_request(
&self,
hashedid3: &[u8; 3],
) -> Result<AsnCertificate, String>
pub fn get_known_at_for_request( &self, hashedid3: &[u8; 3], ) -> Result<AsnCertificate, String>
Look up a known CA certificate by its HashedId3 for inclusion in requestedCertificate.
pub fn sign_other(&mut self, request: &SNSignRequest) -> SNSignConfirm
Sourcepub fn try_sign_other(
&mut self,
request: &SNSignRequest,
) -> Result<SNSignConfirm, SigningError>
pub fn try_sign_other( &mut self, request: &SNSignRequest, ) -> Result<SNSignConfirm, SigningError>
Messages other than CAM and DENM (TS 103 097 clause 7.1.3, which does not constrain the signer): the certificate once per second, so that receivers can verify them without having heard a CAM, the digest otherwise.
pub fn sign_denm(&self, request: &SNSignRequest) -> SNSignConfirm
pub fn try_sign_denm( &self, request: &SNSignRequest, ) -> Result<SNSignConfirm, SigningError>
pub fn sign_cam(&mut self, request: &SNSignRequest) -> SNSignConfirm
Sourcepub fn sign_cam_at(
&mut self,
request: &SNSignRequest,
timestamp_secs: Option<f64>,
) -> SNSignConfirm
pub fn sign_cam_at( &mut self, request: &SNSignRequest, timestamp_secs: Option<f64>, ) -> SNSignConfirm
Sign a CAM according to ETSI TS 103 097 V2.2.1 §5.2 and §7.1.1, with an optional timestamp in seconds (for deterministic testing).
Sourcepub fn try_sign_cam_at(
&mut self,
request: &SNSignRequest,
timestamp_secs: Option<f64>,
) -> Result<SNSignConfirm, SigningError>
pub fn try_sign_cam_at( &mut self, request: &SNSignRequest, timestamp_secs: Option<f64>, ) -> Result<SNSignConfirm, SigningError>
SignService::sign_cam_at returning Err when no AT may sign.
Sourcepub fn notify_unknown_at(&mut self, hashedid8: &[u8; 8])
pub fn notify_unknown_at(&mut self, hashedid8: &[u8; 8])
Record an unknown AT HashedId3 and force own cert inclusion in next CAM.
Sourcepub fn notify_known_at(&mut self, hashedid8: &[u8; 8])
pub fn notify_known_at(&mut self, hashedid8: &[u8; 8])
An AT was learned (received as certificate signer): stop requesting it.
Sourcepub fn notify_inline_p2pcd_request(&mut self, request_list: &[[u8; 3]])
pub fn notify_inline_p2pcd_request(&mut self, request_list: &[[u8; 3]])
Process a received inlineP2pcdRequest.
Sourcepub fn notify_received_ca_certificate(&mut self, cert: Certificate)
pub fn notify_received_ca_certificate(&mut self, cert: Certificate)
Process a received CA certificate from requestedCertificate.
Sourcepub fn add_own_certificate(&mut self, cert: OwnCertificate)
pub fn add_own_certificate(&mut self, cert: OwnCertificate)
Add an own certificate.
Auto Trait Implementations§
impl Freeze for SignService
impl !RefUnwindSafe for SignService
impl Send for SignService
impl Sync for SignService
impl Unpin for SignService
impl UnsafeUnpin for SignService
impl !UnwindSafe for SignService
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.