Struct galileo_osnma::bitfields::DsmKroot
source · [−]pub struct DsmKroot<'a>(pub &'a [u8]);
Expand description
DSM-KROOT message.
The DSM-KROOT message, as defined in Figure 7 of the OSNMA ICD.
Tuple Fields
0: &'a [u8]
Reference to a slice containing the DSM-KROOT message data.
Panics
This slice should be long enough to contain the full DSM-KROOT
message. Otherwise the methods of DsmKroot
may panic.
Implementations
sourceimpl<'a> DsmKroot<'a>
impl<'a> DsmKroot<'a>
sourcepub fn number_of_blocks(&self) -> Option<usize>
pub fn number_of_blocks(&self) -> Option<usize>
Gives the number of DSM-KROOT blocks.
The number is computed according to the value of the NB_DK field and Table 7 in the OSNMA ICD.
If the NB_DK field contains a reserved value, None
is returned.
sourcepub fn public_key_id(&self) -> u8
pub fn public_key_id(&self) -> u8
Gives the value of the PKID (public key ID) field.
sourcepub fn kroot_chain_id(&self) -> u8
pub fn kroot_chain_id(&self) -> u8
Gives the value of the CIDKR (KROOT chain ID) field.
sourcepub fn hash_function(&self) -> HashFunction
pub fn hash_function(&self) -> HashFunction
Gives the value of the hash function field.
sourcepub fn mac_function(&self) -> MacFunction
pub fn mac_function(&self) -> MacFunction
Gives the value of the MAC function field.
sourcepub fn key_size(&self) -> Option<usize>
pub fn key_size(&self) -> Option<usize>
Gives the TESLA key size in bits.
The size is computed according to the value of the KS field and Table 10 in the OSNMA ICD.
If the KS field contains a reserved value, None
is returned.
sourcepub fn tag_size(&self) -> Option<usize>
pub fn tag_size(&self) -> Option<usize>
Gives the MAC tag size in bits.
The size is computed according to the value of the TS field and Table 11 in the OSNMA ICD.
If the TS field contains a reserved value, None
is returned.
sourcepub fn mac_lookup_table(&self) -> u8
pub fn mac_lookup_table(&self) -> u8
Gives the value of the MACLT (MAC look-up table) field.
sourcepub fn kroot_towh(&self) -> Towh
pub fn kroot_towh(&self) -> Towh
Gives the KROOT time of week in hours.
This is the value of the TOWHK field.
sourcepub fn alpha(&self) -> u64
pub fn alpha(&self) -> u64
Gives the value of the random pattern alpha.
The random pattern alpha is a 48-bit value. Here it is given in a u64
.
sourcepub fn kroot(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn kroot(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Returns a slice reference to the KROOT in the DSM-KROOT message.
This is the contents of the KROOT field. The length of the returned slice depends on the TESLA key size.
Panics
Panics if the key size field in the DSM-KROOT message contains a reserved value.
sourcepub fn ecdsa_function(&self) -> EcdsaFunction
pub fn ecdsa_function(&self) -> EcdsaFunction
Returns the ECDSA function used by this DSM-KROOT message.
The ECDSA function is guessed from the size of the ECDSA signature in the message.
Panics
Panics if the ECDSA function cannot be guessed because the size of the signature is neither 512 bits (for P-256) nor 1056 bits (for P-521).
sourcepub fn digital_signature(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn digital_signature(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Returns a slice reference to the ECDSA signature in the DSM-KROOT message.
This is the contents of the digital signature (DS) field. The length of the returned slice depend on the ECDSA function in use.
Panics
Panics if the ECDSA function cannot be guessed because the size of the signature is neither 512 bits (for P-256) nor 1056 bits (for P-521).
sourcepub fn padding(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn padding(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Gives the contents of the DSM-KROOT padding (P_DK) field.
sourcepub fn check_padding(&self, nma_header: NmaHeader<'_>) -> bool
pub fn check_padding(&self, nma_header: NmaHeader<'_>) -> bool
Checks the contents of the padding field.
The contents are checked according to Eq. 7 in the OSNMA ICD.
If the contents are correct, this returns true
. Otherwise, this
returns false
.
sourcepub fn check_signature(
&self,
nma_header: NmaHeader<'_>,
pubkey: &VerifyingKey
) -> bool
pub fn check_signature(
&self,
nma_header: NmaHeader<'_>,
pubkey: &VerifyingKey
) -> bool
Trait Implementations
sourceimpl<'a> PartialEq<DsmKroot<'a>> for DsmKroot<'a>
impl<'a> PartialEq<DsmKroot<'a>> for DsmKroot<'a>
impl<'a> Copy for DsmKroot<'a>
impl<'a> Eq for DsmKroot<'a>
impl<'a> StructuralEq for DsmKroot<'a>
impl<'a> StructuralPartialEq for DsmKroot<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for DsmKroot<'a>
impl<'a> Send for DsmKroot<'a>
impl<'a> Sync for DsmKroot<'a>
impl<'a> Unpin for DsmKroot<'a>
impl<'a> UnwindSafe for DsmKroot<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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,
Causes self
to use its Binary
implementation when Debug
-formatted. Read more
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes self
to use its Display
implementation when
Debug
-formatted. Read more
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes self
to use its LowerExp
implementation when
Debug
-formatted. Read more
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes self
to use its LowerHex
implementation when
Debug
-formatted. Read more
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes self
to use its Octal
implementation when Debug
-formatted. Read more
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes self
to use its Pointer
implementation when
Debug
-formatted. Read more
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes self
to use its UpperExp
implementation when
Debug
-formatted. Read more
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes self
to use its UpperHex
implementation when
Debug
-formatted. Read more
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
Formats each item in a sequence. 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) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
Pipes by value. This is generally the method you want to use. Read more
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,
Borrows 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,
Mutably borrows 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) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.borrow()
into the pipe function. Read more
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
Mutably borrows self
, then passes self.borrow_mut()
into the pipe
function. Read more
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Borrows 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) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
Mutably borrows self
, then passes self.as_mut()
into the pipe
function. Read more
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
Borrows 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)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Immutable access to the Borrow<B>
of a value. Read more
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the BorrowMut<B>
of a value. Read more
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
Immutable access to the AsRef<R>
view of a value. Read more
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
Mutable access to the AsMut<R>
view of a value. Read more
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Immutable access to the Deref::Target
of a value. Read more
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Mutable access to the 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
Calls .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
Calls .tap_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Calls .tap_borrow()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
Calls .tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
Calls .tap_ref()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
Calls .tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more