diff --git a/openpgp-card/src/apdu/commands.rs b/openpgp-card/src/apdu/commands.rs index 5d662b7..f277a7e 100644 --- a/openpgp-card/src/apdu/commands.rs +++ b/openpgp-card/src/apdu/commands.rs @@ -180,6 +180,11 @@ pub(crate) fn decryption(data: Vec) -> Command { Command::new(0x00, 0x2A, 0x80, 0x86, data) } +/// 7.2.13 PSO: INTERNAL AUTHENTICATE +pub(crate) fn internal_authenticate(data: Vec) -> Command { + Command::new(0x00, 0x88, 0x00, 0x00, data) +} + /// 7.2.14 GENERATE ASYMMETRIC KEY PAIR pub(crate) fn gen_key(data: Vec) -> Command { Command::new(0x00, 0x47, 0x80, 0x00, data) diff --git a/openpgp-card/src/card_app.rs b/openpgp-card/src/card_app.rs index 44d0453..850aa6c 100644 --- a/openpgp-card/src/card_app.rs +++ b/openpgp-card/src/card_app.rs @@ -505,9 +505,23 @@ impl CardApp { &mut self, data: Vec, ) -> Result, Error> { - let dec_cmd = commands::signature(data); + let cds_cmd = commands::signature(data); - let resp = apdu::send_command(&mut self.card_client, dec_cmd, true)?; + let resp = apdu::send_command(&mut self.card_client, cds_cmd, true)?; + + Ok(resp.data().map(|d| d.to_vec())?) + } + + // --- internal authenticate --- + + /// Run signing operation on the smartcard (low level operation) + /// (7.2.13 INTERNAL AUTHENTICATE) + fn internal_authenticate( + &mut self, + data: Vec, + ) -> Result, Error> { + let ia_cmd = commands::internal_authenticate(data); + let resp = apdu::send_command(&mut self.card_client, ia_cmd, true)?; Ok(resp.data().map(|d| d.to_vec())?) }