Commit Graph

2276 Commits

Author SHA1 Message Date
German Blanco 63ce563d76 Adding support for DNIe. 2013-06-13 17:31:56 +02:00
Viktor Tarasov 98db49936a pkcs15: 'issuer' and 'subject' have to be DER encoded sequence
'issuer' and 'subject' data have been the non-encoded sequence of rDNs
2013-03-17 13:56:26 +01:00
Martin Paljak 9901682288 Normalize SC_ERROR_* API and clean up ISO7816-4 errors.
* iso7816_check_sw() emits a "informational message" (from ISO7816-4 table 6)
 * SW-s which are not known or not meaningful for internal API get translated
   to SC_ERROR_CARD_CMD_FAILED by default, so use it also in the SW table
 * Remove undefined SW-s and move generic SW-s to their sequential location.

This commit improves 8fc679bf40
2013-03-15 12:30:38 +02:00
Viktor Tarasov 743ca1cedc pkcs15: new 'data' member in 'sc_pkcs15_data_info'
New member keeps the value of the PKCS#15 DATA object.

Internal pkcs15 procedure that reads DATA object is modified
to check if requested data are already vailable in 'data-info',
an only then try to read the content of dedicated on-card file.

For some emulated PKCS#15 systems value of DATA object is kept as 'direct' value
in a proprietary attribute files and so the common read procedure could not be used.

; some efforts to unify layout of code source.
2013-03-11 13:04:10 +01:00
Viktor Tarasov 8fc679bf40 libopensc: invalid usage of SC_ERROR_MEMORY_FAILURE
Initiated by discussion in https://github.com/OpenSC/OpenSC/pull/134 .

SC_ERROR_MEMORY_FAILURE has to be used as a resulting code of the card related operations,
and not as result of the memory allocation problems.

New 'warning' category of SC_ERRORs introduced -- SC_WARNING_xx .
Error text and SC_ERROR associated with return codes 6300 and 6200 has been changed.
2013-03-02 19:29:14 +01:00
Zbigniew Halas b1a4775310 epass2003: properly disable padding
EVP_CIPHER_CTX_set_padding needs to be called after EVP_EncryptInit_ex
and EVP_DecryptInit_ex, otherwise padding is re-enabled, which in turn
causes buffer overruns
2013-02-27 23:44:02 +00:00
Ondrej Mikle 83dc469f07 epass2003: list_files implemented 2013-02-25 19:21:52 +01:00
Martin Paljak 16ee818440 Update domain name. paljak.pri.ee is gone since 2011. 2013-02-25 11:58:25 +02:00
Viktor Tarasov 3c804ff382 libopensc: more comments about FCP data 2013-02-25 10:20:31 +01:00
Viktor Tarasov 4b30292585 more macros for the values from ISO specification 2013-02-24 19:37:35 +01:00
Viktor Tarasov 326232de90 libopensc: introduce 'encoded-content' to the sc_file data
it's the hold place for the file's initial encoded content.
For some cards such data can be included into the file creation command.
2013-02-24 19:37:35 +01:00
Viktor Tarasov 5140c4a1f1 libopensc: use short form of the debug message calls 2013-02-24 19:37:35 +01:00
Ondrej Mikle ee48ea187a Fix to allow exponents other than 65537 for Feitian ePass 2003 2013-02-16 21:13:17 +01:00
Andreas Schwier b34d916e60 sc-hsm: Fixed problem deleting CA certificates
sc-hsm: Fixed public key format returned when generating ECC keys
2013-02-15 15:02:28 +01:00
Andreas Schwier 99af6cd8ee sc-hsm: Fixed a bug that prevents a newly generated 2048 key to show up at the PKCS#11 interface 2013-01-27 18:42:33 +01:00
Viktor Tarasov 6a4de6d551 libopensc: APDU 'allocate & copy'and 'free' procedures 2013-01-06 17:30:41 +01:00
Viktor Tarasov 8d7c773561 SM: move SM APDU procedures to dedicated source file
new SM errors: 'session-already-opened' and 'invalid-checksum'
declare typed data for DH SM session
2013-01-06 16:40:17 +01:00
Viktor Tarasov cc5a171ddc pkcs15: regression in e35febe: compute cert length
parse_x509_cert() reviewed.
Now certificate's DER data are allocated and the DER data length is determined in one place.

