openpgp-card: rename UIF -> UserInteractionFlag
This commit is contained in:
parent
58facac819
commit
b88caa2471
3 changed files with 20 additions and 20 deletions
|
@ -144,7 +144,7 @@ use openpgp_card::algorithm::{AlgoInfo, AlgoSimple, AlgorithmAttributes};
|
|||
use openpgp_card::card_do::{
|
||||
ApplicationIdentifier, CardholderRelatedData, ExtendedCapabilities, ExtendedLengthInfo,
|
||||
Fingerprint, HistoricalBytes, KeyGenerationTime, KeyInformation, KeySet, Lang, PWStatusBytes,
|
||||
SecuritySupportTemplate, Sex, TouchPolicy, UIF,
|
||||
SecuritySupportTemplate, Sex, TouchPolicy, UserInteractionFlag,
|
||||
};
|
||||
use openpgp_card::crypto_data::PublicKeyMaterial;
|
||||
use openpgp_card::{Error, KeyType};
|
||||
|
@ -492,19 +492,19 @@ impl<'a> Card<Transaction<'a>> {
|
|||
self.state.ard.key_information()
|
||||
}
|
||||
|
||||
pub fn uif_signing(&self) -> Result<Option<UIF>, Error> {
|
||||
pub fn uif_signing(&self) -> Result<Option<UserInteractionFlag>, Error> {
|
||||
self.state.ard.uif_pso_cds()
|
||||
}
|
||||
|
||||
pub fn uif_decryption(&self) -> Result<Option<UIF>, Error> {
|
||||
pub fn uif_decryption(&self) -> Result<Option<UserInteractionFlag>, Error> {
|
||||
self.state.ard.uif_pso_dec()
|
||||
}
|
||||
|
||||
pub fn uif_authentication(&self) -> Result<Option<UIF>, Error> {
|
||||
pub fn uif_authentication(&self) -> Result<Option<UserInteractionFlag>, Error> {
|
||||
self.state.ard.uif_pso_aut()
|
||||
}
|
||||
|
||||
pub fn uif_attestation(&self) -> Result<Option<UIF>, Error> {
|
||||
pub fn uif_attestation(&self) -> Result<Option<UserInteractionFlag>, Error> {
|
||||
self.state.ard.uif_attestation()
|
||||
}
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ impl ApplicationRelatedData {
|
|||
Ok(ki.map(|v| v.serialize().into()))
|
||||
}
|
||||
|
||||
pub fn uif_pso_cds(&self) -> Result<Option<UIF>, Error> {
|
||||
pub fn uif_pso_cds(&self) -> Result<Option<UserInteractionFlag>, Error> {
|
||||
let uif = self.0.find(Tags::UifSig);
|
||||
|
||||
match uif {
|
||||
|
@ -202,7 +202,7 @@ impl ApplicationRelatedData {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn uif_pso_dec(&self) -> Result<Option<UIF>, Error> {
|
||||
pub fn uif_pso_dec(&self) -> Result<Option<UserInteractionFlag>, Error> {
|
||||
let uif = self.0.find(Tags::UifDec);
|
||||
|
||||
match uif {
|
||||
|
@ -211,7 +211,7 @@ impl ApplicationRelatedData {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn uif_pso_aut(&self) -> Result<Option<UIF>, Error> {
|
||||
pub fn uif_pso_aut(&self) -> Result<Option<UserInteractionFlag>, Error> {
|
||||
let uif = self.0.find(Tags::UifAuth);
|
||||
|
||||
match uif {
|
||||
|
@ -265,7 +265,7 @@ impl ApplicationRelatedData {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn uif_attestation(&self) -> Result<Option<UIF>, Error> {
|
||||
pub fn uif_attestation(&self) -> Result<Option<UserInteractionFlag>, Error> {
|
||||
let uif = self.0.find(Tags::UifAttestation);
|
||||
|
||||
match uif {
|
||||
|
@ -310,23 +310,23 @@ impl Display for KeyGenerationTime {
|
|||
}
|
||||
}
|
||||
|
||||
/// User Interaction Flag (UIF) [Spec page 24]
|
||||
/// User Interaction Flag [Spec page 24]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
|
||||
pub struct UIF([u8; 2]);
|
||||
pub struct UserInteractionFlag([u8; 2]);
|
||||
|
||||
impl TryFrom<Vec<u8>> for UIF {
|
||||
impl TryFrom<Vec<u8>> for UserInteractionFlag {
|
||||
type Error = Error;
|
||||
|
||||
fn try_from(v: Vec<u8>) -> Result<Self, Self::Error> {
|
||||
if v.len() == 2 {
|
||||
Ok(UIF(v.try_into().unwrap()))
|
||||
Ok(UserInteractionFlag(v.try_into().unwrap()))
|
||||
} else {
|
||||
Err(Error::ParseError(format!("Can't get UID from {v:x?}")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl UIF {
|
||||
impl UserInteractionFlag {
|
||||
pub fn touch_policy(&self) -> TouchPolicy {
|
||||
self.0[0].into()
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ impl UIF {
|
|||
}
|
||||
}
|
||||
|
||||
impl Display for UIF {
|
||||
impl Display for UserInteractionFlag {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
|
|
|
@ -51,7 +51,7 @@ use crate::apdu::commands;
|
|||
use crate::apdu::response::RawResponse;
|
||||
use crate::card_do::{
|
||||
ApplicationRelatedData, CardholderRelatedData, Fingerprint, KeyGenerationTime, Lang,
|
||||
PWStatusBytes, SecuritySupportTemplate, Sex, UIF,
|
||||
PWStatusBytes, SecuritySupportTemplate, Sex, UserInteractionFlag,
|
||||
};
|
||||
use crate::crypto_data::{CardUploadableKey, Cryptogram, Hash, PublicKeyMaterial};
|
||||
pub use crate::errors::{Error, StatusBytes};
|
||||
|
@ -1113,7 +1113,7 @@ impl<'a> Transaction<'a> {
|
|||
// FIXME: optional DO for PSO:ENC/DEC with AES
|
||||
|
||||
/// Set UIF for PSO:CDS
|
||||
pub fn set_uif_pso_cds(&mut self, uif: &UIF) -> Result<(), Error> {
|
||||
pub fn set_uif_pso_cds(&mut self, uif: &UserInteractionFlag) -> Result<(), Error> {
|
||||
log::info!("OpenPgpTransaction: set_uif_pso_cds");
|
||||
|
||||
let cmd = commands::put_data(Tags::UifSig, uif.as_bytes().to_vec());
|
||||
|
@ -1121,7 +1121,7 @@ impl<'a> Transaction<'a> {
|
|||
}
|
||||
|
||||
/// Set UIF for PSO:DEC
|
||||
pub fn set_uif_pso_dec(&mut self, uif: &UIF) -> Result<(), Error> {
|
||||
pub fn set_uif_pso_dec(&mut self, uif: &UserInteractionFlag) -> Result<(), Error> {
|
||||
log::info!("OpenPgpTransaction: set_uif_pso_dec");
|
||||
|
||||
let cmd = commands::put_data(Tags::UifDec, uif.as_bytes().to_vec());
|
||||
|
@ -1129,7 +1129,7 @@ impl<'a> Transaction<'a> {
|
|||
}
|
||||
|
||||
/// Set UIF for PSO:AUT
|
||||
pub fn set_uif_pso_aut(&mut self, uif: &UIF) -> Result<(), Error> {
|
||||
pub fn set_uif_pso_aut(&mut self, uif: &UserInteractionFlag) -> Result<(), Error> {
|
||||
log::info!("OpenPgpTransaction: set_uif_pso_aut");
|
||||
|
||||
let cmd = commands::put_data(Tags::UifAuth, uif.as_bytes().to_vec());
|
||||
|
@ -1137,7 +1137,7 @@ impl<'a> Transaction<'a> {
|
|||
}
|
||||
|
||||
/// Set UIF for Attestation key
|
||||
pub fn set_uif_attestation(&mut self, uif: &UIF) -> Result<(), Error> {
|
||||
pub fn set_uif_attestation(&mut self, uif: &UserInteractionFlag) -> Result<(), Error> {
|
||||
log::info!("OpenPgpTransaction: set_uif_attestation");
|
||||
|
||||
let cmd = commands::put_data(Tags::UifAttestation, uif.as_bytes().to_vec());
|
||||
|
|
Loading…
Reference in a new issue