Add support for the Austrian A-Trust ACOS card
Thanks to Franz Brandl for the patch http://www.opensc-project.org/pipermail/opensc-devel/2008-February/010675.html git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3318 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
91288d4955
commit
a4bad4452e
|
@ -28,9 +28,23 @@
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define ACOS_EMV_A03 "A-TRUST ACOS"
|
||||||
|
#define ACOS_EMV_A05 "A-TRUST ACOS A05"
|
||||||
|
|
||||||
static const char *atrust_acos_atrs[] = {
|
static const char *atrust_acos_atrs[] = {
|
||||||
"3B:BF:11:00:81:31:fe:45:45:50:41",
|
"3B:BF:11:00:81:31:fe:45:45:50:41",
|
||||||
"3B:BF:11:00:81:31:fe:45:4d:43:41",
|
"3B:BF:11:00:81:31:fe:45:4d:43:41",
|
||||||
|
"3B:BF:13:00:81:31:fe:45:45:50:41",
|
||||||
|
"3B:BF:13:00:81:31:fe:45:4d:43:41",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
// sequence and number has to match atr table !
|
||||||
|
static const char *atrust_acos_names[] = {
|
||||||
|
ACOS_EMV_A03,
|
||||||
|
ACOS_EMV_A03,
|
||||||
|
ACOS_EMV_A05,
|
||||||
|
ACOS_EMV_A05,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -72,7 +86,10 @@ static int atrust_acos_match_card(struct sc_card *card)
|
||||||
continue;
|
continue;
|
||||||
if (memcmp(card->atr, defatr, len) != 0)
|
if (memcmp(card->atr, defatr, len) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
match = 1;
|
match = 1;
|
||||||
|
card->name = atrust_acos_names[i];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return match;
|
return match;
|
||||||
|
@ -89,7 +106,6 @@ static int atrust_acos_init(struct sc_card *card)
|
||||||
if (ex_data == NULL)
|
if (ex_data == NULL)
|
||||||
return SC_ERROR_OUT_OF_MEMORY;
|
return SC_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
card->name = "A-TRUST ACOS";
|
|
||||||
card->cla = 0x00;
|
card->cla = 0x00;
|
||||||
card->drv_data = (void *)ex_data;
|
card->drv_data = (void *)ex_data;
|
||||||
|
|
||||||
|
@ -102,7 +118,10 @@ static int atrust_acos_init(struct sc_card *card)
|
||||||
| SC_ALGORITHM_RSA_HASH_RIPEMD160
|
| SC_ALGORITHM_RSA_HASH_RIPEMD160
|
||||||
| SC_ALGORITHM_RSA_HASH_MD5_SHA1;
|
| SC_ALGORITHM_RSA_HASH_MD5_SHA1;
|
||||||
|
|
||||||
_sc_card_add_rsa_alg(card,1536, flags, 0x10001);
|
if (!strcmp(card->name, ACOS_EMV_A05))
|
||||||
|
flags |= SC_ALGORITHM_RSA_HASH_SHA256;
|
||||||
|
|
||||||
|
_sc_card_add_rsa_alg(card, 1536, flags, 0x10001);
|
||||||
|
|
||||||
/* we need read_binary&friends with max 128 bytes per read */
|
/* we need read_binary&friends with max 128 bytes per read */
|
||||||
if (card->max_send_size > 128)
|
if (card->max_send_size > 128)
|
||||||
|
@ -507,7 +526,6 @@ static int atrust_acos_select_file(struct sc_card *card,
|
||||||
SC_FUNC_RETURN(card->ctx, 2, SC_ERROR_INVALID_ARGUMENTS);
|
SC_FUNC_RETURN(card->ctx, 2, SC_ERROR_INVALID_ARGUMENTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** atrust_acos_set_security_env
|
/** atrust_acos_set_security_env
|
||||||
* sets the security enviroment
|
* sets the security enviroment
|
||||||
* \param card pointer to the sc_card object
|
* \param card pointer to the sc_card object
|
||||||
|
@ -725,6 +743,8 @@ static int atrust_acos_compute_signature(struct sc_card *card,
|
||||||
apdu.le = 256;
|
apdu.le = 256;
|
||||||
r = sc_transmit_apdu(card, &apdu);
|
r = sc_transmit_apdu(card, &apdu);
|
||||||
SC_TEST_RET(card->ctx, r, "APDU transmit failed");
|
SC_TEST_RET(card->ctx, r, "APDU transmit failed");
|
||||||
|
if (apdu.sw1 != 0x90 || apdu.sw2 != 0x00)
|
||||||
|
SC_FUNC_RETURN(card->ctx, 4, sc_check_sw(card, apdu.sw1, apdu.sw2));
|
||||||
{
|
{
|
||||||
size_t len = apdu.resplen > outlen ? outlen : apdu.resplen;
|
size_t len = apdu.resplen > outlen ? outlen : apdu.resplen;
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ static int acos_detect_card(sc_pkcs15_card_t *p15card)
|
||||||
sc_card_t *card = p15card->card;
|
sc_card_t *card = p15card->card;
|
||||||
|
|
||||||
/* check if we have the correct card OS */
|
/* check if we have the correct card OS */
|
||||||
if (strcmp(card->name, "A-TRUST ACOS"))
|
if (strncmp(card->name, "A-TRUST ACOS", strlen("A-TRUST ACOS")))
|
||||||
return SC_ERROR_WRONG_CARD;
|
return SC_ERROR_WRONG_CARD;
|
||||||
/* read EF_CIN_CSN file */
|
/* read EF_CIN_CSN file */
|
||||||
sc_format_path("DF71D001", &path);
|
sc_format_path("DF71D001", &path);
|
||||||
|
|
Loading…
Reference in New Issue