openpgp-card: add terminate_df(), activate_file() to OpenPgpTransaction

This commit is contained in:
Heiko Schaefer 2023-08-26 19:28:23 +02:00
parent 9c41ab2286
commit 61175dd646
No known key found for this signature in database
GPG key ID: 4A849A1904CCBD7D

View file

@ -164,6 +164,26 @@ impl<'a> OpenPgpTransaction<'a> {
.try_into() .try_into()
} }
// TERMINATE DF
/// 7.2.16 TERMINATE DF
pub fn terminate_df(&mut self) -> Result<(), Error> {
log::info!("OpenPgpTransaction: terminate_df");
self.send_command(commands::terminate_df(), false)?;
Ok(())
}
// ACTIVATE FILE
/// 7.2.17 ACTIVATE FILE
pub fn activate_file(&mut self) -> Result<(), Error> {
log::info!("OpenPgpTransaction: activate_file");
self.send_command(commands::activate_file(), false)?;
Ok(())
}
// --- pinpad --- // --- pinpad ---
/// Does the reader support FEATURE_VERIFY_PIN_DIRECT? /// Does the reader support FEATURE_VERIFY_PIN_DIRECT?
@ -463,17 +483,8 @@ impl<'a> OpenPgpTransaction<'a> {
} }
} }
// terminate_df [apdu 00 e6 00 00] self.terminate_df()?;
log::info!(" terminate_df"); self.activate_file()?;
let term = commands::terminate_df();
let resp = self.send_command(term, false)?;
resp.check_ok()?;
// activate_file [apdu 00 44 00 00]
log::info!(" activate_file");
let act = commands::activate_file();
let resp = self.send_command(act, false)?;
resp.check_ok()?;
Ok(()) Ok(())
} }