Commit Graph

22 Commits

Author SHA1 Message Date
Nuno Goncalves 4202ea25d0 pteid: order objects by address (supersede #949) (#954)
* pteid: remove OID setting for data objects as they are not defined for this token

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>

* pteid: order data objects code list by address and rename new objects

The ICAO MRTD specification defines the Security Object Document
abreviation as SOd and not SOD. This is a breaking change since
the labels are case sensitive, but this object was not yet available
on the last stable release.

Trace is also not a acronym or abreviation, so it should be defined with
normal casing. Also a breaking change and also acceptable because it is
unstable code only.

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-02-09 20:54:06 +01:00
Nuno Goncalves 4b93f447d5 pteid: support iso7816 logged_in
Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-01-13 15:46:05 +01:00
Michał Trojnara 645780e6d4 NULL parameter check moved to sc_file_free()
This fixes numerous issues where the check is *not* performed,
and also simplifies the code.
2017-01-10 12:46:44 +01:00
Nuno Goncalves dc073114a0 pkcs15-pteid: new implementation
This implementation reads most of the data from the pkcs15 structure on card, so the objects list are greatly reduced.

This improves several pending issues:

* drop support for IAS card type
In accordance to [1] IAS card type is no longer issued since version
004.003.11 (2010-06-15) and as a legal requirement all documents have
been destroyed or declared lost.

[1] https://www.cartaodecidadao.pt/documentos/DOC_01-DCM-15_V3_CC_Controlo_Versao_2016-01-20.pdf

* fix pteid_cert_ids
The Signature and Authentication Sub CA certificates ids were wrong.

* add objects and fix flags
Add Root CA certificate.
Add data objects SOD and TRACe
Data object 'Citizen Notepad' doesn't require login to be read. Remove flags.

* Support PIN max tries and tries left report

* Properly report cards with 2048b keys.

Suggested-by: João Poupino <joao.poupino@gmail.com>
Suggested-by: André Guerreiro <andre.guerreiro@caixamagica.pt>
Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>

-- closes #806
2016-11-08 13:02:03 +01:00
Maciej S. Szmigiero d84ee6c96a Initialize PIN logged_in field for cards that do not support PIN info
Commit 2f10de4f5c ("use sc_pkcs15_get_pin_info in C_GetTokenInfo")
introduced dependency of logged in state returned for session
by C_GetTokenInfo() on logged_in field of that session slot PIN.

This field is updated by sending pin_cmd of type SC_PIN_CMD_GET_INFO to
card.
However, not all cards support such pin_cmd type (in fact, majority of
them don't). In this case logged_in field is usually left zero-initialized
which means SC_PIN_STATE_LOGGED_OUT.

With such logged_in field value C_GetTokenInfo() always returns
CKS_R{O,W}_PUBLIC_SESSION, instead of CKS_R{O,W}_USER_FUNCTIONS when
logged in.

At least Firefox (and probably other NSS-based software, too) is confused
by such value and keeps repeating PIN prompts a few times until it
ultimately considers that logging in to this slot has failed.

Fix this by initializing PIN logged_in field to SC_PIN_STATE_UNKNOWN for
cards that do not support SC_PIN_CMD_GET_INFO pin_cmd.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2016-09-01 02:03:42 +02:00
Frank Morgner b568bbc256 pkcs15-pteid.c: Use two hex digits with sc_pkcs15_format_id 2016-05-12 09:58:28 +02:00
Viktor Tarasov 9ac4120594 pkcs15: 'aid' argument for emulator init
Allows to PKCS#15 emulator to bind more then one application
2016-04-08 10:48:58 +02:00
Frank Morgner bcb5fc15e5 honour HAVE_CONFIG_H 2015-04-22 23:55:33 +02:00
Thomas Calderon 91ddcfb514 PKCS15: remove redundant code for access_flags.
* With commit facaf59, access_flags were set for most cards. A closer look
    revealed that this is already done in `sc_pkcs15emu_add_rsa_prkey`.
    Therefore, this removes the duplicated code for cards calling this function.
2015-01-16 10:03:13 +01:00
Thomas Calderon facaf5969b Improve PKCS#11 compliance. Issue #335
* Add default behavior for cards using the PKCS#15 emulation layer.
    Hence, this patch provide a default value for access_flags compatible with
    current OpenSC's behavior while allowing compatible cards to fetch the real
    value from the card (IAS-ECC and AuthentIC).
2014-12-29 13:11:23 +01:00
João Poupino aec1cd9639 Remove redudant check 2013-05-06 21:46:15 +01:00
João Poupino 4ecbfabffe Fix for PTEID's PKCS#15 emulation breakage 2013-05-05 18:15:41 +01:00
Martin Paljak 16ee818440 Update domain name. paljak.pri.ee is gone since 2011. 2013-02-25 11:58:25 +02:00
João Poupino c6fcd68fbc Fix for ticket #400
Specify the path of the Address PIN for IAS-based cards in order to properly
read the Citizen Address Data object.  Remove the "Citizen Data" object
association with the Address PIN, as it incorrectly describes the card layout.

http://www.opensc-project.org/opensc/ticket/400.

Change-Id: I7ca81d6d15c5e2b137ff3c9a40b7471eb2fad55c
2011-12-07 12:49:17 +02:00
vtarasov d888b3fd55 pkcs15: use general 'AuthenticationObject' instead of 'PinObject'
now the attributes of the previous 'pin-info' data type are included
as the sub-type attributes of the general 'auth-info' data .
It will allow to include support of the 'biometricTemplate' and 'authKey' authentication types.

http://www.opensc-project.org/pipermail/opensc-devel/2011-May/016655.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5550 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-05 15:46:25 +00:00
ludovic.rousseau 2a4cdd4d57 pkcs15-pteid.c: In function ‘sc_pkcs15emu_pteid_init’:
pkcs15-pteid.c:56: warning: ‘buf’ may be used uninitialized in this function


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4863 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 16:58:33 +00:00
martin 50f99a20f8 libopensc: move TokenInfo fields from sc_pkcs15_card_t to a separate structure.
Thanks to Andre Zepezauer for the patch.

See http://www.opensc-project.org/pipermail/opensc-devel/2010-September/015076.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4788 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 15:44:58 +00:00
aj 6545b42c02 cleanup of the debug code:
* reduce to a few, supported functions.
* change all functions to take the debug level as parameter.
* use symbolic names for the debug levels.
* fix tools to pass "verbose"/"opt_debug" as ctx->debug.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4118 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-15 12:17:13 +00:00
aj d22a2483c0 Header file cleanup.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4081 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-04 08:14:36 +00:00
martin 11e9cab070 Fix C coding style to please visual studio. By João Poupino.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3855 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-16 21:41:40 +00:00
martin 64916e01b5 Accidental sc_error removed.
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3756 c6295689-39f2-0310-b995-f0e70906c6a9
2009-10-03 17:04:32 +00:00
martin 9c7eb8122a Add support for Portugese eID on IAS and Gemsafe cards, by João Poupino.
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3755 c6295689-39f2-0310-b995-f0e70906c6a9
2009-10-03 14:41:14 +00:00