add unpair apdu

This commit is contained in:
Michele Balistreri 2024-11-11 08:12:45 +09:00
parent f3c6c9b6b6
commit 073a0241cf
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
2 changed files with 13 additions and 0 deletions

View File

@ -84,6 +84,18 @@ app_err_t keycard_cmd_autopair(keycard_t* kc, const uint8_t* psk, pairing_t* pai
return ERR_OK;
}
app_err_t keycard_cmd_unpair(keycard_t* kc, uint8_t idx) {
APDU_RESET(&kc->apdu);
APDU_CLA(&kc->apdu) = 0x80;
APDU_INS(&kc->apdu) = 0x13;
APDU_P1(&kc->apdu) = idx;
APDU_P2(&kc->apdu) = 0;
SC_BUF(data, 0);
return securechannel_send_apdu(&kc->sc, &kc->ch, &kc->apdu, data, 0);
}
app_err_t keycard_cmd_verify_pin(keycard_t* kc, uint8_t* pin) {
APDU_RESET(&kc->apdu);
APDU_CLA(&kc->apdu) = 0x80;

View File

@ -13,6 +13,7 @@ typedef enum {
app_err_t keycard_cmd_select(keycard_t* kc, const uint8_t* aid, uint32_t len);
app_err_t keycard_cmd_pair(keycard_t* kc, uint8_t step, uint8_t* data);
app_err_t keycard_cmd_autopair(keycard_t* kc, const uint8_t* psk, pairing_t* pairing);
app_err_t keycard_cmd_unpair(keycard_t* kc, uint8_t idx);
app_err_t keycard_cmd_verify_pin(keycard_t* kc, uint8_t* pin);
app_err_t keycard_cmd_change_credential(keycard_t* kc, keycard_credentials_t type, uint8_t* credentials, uint8_t len);
app_err_t keycard_cmd_unblock_pin(keycard_t* kc, uint8_t* pin, uint8_t* puk);