Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FinnishEid: fix the symbolic names for FINeID v2 cards with 2048 keys…

… and restore compatibility with v2 cards with 1024 keys.

The more proper name for the 2048bit cards could be "v2.5".

Thanks to jem@iki.fi, kivinen@iki.fi and tuju@iki.fi for the patch.
  • Loading branch information...
commit 27572537ce8de2b5627eb669607abee15338504c 1 parent 6e70c09
@martinpaljak martinpaljak authored
Showing with 8 additions and 20 deletions.
  1. +7 −19 src/libopensc/card-setcos.c
  2. +1 −1  src/libopensc/cards.h
View
26 src/libopensc/card-setcos.c
@@ -48,8 +48,8 @@ static struct sc_atr_table setcos_atrs[] = {
/* FINEID 2264 (EIDApplet/7816-15, OPK/EMV/AVANT) */
{ "3b:6e:00:00:00:62:00:00:57:41:56:41:4e:54:10:81:90:00", NULL, NULL, SC_CARD_TYPE_SETCOS_FINEID_V2, 0, NULL },
{ "3b:7b:94:00:00:80:62:11:51:56:46:69:6e:45:49:44", NULL, NULL, SC_CARD_TYPE_SETCOS_FINEID_V2, 0, NULL },
- /* New FINEID cards released after 1.3.2011 with 2048 bit keys. */
- { "3b:7b:94:00:00:80:62:12:51:56:46:69:6e:45:49:44", NULL, NULL, SC_CARD_TYPE_SETCOS_FINEID_S2, 0, NULL },
+ /* FINEID cards 1.3.2011 with Samsung chips (round connector) that supports 2048 bit keys. */
+ { "3b:7b:94:00:00:80:62:12:51:56:46:69:6e:45:49:44", NULL, NULL, SC_CARD_TYPE_SETCOS_FINEID_V2_2048, 0, NULL },
/* Swedish NIDEL card */
{ "3b:9f:94:80:1f:c3:00:68:10:44:05:01:46:49:53:45:31:c8:07:90:00:18", NULL, NULL, SC_CARD_TYPE_SETCOS_NIDEL, 0, NULL },
/* Setcos 4.4.1 */
@@ -103,7 +103,7 @@ static int setcos_match_card(sc_card_t *card)
if (i < 0) {
/* Unknown card, but has the FinEID application for sure */
if (match_hist_bytes(card, "FinEID", 0)) {
- card->type = SC_CARD_TYPE_SETCOS_FINEID_V2;
+ card->type = SC_CARD_TYPE_SETCOS_FINEID_V2_2048;
return 1;
}
if (match_hist_bytes(card, "FISE", 0)) {
@@ -164,8 +164,7 @@ static int setcos_init(sc_card_t *card)
switch (card->type) {
case SC_CARD_TYPE_SETCOS_FINEID:
- case SC_CARD_TYPE_SETCOS_FINEID_V2:
- case SC_CARD_TYPE_SETCOS_FINEID_S2:
+ case SC_CARD_TYPE_SETCOS_FINEID_V2_2048:
case SC_CARD_TYPE_SETCOS_NIDEL:
card->cla = 0x00;
select_pkcs15_app(card);
@@ -190,8 +189,7 @@ static int setcos_init(sc_card_t *card)
switch (card->type) {
case SC_CARD_TYPE_SETCOS_PKI:
- case SC_CARD_TYPE_SETCOS_FINEID:
- case SC_CARD_TYPE_SETCOS_FINEID_V2:
+ case SC_CARD_TYPE_SETCOS_FINEID_V2_2048:
{
unsigned long flags;
@@ -199,15 +197,6 @@ static int setcos_init(sc_card_t *card)
flags |= SC_ALGORITHM_RSA_HASH_NONE | SC_ALGORITHM_RSA_HASH_SHA1;
_sc_card_add_rsa_alg(card, 1024, flags, 0);
- }
- break;
- case SC_CARD_TYPE_SETCOS_FINEID_S2:
- {
- unsigned long flags;
-
- flags = SC_ALGORITHM_RSA_RAW | SC_ALGORITHM_RSA_PAD_PKCS1;
- flags |= SC_ALGORITHM_RSA_HASH_NONE | SC_ALGORITHM_RSA_HASH_SHA1;
-
_sc_card_add_rsa_alg(card, 2048, flags, 0);
}
break;
@@ -603,7 +592,7 @@ static int setcos_set_security_env2(sc_card_t *card,
case SC_SEC_OPERATION_SIGN:
/* Should be 0x41 */
apdu.p1 = ((card->type == SC_CARD_TYPE_SETCOS_FINEID_V2) ||
- (card->type == SC_CARD_TYPE_SETCOS_FINEID_S2) ||
+ (card->type == SC_CARD_TYPE_SETCOS_FINEID_V2_2048) ||
(card->type == SC_CARD_TYPE_SETCOS_44) ||
(card->type == SC_CARD_TYPE_SETCOS_NIDEL) ||
SETCOS_IS_EID_APPLET(card)) ? 0x41 : 0x81;
@@ -687,8 +676,7 @@ static int setcos_set_security_env(sc_card_t *card,
switch (card->type) {
case SC_CARD_TYPE_SETCOS_PKI:
case SC_CARD_TYPE_SETCOS_FINEID:
- case SC_CARD_TYPE_SETCOS_FINEID_V2:
- case SC_CARD_TYPE_SETCOS_FINEID_S2:
+ case SC_CARD_TYPE_SETCOS_FINEID_V2_2048:
case SC_CARD_TYPE_SETCOS_NIDEL:
case SC_CARD_TYPE_SETCOS_44:
case SC_CARD_TYPE_SETCOS_EID_V2_0:
View
2  src/libopensc/cards.h
@@ -84,8 +84,8 @@ enum {
SC_CARD_TYPE_SETCOS_PKI,
SC_CARD_TYPE_SETCOS_FINEID,
SC_CARD_TYPE_SETCOS_FINEID_V2,
- SC_CARD_TYPE_SETCOS_FINEID_S2,
SC_CARD_TYPE_SETCOS_NIDEL,
+ SC_CARD_TYPE_SETCOS_FINEID_V2_2048,
SC_CARD_TYPE_SETCOS_44 = 6100,
SC_CARD_TYPE_SETCOS_EID_V2_0,
SC_CARD_TYPE_SETCOS_EID_V2_1,
Please sign in to comment.
Something went wrong with that request. Please try again.