support for TCOS3 IdKey cards and fix for bug #256
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5508 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
661cc0dd47
commit
c97fc2e719
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* card-tcos.c: Support for TCOS cards
|
* card-tcos.c: Support for TCOS cards
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Peter Koch <Koch@smartcard-auth.de>
|
* Copyright (C) 2011 Peter Koch <pk@opensc-project.org>
|
||||||
* Copyright (C) 2002 g10 Code GmbH
|
* Copyright (C) 2002 g10 Code GmbH
|
||||||
* Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
|
* Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
|
||||||
*
|
*
|
||||||
|
@ -42,6 +42,8 @@ static struct sc_atr_table tcos_atrs[] = {
|
||||||
{ "3B:BA:96:00:81:31:86:5D:00:64:05:7B:02:03:31:80:90:00:7D", NULL, NULL, SC_CARD_TYPE_TCOS_V2, 0, NULL },
|
{ "3B:BA:96:00:81:31:86:5D:00:64:05:7B:02:03:31:80:90:00:7D", NULL, NULL, SC_CARD_TYPE_TCOS_V2, 0, NULL },
|
||||||
/* Philips P5CT072 */
|
/* Philips P5CT072 */
|
||||||
{ "3B:BF:96:00:81:31:FE:5D:00:64:04:11:03:01:31:C0:73:F7:01:D0:00:90:00:7D", NULL, NULL, SC_CARD_TYPE_TCOS_V3, 0, NULL },
|
{ "3B:BF:96:00:81:31:FE:5D:00:64:04:11:03:01:31:C0:73:F7:01:D0:00:90:00:7D", NULL, NULL, SC_CARD_TYPE_TCOS_V3, 0, NULL },
|
||||||
|
/* Philips P5CT080 */
|
||||||
|
{ "3B:BF:B6:00:81:31:FE:5D:00:64:04:28:03:02:31:C0:73:F7:01:D0:00:90:00:67", NULL, NULL, SC_CARD_TYPE_TCOS_V3, 0, NULL },
|
||||||
{ NULL, NULL, NULL, 0, 0, NULL }
|
{ NULL, NULL, NULL, 0, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* PKCS15 emulation layer for TCOS based preformatted cards
|
* PKCS15 emulation layer for TCOS based preformatted cards
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010, Peter Koch <pk@opensc-project.org>
|
* Copyright (C) 2011, Peter Koch <pk@opensc-project.org>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -275,7 +275,7 @@ static int detect_netkey(
|
||||||
|
|
||||||
/* NKS-Applikation ? */
|
/* NKS-Applikation ? */
|
||||||
memset(&p, 0, sizeof(sc_path_t));
|
memset(&p, 0, sizeof(sc_path_t));
|
||||||
p.len=7; p.type=SC_PATH_TYPE_DF_NAME;
|
p.type=SC_PATH_TYPE_DF_NAME;
|
||||||
memcpy(p.value, "\xD2\x76\x00\x00\x03\x01\x02", p.len=7);
|
memcpy(p.value, "\xD2\x76\x00\x00\x03\x01\x02", p.len=7);
|
||||||
if (sc_select_file(card,&p,&f)!=SC_SUCCESS) return 1;
|
if (sc_select_file(card,&p,&f)!=SC_SUCCESS) return 1;
|
||||||
sprintf(dir,"%04X", f->id);
|
sprintf(dir,"%04X", f->id);
|
||||||
|
@ -303,8 +303,7 @@ static int detect_netkey(
|
||||||
insert_key(p15card, dirpath(dir,"0000"), 0x48, 0x83, 1024, 3, "1024bit Schluessel");
|
insert_key(p15card, dirpath(dir,"0000"), 0x48, 0x83, 1024, 3, "1024bit Schluessel");
|
||||||
|
|
||||||
insert_pin(p15card, "5000", 1, 2, 0x00, 6, "PIN",
|
insert_pin(p15card, "5000", 1, 2, 0x00, 6, "PIN",
|
||||||
SC_PKCS15_PIN_FLAG_CASE_SENSITIVE | SC_PKCS15_PIN_FLAG_INITIALIZED |
|
SC_PKCS15_PIN_FLAG_CASE_SENSITIVE | SC_PKCS15_PIN_FLAG_INITIALIZED
|
||||||
SC_PKCS15_PIN_FLAG_UNBLOCKING_PIN
|
|
||||||
);
|
);
|
||||||
insert_pin(p15card, "5001", 2, 0, 0x01, 8, "PUK",
|
insert_pin(p15card, "5001", 2, 0, 0x01, 8, "PUK",
|
||||||
SC_PKCS15_PIN_FLAG_CASE_SENSITIVE | SC_PKCS15_PIN_FLAG_INITIALIZED |
|
SC_PKCS15_PIN_FLAG_CASE_SENSITIVE | SC_PKCS15_PIN_FLAG_INITIALIZED |
|
||||||
|
@ -358,6 +357,43 @@ static int detect_netkey(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int detect_idkey(
|
||||||
|
sc_pkcs15_card_t *p15card
|
||||||
|
){
|
||||||
|
sc_card_t *card=p15card->card;
|
||||||
|
sc_path_t p;
|
||||||
|
|
||||||
|
/* TCKEY-Applikation ? */
|
||||||
|
memset(&p, 0, sizeof(sc_path_t));
|
||||||
|
p.type=SC_PATH_TYPE_DF_NAME;
|
||||||
|
memcpy(p.value, "\xD2\x76\x00\x00\x03\x0C\x01", p.len=7);
|
||||||
|
if (sc_select_file(card,&p,NULL)!=SC_SUCCESS) return 1;
|
||||||
|
|
||||||
|
p15card->tokeninfo->manufacturer_id = strdup("TeleSec GmbH");
|
||||||
|
p15card->tokeninfo->label = strdup("IDKey Card");
|
||||||
|
|
||||||
|
insert_cert(p15card, "DF074331", 0x45, 1, "Signatur Zertifikat 1");
|
||||||
|
insert_cert(p15card, "DF074332", 0x45, 1, "Signatur Zertifikat 2");
|
||||||
|
insert_cert(p15card, "DF074333", 0x45, 1, "Signatur Zertifikat 3");
|
||||||
|
|
||||||
|
insert_key(p15card, "DF074E03", 0x45, 0x84, 2048, 1, "IDKey1");
|
||||||
|
insert_key(p15card, "DF074E04", 0x46, 0x85, 2048, 1, "IDKey2");
|
||||||
|
insert_key(p15card, "DF074E05", 0x47, 0x86, 2048, 1, "IDKey3");
|
||||||
|
insert_key(p15card, "DF074E06", 0x48, 0x87, 2048, 1, "IDKey4");
|
||||||
|
insert_key(p15card, "DF074E07", 0x49, 0x88, 2048, 1, "IDKey5");
|
||||||
|
insert_key(p15card, "DF074E08", 0x4A, 0x89, 2048, 1, "IDKey6");
|
||||||
|
|
||||||
|
insert_pin(p15card, "5000", 1, 2, 0x00, 6, "PIN",
|
||||||
|
SC_PKCS15_PIN_FLAG_CASE_SENSITIVE | SC_PKCS15_PIN_FLAG_INITIALIZED
|
||||||
|
);
|
||||||
|
insert_pin(p15card, "5001", 2, 0, 0x01, 8, "PUK",
|
||||||
|
SC_PKCS15_PIN_FLAG_CASE_SENSITIVE | SC_PKCS15_PIN_FLAG_INITIALIZED |
|
||||||
|
SC_PKCS15_PIN_FLAG_UNBLOCKING_PIN | SC_PKCS15_PIN_FLAG_SO_PIN
|
||||||
|
);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int detect_signtrust(
|
static int detect_signtrust(
|
||||||
sc_pkcs15_card_t *p15card
|
sc_pkcs15_card_t *p15card
|
||||||
){
|
){
|
||||||
|
@ -403,8 +439,7 @@ static int detect_datev(
|
||||||
insert_key(p15card,"DF025371", 0x47, 0x82, 1024, 1, "Authentifizierungs Schluessel");
|
insert_key(p15card,"DF025371", 0x47, 0x82, 1024, 1, "Authentifizierungs Schluessel");
|
||||||
|
|
||||||
insert_pin(p15card,"5001", 1, 0, 0x01, 6, "PIN",
|
insert_pin(p15card,"5001", 1, 0, 0x01, 6, "PIN",
|
||||||
SC_PKCS15_PIN_FLAG_CASE_SENSITIVE | SC_PKCS15_PIN_FLAG_INITIALIZED |
|
SC_PKCS15_PIN_FLAG_CASE_SENSITIVE | SC_PKCS15_PIN_FLAG_INITIALIZED
|
||||||
SC_PKCS15_PIN_FLAG_UNBLOCKING_PIN
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -436,8 +471,7 @@ static int detect_unicard(
|
||||||
} else return 1;
|
} else return 1;
|
||||||
|
|
||||||
insert_pin(p15card,"5000", 1, 2, 0x00, 6, "PIN",
|
insert_pin(p15card,"5000", 1, 2, 0x00, 6, "PIN",
|
||||||
SC_PKCS15_PIN_FLAG_CASE_SENSITIVE | SC_PKCS15_PIN_FLAG_INITIALIZED |
|
SC_PKCS15_PIN_FLAG_CASE_SENSITIVE | SC_PKCS15_PIN_FLAG_INITIALIZED
|
||||||
SC_PKCS15_PIN_FLAG_UNBLOCKING_PIN
|
|
||||||
);
|
);
|
||||||
insert_pin(p15card,"5008", 2, 0, 0x01, 8, "PUK",
|
insert_pin(p15card,"5008", 2, 0, 0x01, 8, "PUK",
|
||||||
SC_PKCS15_PIN_FLAG_CASE_SENSITIVE | SC_PKCS15_PIN_FLAG_INITIALIZED |
|
SC_PKCS15_PIN_FLAG_CASE_SENSITIVE | SC_PKCS15_PIN_FLAG_INITIALIZED |
|
||||||
|
@ -472,9 +506,10 @@ int sc_pkcs15emu_tcos_init_ex(
|
||||||
p15card->tokeninfo->serial_number = strdup(serial);
|
p15card->tokeninfo->serial_number = strdup(serial);
|
||||||
|
|
||||||
if(!detect_netkey(p15card)) return SC_SUCCESS;
|
if(!detect_netkey(p15card)) return SC_SUCCESS;
|
||||||
|
if(!detect_idkey(p15card)) return SC_SUCCESS;
|
||||||
|
if(!detect_unicard(p15card)) return SC_SUCCESS;
|
||||||
if(!detect_signtrust(p15card)) return SC_SUCCESS;
|
if(!detect_signtrust(p15card)) return SC_SUCCESS;
|
||||||
if(!detect_datev(p15card)) return SC_SUCCESS;
|
if(!detect_datev(p15card)) return SC_SUCCESS;
|
||||||
if(!detect_unicard(p15card)) return SC_SUCCESS;
|
|
||||||
|
|
||||||
return SC_ERROR_INTERNAL;
|
return SC_ERROR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue