Implement next_cardholder_certificate() to read successive cardholder certificates from the card.
This commit is contained in:
parent
abd61d5a15
commit
14143ee182
3 changed files with 24 additions and 0 deletions
|
@ -271,6 +271,14 @@ impl<'a> Open<'a> {
|
|||
self.opt.security_support_template()
|
||||
}
|
||||
|
||||
/// "GET NEXT DATA" for the DO cardholder certificate.
|
||||
///
|
||||
/// Cardholder certificate data for multiple slots can be read from the card by first calling
|
||||
/// cardholder_certificate(), followed by up to two calls to next_cardholder_certificate().
|
||||
pub fn next_cardholder_certificate(&mut self) -> Result<Vec<u8>, Error> {
|
||||
self.opt.next_cardholder_certificate()
|
||||
}
|
||||
|
||||
// DO "Algorithm Information" (0xFA)
|
||||
pub fn algorithm_information(&mut self) -> Result<Option<AlgoInfo>, Error> {
|
||||
// The DO "Algorithm Information" (Tag FA) shall be present if
|
||||
|
|
|
@ -62,6 +62,11 @@ pub(crate) fn cardholder_certificate() -> Command {
|
|||
get_data(Tags::CardholderCertificate)
|
||||
}
|
||||
|
||||
/// GET NEXT DATA for DO "Cardholder certificate"
|
||||
pub(crate) fn get_next_cardholder_certificate() -> Command {
|
||||
Command::new(0x00, 0xCC, 0x7f, 0x21, vec![])
|
||||
}
|
||||
|
||||
/// GET DO "Algorithm Information"
|
||||
pub(crate) fn algo_info() -> Command {
|
||||
get_data(Tags::AlgorithmInformation)
|
||||
|
|
|
@ -149,6 +149,17 @@ impl<'a> OpenPgpTransaction<'a> {
|
|||
apdu::send_command(self.tx(), cmd, true)?.try_into()
|
||||
}
|
||||
|
||||
/// Call "GET NEXT DATA" for the DO cardholder certificate.
|
||||
///
|
||||
/// Cardholder certificate data for multiple slots can be read from the card by first calling
|
||||
/// cardholder_certificate(), followed by up to two calls to next_cardholder_certificate().
|
||||
pub fn next_cardholder_certificate(&mut self) -> Result<Vec<u8>, Error> {
|
||||
log::info!("OpenPgpTransaction: next_cardholder_certificate");
|
||||
|
||||
let cmd = commands::get_next_cardholder_certificate();
|
||||
apdu::send_command(self.tx(), cmd, true)?.try_into()
|
||||
}
|
||||
|
||||
/// Get "Algorithm Information"
|
||||
pub fn algorithm_information(&mut self) -> Result<Option<AlgoInfo>, Error> {
|
||||
log::info!("OpenPgpTransaction: algorithm_information");
|
||||
|
|
Loading…
Reference in a new issue