https://github.com/OpenSC/OpenSC/pull/114
https://github.com/OpenSC/OpenSC/commit/e35febe
2012-12-25 20:05:45 +01:00
Viktor Tarasov 3aaf95c21b cardOS: compile on Windows
few coding style remarks
2012-12-16 11:50:08 +01:00
mtausig 1d75427f55 cardOS: Use information from AlgorithmInfo
In set_security_env, the algorithmInfo structure (from the TokenInfo file of
PKCS#15) is parsed to see, what algorithm IDs are supported for signature
operations.

Using the information from AlgorithmInfo set in set_security_env when
computing signatures.

Fixed incorrect order of code blocks. If neither a reference to rsa_sig nor to
rsa_pure_sig is found in AlogirthmInfo, boths methods are enabled before (and
not after) trying pure_sig
2012-12-16 11:23:35 +01:00
blumentopf d5c2401e19 pkcs15-gemsafeV1.c: Multiple key containers and ATR-specific PIN policies
pkcs15-gemsafeV1.c: Change PIN data structure to make MSVC compiler happy
pkcs15-gemsafeV1.c: Turn constants into macros to make MSVC compiler happy
2012-12-16 10:09:44 +01:00
Viktor Tarasov 8b07b9c5a7 compile on Windows, minor codding style issues 2012-12-03 15:21:22 +01:00
sjoblomt 457426543d MyEID ECDSA support 2012-12-03 14:37:13 +01:00
Viktor Tarasov 60b7e52e06 pkcs15: mandatory 'publicKeyCoefficients' in encode/decode public key procedures
http://www.opensc-project.org/pipermail/opensc-devel/2012-November/018586.html
2012-11-20 22:58:37 +01:00
Ludovic Rousseau 81bbddfc24 card-gemsafeV1: Add a GemSafe V1 ATR
Thanks to Lukas Wunner for the patch
2012-11-20 19:11:23 +01:00
Andreas Schwier 0adec1bddd sc-hsm: Fixed bug with memory released to early 2012-11-20 08:46:27 +01:00
Andreas Schwier bbbfae4bf0 sc-hsm: Now saving the internal CSR in place of the certificate and decoding the public key at initialization (RSA only) 2012-11-20 08:46:27 +01:00
Viktor Tarasov 68ee0e76e0 t447: return value from init() in reader driver not checked 2012-11-11 22:17:17 +01:00
Viktor Tarasov f7771c9b08 libopensc: check data returned by 'read-public-key'
fix error message
2012-11-11 21:47:10 +01:00
Viktor Tarasov da5934a6ff libopensc iso7816: retry SELECT with FCI if SELECT without FCI fails
t457 (https://www.opensc-project.org/opensc/ticket/457)
For some cards that currently use the common iso-7816 operations
only SELECT with return of FCI/FCP can be applied.

In iso-7816 'select-file' handle, if 'SELECT without FCI' fails with error code 6A86,
then retry 'SELECT with FCI'. Other error code can be added.

Sorry for the 'coding style' noise.
2012-11-11 20:38:30 +01:00
Andreas Schwier 7c714860a2 sc-hsm: Fixed bug decoding CVCs without domain parameter 2012-11-11 12:53:03 +01:00
Andreas Schwier 33da14c459 sc-hsm: Added code to prevent CV certificates being listed as X.509 certificates 2012-11-11 12:53:03 +01:00
Andreas Schwier ffb20e5916 sc-hsm: Added sc-hsm-tool with DKEK support and key wrap / unwrap 2012-11-11 12:53:03 +01:00
Viktor Tarasov 7fbca94698 opensc: new card operation 'read-public-key'
In PukDF of PKCS#15 the public key value can be presented by 'direct value', by path or by path and reference.
For the different cards the public key can be stored in EF, internal EF or in card specific SDO (security data objects).
A new card handle allows to read out the public key from the card specific SDOs.
2012-11-09 14:36:14 +01:00
Viktor Tarasov 62fd67f6a8 gemsafeV1: set 'auth-method' for the emulated PIN PKCS#15 object 2012-11-09 14:33:23 +01:00
Viktor Tarasov 0166321835 libopensc: increase maximum number of card drivers
http://www.opensc-project.org/pipermail/opensc-devel/2012-October/018552.html
Default driver is disabled on 0.13 because there are more drivers listed in ctx.c. (leonardo.schenkel@gmail.com)

SC_MAX_CARD_DRIVERS is increases from 32 to 48. It's not the best solution, but the most rapid.
Will be waiting for the better proposals.
2012-11-04 16:44:34 +01:00
Viktor Tarasov e35febed5b pkcs15: use whe available the pkcs15 object content
when reading certificate, try to get the pkcs15 object's content
before reading the certificate file.
2012-10-21 16:30:06 +02:00
Viktor Tarasov 4cf3a3b204 move CK_VERSION data from 'pkcs15' to 'sc-card'
CK_VERSION is included into PKCS#11 data but is not specified by PKCS#15.

CK_VERSION can be provided by card's pkcs15 emulator or by the card's driver,
including the cards with the native support of pkcs#15 (and thus without pkcs15 emulator).

That's why the more general solution is to have these data included into 'sc-card' data type.
2012-10-21 16:24:11 +02:00
Andreas Schwier aaedef70b5 sc-hsm: Added ability to initialize SmartCard-HSM using C_Initialize and C_InitPIN on PKCS#11 interface 2012-10-21 15:51:55 +02:00
Andreas Schwier fba298c6f4 pksc11: Added ability to indicate hardware and firmware version information at PKCS#11 interface 2012-10-21 15:51:55 +02:00
Andreas Schwier 72786abe1f sc-hsm: Added write support for RSA and ECC keys, certificates and data objects 2012-10-01 13:09:02 +02:00
Andreas Schwier 1619a42375 ecc: Adding more curves 2012-10-01 13:04:02 +02:00
Andreas Schwier f508b21253 pkcs15: Add support to encode EC private key description 2012-10-01 13:04:02 +02:00
Andreas Schwier 7b943b934b pkcs15: Fixed typo 2012-10-01 13:04:01 +02:00
Viktor Tarasov 249b769a4b pkcs11: unlink 'pubkey' FW object when deleting related certificate
Thanks to Andreas Schwier.
http://www.opensc-project.org/pipermail/opensc-devel/2012-September/018455.html

In PKCS#11 FW, the 'certificate' FW object is used to create corresponding 'public'key' FW object
or to get some of its attributes.
Seg.fault occured when, in the same session, the related certificate was destroyed and after that
there was the attempt to get such public key attributes.
2012-10-01 10:47:52 +02:00
Viktor Tarasov df9a4d0b2c pkcs15: for 'sc_pkcs15_cer's data use the 'der' object type
To hold the raw certificate blob in 'sc_pkcs15_cert' data use the 'sc_pkcs15_der' data type.
also:
; in 'pkcs15-cert.c' use short call of the debug messages;
; in 'destroy-object' pkcs15 framework handler take into account the multi-application cards:
-- when binding card use the application info;
-- when finalizing profile use the application ID.
2012-09-30 22:54:52 +02:00
Ludovic Rousseau ea40e7fe24 Use AM_CPPFLAGS instead of INCLUDES
Fix autoreconf warnings:

$ autoreconf -vis -Wall
[...]
src/common/Makefile.am:12: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/libopensc/Makefile.am:19: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/minidriver/Makefile.am:15: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/pkcs11/Makefile.am:10: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/pkcs15init/Makefile.am:36: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/scconf/Makefile.am:12: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/sm/Makefile.am:8: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/tests/Makefile.am:9: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/tools/Makefile.am:15: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
2012-09-25 23:03:38 +02:00
Viktor Tarasov ceef4c0be3 iasecc: remove ostentatious TODO messages 2012-09-24 11:50:56 +02:00
Viktor Tarasov d525ca97e3 libopensc: OID with only zeros in array do not valid 2012-09-23 21:02:31 +02:00
Viktor Tarasov 58b4304957 libopensc: 'init', 'format', 'compare', 'is-valid' OID procedures
In a reason of number of bugs(*) that concern the OID management,
the general usage OID procedures 'init', 'format', 'compare', 'is-valid' are introduced.
These procedures should be used by all actors: libopensc, pkcs15, pkcs11, tools, ....

(*)
This bug reported by Andreas Schwier :
8e75d971cb (commitcomment-1792477)

In pkcs15-algo sc_asn1_get_algorithm_info() can return the OID without ending '-1's:
https://github.com/OpenSC/OpenSC/blob/staging/src/libopensc/pkcs15-algo.c#L452
https://github.com/OpenSC/OpenSC/blob/staging/src/libopensc/pkcs15-algo.c#L459
2012-09-06 10:47:29 +02:00