implement internal_authenticate
This commit is contained in:
parent
0aaef211a0
commit
52a146fd56
2 changed files with 21 additions and 2 deletions
|
@ -180,6 +180,11 @@ pub(crate) fn decryption(data: Vec<u8>) -> Command {
|
||||||
Command::new(0x00, 0x2A, 0x80, 0x86, data)
|
Command::new(0x00, 0x2A, 0x80, 0x86, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 7.2.13 PSO: INTERNAL AUTHENTICATE
|
||||||
|
pub(crate) fn internal_authenticate(data: Vec<u8>) -> Command {
|
||||||
|
Command::new(0x00, 0x88, 0x00, 0x00, data)
|
||||||
|
}
|
||||||
|
|
||||||
/// 7.2.14 GENERATE ASYMMETRIC KEY PAIR
|
/// 7.2.14 GENERATE ASYMMETRIC KEY PAIR
|
||||||
pub(crate) fn gen_key(data: Vec<u8>) -> Command {
|
pub(crate) fn gen_key(data: Vec<u8>) -> Command {
|
||||||
Command::new(0x00, 0x47, 0x80, 0x00, data)
|
Command::new(0x00, 0x47, 0x80, 0x00, data)
|
||||||
|
|
|
@ -505,9 +505,23 @@ impl CardApp {
|
||||||
&mut self,
|
&mut self,
|
||||||
data: Vec<u8>,
|
data: Vec<u8>,
|
||||||
) -> Result<Vec<u8>, Error> {
|
) -> Result<Vec<u8>, 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<u8>,
|
||||||
|
) -> Result<Vec<u8>, 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())?)
|
Ok(resp.data().map(|d| d.to_vec())?)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue