Rename get_app_data() to get_application_related_data() to correspond with naming in spec.

This commit is contained in:
Heiko Schaefer 2021-09-02 22:09:46 +02:00
parent f5b31aac26
commit 8b5894e961
9 changed files with 22 additions and 20 deletions

View file

@ -101,7 +101,7 @@ impl TestCard {
let mut ca = CardApp::from(card_client);
// Set Card Capabilities (chaining, command length, ..)
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
let app_id = ard.get_application_id()?;
if app_id.ident().as_str() == ident {
@ -120,7 +120,7 @@ impl TestCard {
let mut ca = CardApp::from(card_client);
// Set Card Capabilities (chaining, command length, ..)
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
ca.init_caps(&ard)?;
// println!("opened scdc card {}", serial);

View file

@ -96,7 +96,7 @@ fn check_key_upload_metadata(
ca: &mut CardApp,
meta: &[(String, KeyGenerationTime)],
) -> Result<()> {
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
// check fingerprints
let card_fp = ard.get_fingerprints()?;
@ -140,7 +140,7 @@ pub fn test_print_caps(
ca: &mut CardApp,
_param: &[&str],
) -> Result<TestOutput, TestError> {
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
let aid = ard.get_application_id()?;
println!("aid: {:#x?}", aid);
@ -161,7 +161,7 @@ pub fn test_print_algo_info(
ca: &mut CardApp,
_param: &[&str],
) -> Result<TestOutput, TestError> {
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
let dec = ard.get_algorithm_attributes(KeyType::Decryption)?;
println!("Current algorithm for the decrypt slot: {}", dec);
@ -250,7 +250,7 @@ pub fn test_get_pub(
ca: &mut CardApp,
_param: &[&str],
) -> Result<TestOutput, TestError> {
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
let key_gen = ard.get_key_generation_times()?;
// --
@ -442,7 +442,7 @@ pub fn test_pw_status(
) -> Result<TestOutput, TestError> {
let mut out = vec![];
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
let mut pws = ard.get_pw_status_bytes()?;
println!("pws {:?}", pws);
@ -454,7 +454,7 @@ pub fn test_pw_status(
ca.set_pw_status_bytes(&pws, false)?;
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
let pws = ard.get_pw_status_bytes()?;
println!("pws {:?}", pws);
@ -536,7 +536,7 @@ pub fn run_test(
param: &[&str],
) -> Result<TestOutput, TestError> {
let mut ca = card.get_card_app()?;
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
let _app_id = ard.get_application_id()?;
t(&mut ca, param)

View file

@ -39,7 +39,7 @@ impl<'a> CardDecryptor<'a> {
policy: &dyn Policy,
) -> Result<CardDecryptor<'a>, Error> {
// Get the fingerprint for the decryption key from the card.
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
let fps = ard.get_fingerprints()?;
let fp = fps.decryption();

View file

@ -583,7 +583,7 @@ impl CardBase {
// read and cache "application related data"
let mut card_app = CardApp::from(ccb);
let ard = card_app.get_app_data()?;
let ard = card_app.get_application_related_data()?;
card_app.init_caps(&ard)?;
@ -597,7 +597,7 @@ impl CardBase {
/// This is done once, after opening the OpenPGP card applet
/// (the data is stored in the OpenPGPCard object).
fn get_app_data(&mut self) -> Result<ApplicationRelatedData> {
self.card_app.get_app_data()
self.card_app.get_application_related_data()
}
pub fn get_application_id(&self) -> Result<ApplicationIdentifier, Error> {

View file

@ -242,7 +242,7 @@ fn main() -> Result<(), Box<dyn Error>> {
for c in cards {
let mut ca = CardApp::from(c);
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
let app_id = ard.get_application_id()?;
let ident = app_id.ident();

View file

@ -34,7 +34,7 @@ impl<'a> CardSigner<'a> {
policy: &dyn Policy,
) -> Result<CardSigner<'a>, Error> {
// Get the fingerprint for the signing key from the card.
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
let fps = ard.get_fingerprints()?;
let fp = fps.signature();

View file

@ -105,7 +105,9 @@ impl CardApp {
/// (This data should probably be cached in a higher layer. Some parts of
/// it are needed regularly, and it does not usually change during
/// normal use of a card.)
pub fn get_app_data(&mut self) -> Result<ApplicationRelatedData> {
pub fn get_application_related_data(
&mut self,
) -> Result<ApplicationRelatedData> {
let ad = commands::get_application_data();
let resp = apdu::send_command(&mut self.card_client, ad, true)?;
let value = Value::from(resp.data()?, true)?;
@ -577,7 +579,7 @@ impl CardApp {
algo: &Algo,
) -> Result<Response, Error> {
// FIXME: caching?
let ard = self.get_app_data()?;
let ard = self.get_application_related_data()?;
// FIXME: Only write algo attributes to the card if "extended
// capabilities" show that they are changeable!

View file

@ -46,7 +46,7 @@ pub(crate) fn gen_key_with_metadata(
}
// algo
let ard = card_app.get_app_data()?; // no caching, here!
let ard = card_app.get_application_related_data()?; // no caching, here!
let algo = ard.get_algorithm_attributes(key_type)?;
// generate key
@ -137,7 +137,7 @@ pub(crate) fn get_pub_key(
key_type: KeyType,
) -> Result<PublicKeyMaterial, Error> {
// algo
let ard = card_app.get_app_data()?; // FIXME: caching
let ard = card_app.get_application_related_data()?; // FIXME: caching
let algo = ard.get_algorithm_attributes(key_type)?;
// get public key
@ -181,7 +181,7 @@ pub(crate) fn key_import(
// No -> Get the current algorithm attributes for key_type.
// FIXME: caching?
let ard = card_app.get_app_data()?;
let ard = card_app.get_application_related_data()?;
let algo = ard.get_algorithm_attributes(key_type)?;
// Is the algorithm on the card currently set to RSA?

View file

@ -128,7 +128,7 @@ impl PcscClient {
mut ca: CardApp,
ident: &str,
) -> Result<Option<CardClientBox>, Error> {
let ard = ca.get_app_data()?;
let ard = ca.get_application_related_data()?;
let aid = ard.get_application_id()?;
if aid.ident() == ident {