openpgp-card-sequoia: add set_user_pin_signing_validity()

This commit is contained in:
Heiko Schaefer 2023-09-05 17:45:20 +02:00
parent 468402364a
commit 290ca2acd0
No known key found for this signature in database
GPG key ID: 4A849A1904CCBD7D

View file

@ -1104,6 +1104,19 @@ impl Card<Admin<'_, '_>> {
self.card().set_pw_status_bytes(pw_status, long) self.card().set_pw_status_bytes(pw_status, long)
} }
/// Configure the "only valid for one PSO:CDS" setting in PW Status Bytes.
///
/// If `once` is `true`, the User PIN must be verified before each
/// signing operation on the card.
/// If `once` is `false`, one User PIN verification is good for an
/// unlimited number of signing operations.
pub fn set_user_pin_signing_validity(&mut self, once: bool) -> Result<(), Error> {
let mut pws = self.as_transaction().pw_status_bytes()?;
pws.set_pw1_cds_valid_once(once);
self.set_pw_status_bytes(&pws, false)
}
/// Set the touch policy for a key slot (if the card supports this /// Set the touch policy for a key slot (if the card supports this
/// feature). /// feature).
/// ///