Move missing/unimplemented ARD getters from OpenPgpTransaction into ApplicationRelatedData
This commit is contained in:
parent
34b1be073a
commit
c4572de046
2 changed files with 31 additions and 37 deletions
|
@ -34,7 +34,6 @@ pub struct ApplicationRelatedData(pub(crate) Tlv);
|
||||||
impl ApplicationRelatedData {
|
impl ApplicationRelatedData {
|
||||||
/// Get application identifier (AID), ISO 7816-4
|
/// Get application identifier (AID), ISO 7816-4
|
||||||
pub fn application_id(&self) -> Result<ApplicationIdentifier, Error> {
|
pub fn application_id(&self) -> Result<ApplicationIdentifier, Error> {
|
||||||
// get from cached "application related data"
|
|
||||||
let aid = self.0.find(&[0x4f].into());
|
let aid = self.0.find(&[0x4f].into());
|
||||||
|
|
||||||
if let Some(aid) = aid {
|
if let Some(aid) = aid {
|
||||||
|
@ -46,7 +45,6 @@ impl ApplicationRelatedData {
|
||||||
|
|
||||||
/// Get historical bytes
|
/// Get historical bytes
|
||||||
pub fn historical_bytes(&self) -> Result<HistoricalBytes, Error> {
|
pub fn historical_bytes(&self) -> Result<HistoricalBytes, Error> {
|
||||||
// get from cached "application related data"
|
|
||||||
let hist = self.0.find(&[0x5f, 0x52].into());
|
let hist = self.0.find(&[0x5f, 0x52].into());
|
||||||
|
|
||||||
if let Some(hist) = hist {
|
if let Some(hist) = hist {
|
||||||
|
@ -62,7 +60,6 @@ impl ApplicationRelatedData {
|
||||||
/// Get extended length information (ISO 7816-4), which
|
/// Get extended length information (ISO 7816-4), which
|
||||||
/// contains maximum number of bytes for command and response.
|
/// contains maximum number of bytes for command and response.
|
||||||
pub fn extended_length_information(&self) -> Result<Option<ExtendedLengthInfo>, Error> {
|
pub fn extended_length_information(&self) -> Result<Option<ExtendedLengthInfo>, Error> {
|
||||||
// get from cached "application related data"
|
|
||||||
let eli = self.0.find(&[0x7f, 0x66].into());
|
let eli = self.0.find(&[0x7f, 0x66].into());
|
||||||
|
|
||||||
log::trace!("Extended length information: {:x?}", eli);
|
log::trace!("Extended length information: {:x?}", eli);
|
||||||
|
@ -88,7 +85,6 @@ impl ApplicationRelatedData {
|
||||||
|
|
||||||
/// Get extended Capabilities
|
/// Get extended Capabilities
|
||||||
pub fn extended_capabilities(&self) -> Result<ExtendedCapabilities, Error> {
|
pub fn extended_capabilities(&self) -> Result<ExtendedCapabilities, Error> {
|
||||||
// FIXME: caching?
|
|
||||||
let app_id = self.application_id()?;
|
let app_id = self.application_id()?;
|
||||||
let version = app_id.version();
|
let version = app_id.version();
|
||||||
|
|
||||||
|
@ -109,7 +105,6 @@ impl ApplicationRelatedData {
|
||||||
|
|
||||||
/// Get algorithm attributes (for each key type)
|
/// Get algorithm attributes (for each key type)
|
||||||
pub fn algorithm_attributes(&self, key_type: KeyType) -> Result<Algo, Error> {
|
pub fn algorithm_attributes(&self, key_type: KeyType) -> Result<Algo, Error> {
|
||||||
// get from cached "application related data"
|
|
||||||
let aa = self.0.find(&[key_type.algorithm_tag()].into());
|
let aa = self.0.find(&[key_type.algorithm_tag()].into());
|
||||||
|
|
||||||
if let Some(aa) = aa {
|
if let Some(aa) = aa {
|
||||||
|
@ -124,7 +119,6 @@ impl ApplicationRelatedData {
|
||||||
|
|
||||||
/// Get PW status Bytes
|
/// Get PW status Bytes
|
||||||
pub fn pw_status_bytes(&self) -> Result<PWStatusBytes, Error> {
|
pub fn pw_status_bytes(&self) -> Result<PWStatusBytes, Error> {
|
||||||
// get from cached "application related data"
|
|
||||||
let psb = self.0.find(&[0xc4].into());
|
let psb = self.0.find(&[0xc4].into());
|
||||||
|
|
||||||
if let Some(psb) = psb {
|
if let Some(psb) = psb {
|
||||||
|
@ -143,7 +137,6 @@ impl ApplicationRelatedData {
|
||||||
/// Fingerprint, per key type.
|
/// Fingerprint, per key type.
|
||||||
/// Zero bytes indicate a not defined private key.
|
/// Zero bytes indicate a not defined private key.
|
||||||
pub fn fingerprints(&self) -> Result<KeySet<Fingerprint>, Error> {
|
pub fn fingerprints(&self) -> Result<KeySet<Fingerprint>, Error> {
|
||||||
// Get from cached "application related data"
|
|
||||||
let fp = self.0.find(&[0xc5].into());
|
let fp = self.0.find(&[0xc5].into());
|
||||||
|
|
||||||
if let Some(fp) = fp {
|
if let Some(fp) = fp {
|
||||||
|
@ -157,6 +150,12 @@ impl ApplicationRelatedData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
// #[allow(dead_code)]
|
||||||
|
// fn ca_fingerprints() {
|
||||||
|
// unimplemented!()
|
||||||
|
// }
|
||||||
|
|
||||||
/// Generation dates/times of key pairs
|
/// Generation dates/times of key pairs
|
||||||
pub fn key_generation_times(&self) -> Result<KeySet<KeyGenerationTime>, crate::Error> {
|
pub fn key_generation_times(&self) -> Result<KeySet<KeyGenerationTime>, crate::Error> {
|
||||||
let kg = self.0.find(&[0xcd].into());
|
let kg = self.0.find(&[0xcd].into());
|
||||||
|
@ -173,6 +172,31 @@ impl ApplicationRelatedData {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #[allow(dead_code)]
|
||||||
|
// fn key_information() {
|
||||||
|
// unimplemented!()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// #[allow(dead_code)]
|
||||||
|
// fn uif_pso_cds() {
|
||||||
|
// unimplemented!()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// #[allow(dead_code)]
|
||||||
|
// fn uif_pso_dec() {
|
||||||
|
// unimplemented!()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// #[allow(dead_code)]
|
||||||
|
// fn uif_pso_aut() {
|
||||||
|
// unimplemented!()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// #[allow(dead_code)]
|
||||||
|
// fn uif_attestation() {
|
||||||
|
// unimplemented!()
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Security support template (see spec pg. 24)
|
/// Security support template (see spec pg. 24)
|
||||||
|
|
|
@ -85,36 +85,6 @@ impl<'a> OpenPgpTransaction<'a> {
|
||||||
self.tx.application_related_data()
|
self.tx.application_related_data()
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[allow(dead_code)]
|
|
||||||
// fn ca_fingerprints() {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// #[allow(dead_code)]
|
|
||||||
// fn key_information() {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// #[allow(dead_code)]
|
|
||||||
// fn uif_pso_cds() {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// #[allow(dead_code)]
|
|
||||||
// fn uif_pso_dec() {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// #[allow(dead_code)]
|
|
||||||
// fn uif_pso_aut() {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// #[allow(dead_code)]
|
|
||||||
// fn uif_attestation() {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// --- login data (5e) ---
|
// --- login data (5e) ---
|
||||||
|
|
||||||
/// Get URL (5f50)
|
/// Get URL (5f50)
|
||||||
|
|
Loading…
Reference in a new issue