/// Newtype for authenticator type as a bit mask in HardwareAuthToken. /// Four types are defined in hw_auth_token.h: /// 0 for None, and 0xFFFFFFFF for Any. Individual type must be /// powers of 2: 1 for password; 2 for fingerprint. /// In practice, we never see more than 1 type to be set. #[derive(PartialEq, Debug)] pubstruct AuthenticatorType(u32);
impl_export!(AuthenticatorType(self) => SignedHat.authenticatorType as i32 { self.0as i32
});
// This is implemented as the inverse of ExportToAidl. It is not a typical usage of From trait: it // is not lossless and it operates on the borrowed object. impl From<&SignedHat> for AuthenticatorType { fn from(hat: &SignedHat) -> Self { Self(hat.authenticatorType as u32)
}
}
/// Helper to compute the MAC for a given HardwareAuthToken. /// /// The MAC is a 32 bytes HMAC-SHA256 with the auth token signing key over the /// following string /// version || challenge || user_id || authenticator_id || authenticator_type || timestamp /// /// where ``||'' represents concatenation, the leading version is a single /// byte, and all integers are represented as unsigned values, the full width /// of the type. The challenge, userId and authenticatorId values are in /// machine order, but authenticatorType and timestamp are in network order /// (big-endian). This odd construction is compatible with the hw_auth_token_t /// structure. impl HmacSignable for SignedHat { fn update(&self, mut add_bytes: impl FnMut(&[u8]) -> ServiceResult<()>) -> ServiceResult<()> {
add_bytes(&self.version.to_ne_bytes())?;
add_bytes(&self.challenge.to_ne_bytes())?;
add_bytes(&self.userId.to_ne_bytes())?;
add_bytes(&self.authenticatorId.to_ne_bytes())?;
add_bytes(&self.authenticatorType.to_be_bytes())?;
add_bytes(&self.timestamp.to_be_bytes())
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet am 2026-06-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.