diff --git a/lib/ykpiv.c b/lib/ykpiv.c index d588e19..7aa8b3b 100644 --- a/lib/ykpiv.c +++ b/lib/ykpiv.c @@ -307,9 +307,9 @@ ykpiv_rc ykpiv_authenticate(ykpiv_state *state, unsigned const char *key) { recv_len = 0xff; memset(apdu.raw, 0, sizeof(apdu)); - apdu.st.ins = 0x87; - apdu.st.p1 = 0x03; /* triple des */ - apdu.st.p2 = 0x9b; /* management key */ + apdu.st.ins = YKPIV_INS_AUTHENTICATE; + apdu.st.p1 = YKPIV_ALGO_3DES; /* triple des */ + apdu.st.p2 = YKPIV_KEY_CARDMGM; /* management key */ *dataptr++ = 0x7c; *dataptr++ = 20; /* 2 + 8 + 2 +8 */ *dataptr++ = 0x80; diff --git a/lib/ykpiv.h b/lib/ykpiv.h index 662cb6d..01d1136 100644 --- a/lib/ykpiv.h +++ b/lib/ykpiv.h @@ -62,6 +62,19 @@ extern "C" unsigned char *data, unsigned long *recv_len, int *sw); ykpiv_rc ykpiv_authenticate(ykpiv_state *state, const unsigned char *key); +#define YKPIV_ALGO_3DES 0x03; +#define YKPIV_ALGO_RSA1024 0x06; +#define YKPIV_ALGO_RSA2048 0x07; +#define YKPIV_ALGO_ECCP256 0x11; + +#define YKPIV_KEY_AUTHENTICATION 0x9a; +#define YKPIV_KEY_CARDMGM 0x9b; +#define YKPIV_KEY_SIGNATURE 0x9c; +#define YKPIV_KEY_KEYMGM 0x9d; +#define YKPIV_KEY_CARDAUTH 0x9e; + +#define YKPIV_INS_AUTHENTICATE 0x87; + #ifdef __cplusplus } #endif