Rename ApplicationRelatedData::get_aid() to get_application_id()

This commit is contained in:
Heiko Schaefer 2021-08-28 19:58:34 +02:00
parent c25c8b55b8
commit 935c77f59a
5 changed files with 12 additions and 8 deletions

View file

@ -102,7 +102,7 @@ impl TestCard {
// Set Card Capabilities (chaining, command length, ..) // Set Card Capabilities (chaining, command length, ..)
let ard = ca.get_app_data()?; let ard = ca.get_app_data()?;
let app_id = ard.get_aid()?; let app_id = ard.get_application_id()?;
if app_id.ident().as_str() == ident { if app_id.ident().as_str() == ident {
ca.init_caps(&ard)?; ca.init_caps(&ard)?;

View file

@ -601,8 +601,10 @@ impl CardBase {
self.card_app.get_app_data() self.card_app.get_app_data()
} }
pub fn get_aid(&self) -> Result<ApplicationId, OpenpgpCardError> { pub fn get_application_id(
self.ard.get_aid() &self,
) -> Result<ApplicationId, OpenpgpCardError> {
self.ard.get_application_id()
} }
pub fn get_historical(&self) -> Result<Historical, OpenpgpCardError> { pub fn get_historical(&self) -> Result<Historical, OpenpgpCardError> {

View file

@ -48,7 +48,7 @@ fn main() -> Result<(), Box<dyn Error>> {
// card metadata // card metadata
println!("** get aid"); println!("** get aid");
let app_id = oc.get_aid()?; let app_id = oc.get_application_id()?;
println!("app id: {:x?}\n\n", app_id); println!("app id: {:x?}\n\n", app_id);
println!(" ident: {:?}\n\n", app_id.ident()); println!(" ident: {:?}\n\n", app_id.ident());
@ -160,7 +160,7 @@ fn main() -> Result<(), Box<dyn Error>> {
// &test_card_serial, // &test_card_serial,
// )?)?; // )?)?;
let app_id = oc.get_aid()?; let app_id = oc.get_application_id()?;
// Check that we're still using the expected card // Check that we're still using the expected card
assert_eq!(app_id.ident(), test_card_ident); assert_eq!(app_id.ident(), test_card_ident);
@ -243,7 +243,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let mut ca = CardApp::new(c); let mut ca = CardApp::new(c);
let ard = ca.get_app_data()?; let ard = ca.get_app_data()?;
let app_id = ard.get_aid()?; let app_id = ard.get_application_id()?;
let ident = app_id.ident(); let ident = app_id.ident();
println!(" '{}'", ident); println!(" '{}'", ident);

View file

@ -36,7 +36,9 @@ pub struct ApplicationRelatedData(pub(crate) Tlv);
impl ApplicationRelatedData { impl ApplicationRelatedData {
/// Application identifier (AID), ISO 7816-4 /// Application identifier (AID), ISO 7816-4
pub fn get_aid(&self) -> Result<ApplicationId, OpenpgpCardError> { pub fn get_application_id(
&self,
) -> Result<ApplicationId, OpenpgpCardError> {
// get from cached "application related data" // get from cached "application related data"
let aid = self.0.find(&[0x4f].into()); let aid = self.0.find(&[0x4f].into());

View file

@ -130,7 +130,7 @@ impl PcscClient {
ident: &str, ident: &str,
) -> Result<Option<CardClientBox>, OpenpgpCardError> { ) -> Result<Option<CardClientBox>, OpenpgpCardError> {
let ard = ca.get_app_data()?; let ard = ca.get_app_data()?;
let aid = ard.get_aid()?; let aid = ard.get_application_id()?;
if aid.ident() == ident { if aid.ident() == ident {
Ok(Some(ca.take_card())) Ok(Some(ca.take_card()))