Commit Graph

4439 Commits

Author SHA1 Message Date
vtarasov a55f2f098b iso7816: try to read full amount of the requested data ...
actually, if an error 'Wrong Le' happens, the APDU with the reduced size is re-transmitted
(http://www.opensc-project.org/opensc/browser/trunk/src/libopensc/apdu.c#L401) .
iso7816_read_binary() returns this reduced amount of data and do not trying to read the missing part .


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5237 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-15 12:18:51 +00:00
vtarasov 3c5d61716c pkcs15init: EnterSafe: increase size of the xDF files
http://www.opensc-project.org/pipermail/opensc-devel/2011-February/016051.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5236 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-15 09:39:04 +00:00
alonbl b8fcfa8a1f openct: Wrong size
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5235 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-14 20:18:01 +00:00
alonbl 1a19093b42 Make openct compile again
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5234 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-14 19:45:02 +00:00
vtarasov 39f3c2b7c6 rtecp: in non-extended APDUs the 'Le' value cannot be more then 256 bytes ...
after r5186 the SC_MAX_APDU_BUFFER_SIZE has been increased
and so existing defintion of Le value became invalid.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5233 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-14 18:19:07 +00:00
vtarasov a076397671 pkcs15: without AID specified return the first available PKCS#15 application ...
revert accidential commit, thanks to Pierre Ossman.
http://www.opensc-project.org/pipermail/opensc-devel/2011-March/016149.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5232 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-14 18:13:38 +00:00
vtarasov b1a1dc245a pkcs15: accept more then one xDF file of the same type ...
partial revert of r4096, thanks to Pierre Ossman
http://www.opensc-project.org/pipermail/opensc-devel/2011-March/016148.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5231 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-14 18:09:48 +00:00
vtarasov 27f493e6d8 libopensc: fix debug message
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5230 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-14 18:02:50 +00:00
vtarasov 42aee0f4d5 pkcs15-tool: use dedicated function to free the object memory
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5229 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-14 18:01:40 +00:00
vtarasov a067bf35a3 pkcs15: more of the debug messages
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5228 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-13 18:11:07 +00:00
vtarasov d174edf1d2 msi: fix component ID of the rutoken profiles
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5227 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-12 15:17:02 +00:00
vtarasov dda747f8fc msi: include 'cardmod.dll' and 'rutoken' PKCS#15 profiles into MSI
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5226 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-12 14:20:13 +00:00
vtarasov d7c0ad71ff ruToken: in non-extended APDUs the 'Le' value cannot be more then 256 bytes ...
in r5186 the SC_MAX_APDU_BUFFER_SIZE has been increased
and so the previous defintion of Le value became invalid.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5225 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-11 17:57:46 +00:00
andre 10e5a18ec9 pkcs15-tool.c: Avoid compiler warnings:
pkcs15-tool.c:1111: warning: comparison between signed and unsigned
pkcs15-tool.c:1117: warning: comparison between signed and unsigned

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5224 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-07 18:14:31 +00:00
andre 12df79c14b pkcs15.c: Avoid compiler warning:
pkcs15.c:286: warning: unused variable ‘conf_block’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5223 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-07 18:10:11 +00:00
andre 3442649b42 pkcs15-pin: Fixing the method of obtaining objects protected by a particular PIN. Now it's in accordance with PKCS15. See [http://www.opensc-project.org/pipermail/opensc-devel/2011-January/015818.html discussion].
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5222 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-07 16:15:41 +00:00
andre 39db526407 pkcs15-piv: Remove unused functionality.
These lines made use of the attribute card->flags which is mostly unused in the whole framework. That attribute becomes nearly obsolete without these lines. See [http://www.opensc-project.org/pipermail/opensc-devel/2011-March/016104.html discussion].

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5221 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-07 16:00:23 +00:00
vtarasov 33f44f8dc1 pkcs15: pin references are always positive integers ...
In the OpenSC versions previous to 0.11.5 the references greater then
127 were erroneously encoded by one byte (negative value ecording to the
ASN.1 rules).
Actually some other proprietary PKCS#15 cards have also this infirmity.

Actual commit makes general the application of the hack used for 'starcos' card.

http://www.opensc-project.org/pipermail/opensc-devel/2011-February/016062.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5220 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-06 12:35:35 +00:00
vtarasov 763c0bcefe pkcs15init: #327: unique ID for the private key objects. Thanks a Diego (NdK) ...
http://www.opensc-project.org/opensc/ticket/327


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5219 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-06 11:34:58 +00:00
andre 8ff3d5d647 Fixing misuse of SC_CARD_FLAG_RNG. From opensc.h :
[http://www.opensc-project.org/opensc/browser/trunk/src/libopensc/opensc.h?rev=5190#L88 #define SC_ALGORITHM_RSA_PAD_PKCS1      0x00000002]
[http://www.opensc-project.org/opensc/browser/trunk/src/libopensc/opensc.h?rev=5190#L413 #define SC_CARD_FLAG_RNG                0x00000002]

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5218 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-04 16:23:07 +00:00
martin 711cbda2e0 PC/SC: Add "PIN length not in range" interpretation to PC/SC pinpad code.
This way this condition won't get translated to a generic -1200 error, as 0x6403 is not a known SW.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5217 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-02 14:18:09 +00:00
martin d59197748c EstonianEid: Force T=0 for the newest ATR as well.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5216 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-01 11:19:45 +00:00
dengert d4bcba5808 Allow a key to be used to sign a certificate request
even if the normal usage does not allow sign.
This is need when initializing a card when called by
OpenSSL req -engine  



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5215 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-25 17:20:52 +00:00
vtarasov dc7cde4d79 ias/ecc: do not throw an error when there is SM or Auth.Ext protection
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5214 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-23 08:57:30 +00:00
vtarasov c55a581b5a cardmod: fix log printing into the 'debug_file' ...
compiled with VS 10.0 and tested on Vista, 
probably can be extended for mingw32 
http://www.opensc-project.org/opensc/browser/trunk/src/cardmod/cardmod.c#L131

also fix warning C4715: 'check_reader_status' : not all control paths return a value'


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5213 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-22 19:00:22 +00:00
dengert c5b2b021be opensc-cardmod.dll can now by built as "static"
using the VS. The dll will contain all of OpenSC,
OpenSSL and zlib in a single dll, and thus can
reside anywere. Without this, winlogin would require
it to reside in system32. 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5212 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-18 20:48:22 +00:00
dengert 432a89c18b Fix malloc warning by using stdlib.h
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5211 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-18 20:37:50 +00:00
martin 8f4dfe2c85 Amend r5201: put libscdl.h/libpkcs11.h to distribution package and link against libltdl where needed.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5210 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-17 20:46:13 +00:00
vtarasov 47b1c9a86d opensc-msi: do not install libltdl
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5209 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-17 17:26:43 +00:00
vtarasov 7ca921fc4a ias/ecc: use extended path in the 'include' macros
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5208 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-17 17:24:31 +00:00
dengert 6ef7366074 void issues with ssize_t See r5135 and r5195
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5207 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-17 14:50:33 +00:00
vtarasov 4f266b6099 libopensc: include 'scdl' library when linking with Visual Studio ...
missing 'scdl' header file in 'pkcs15-lib'


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5206 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-17 13:35:25 +00:00
vtarasov 16ca4b05f8 opensc.conf: by default comment out all IAS/ECC specific configuration lines ...
http://www.opensc-project.org/pipermail/opensc-devel/2011-February/016013.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5205 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-17 09:36:36 +00:00
vtarasov 6dd928bdfb libopensc: fix name of 'LTDL' macro
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5204 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-17 09:28:40 +00:00
martin 2ea78bf741 Amend r5201: also move libltdl build properties to the right Makefile and other leftovers.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5203 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-17 07:45:36 +00:00
dengert c6eb3a3085 Allow use of seperate build and source dir when building
common/libpkcs11            


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5202 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 21:05:52 +00:00
martin ffb46d2573 core: reanimate the sc_dlopen API for dynamic loading
* shift libpkcs11 from src/pkcs11 to src/common as it is not used to implement the OpenSC PKCS#11 module
 * invent a "libscdl" mini library that implements either libltdl based dynamic loading or uses native interfaces
 * drop hard requirement for libltl to build OpenSC
 * native Windows build does not need libltdl any more
 * specify CNGSDK include dir to find cardmod.h. CNGSDK only registers with a handful of compilers

Deals with #323

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5201 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 19:02:11 +00:00
vtarasov 53dd2ceafa IAS/ECC: remove dead code and '//' coments, resolve some warnings ...
to be continued, thanks to Martin


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5200 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 14:05:17 +00:00
vtarasov e02becc6e2 IAS/ECC: for the IAS/ECC cards include into the OpenSC configuration the 'card_atr' sections
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5199 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 11:01:46 +00:00
vtarasov 69b7f200eb IAS/ECC: include support of the IAS/ECC v1.0.1 cards ...
http://www.opensc-project.org/pipermail/opensc-devel/2011-January/015756.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5198 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 10:59:10 +00:00
vtarasov 57b7a81c3a IAS/ECC: add IAS/ECC card specific files ...
as it was announced in 
http://www.opensc-project.org/pipermail/opensc-devel/2011-January/015756.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5197 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 10:55:05 +00:00
vtarasov ce116f42b6 pkcs15init: for MyEID card set tokenInfo flags ...
it's a part of demand of the card driver's maintainer
http://www.opensc-project.org/pipermail/opensc-devel/2011-February/015994.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5196 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 10:46:06 +00:00
vtarasov d953d4ade4 card-piv: 'ssize_t' is not defined when compiling with Visual Studio
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5195 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 10:31:59 +00:00
martin 43be49b4a3 libopensc: correct ASN.1 parsing of EF(TokenInfo).
Two fields should be optional. This also fixes #322

Thanks to Toni for finding and Andre for fixing the problem.
See http://www.opensc-project.org/pipermail/opensc-devel/2011-January/015613.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5194 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-10 20:31:34 +00:00
martin f73eb87fed MacInstaller: use the pre-built libopensc.dylib for building OpenSC.tokend
This way it can be built without installing OpenSC on a clean machine.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5193 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-10 13:40:35 +00:00
dengert 0a9d507556 Fixes to cardmod:
The registry in no longer used to pass the
    handles provided by BaseCSP. sc_ctx_use_reader
    is used instead.  (uses r5190)

    A decryption routine was added as it is needed by login.

    Key container names are based on the card serial
    number and cert ID. The must be unique as they
    are searched for in the certificate store to 
    find the card to insert in some situations. 

    If the handles change, the association to the reader
    and card is refreshed as it may be a different card
    or reader.  (uses r5127)

    Extra low lowel debugging was added. To use
    it the CARDMOD_LOW_LEVEL_DEBUG but be defined in
    cardmod.c This can log entries before and sc_context
    is established. 

    The use of "texte" was replaced, as it looked like there 
    could be buffer overflows. It was replaced with a 
    loghex routine.

    SC_ALGORITHM_RSA_HASH_MD5_SHA1 can now be used
    (IE uses this.) 
       
    Several other bugs were fixed.

The code can now bue used for AD login, and was tested
with swaping cards duirng login, and with several readers. 
The code is still experimental, and for login to work,
the dlls were moved to system32. 



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5192 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-09 17:52:00 +00:00
dengert 0180a969db Remove dependency on sc_establish_context, and provide appname
via sc_ctx_create_context and ctx_param.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5191 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-09 14:45:51 +00:00
dengert d3b3faa91a Add sc_ctx_use_reader as a reader driver operation.
It is used by cardmod to pass in pointers to the PC/SC handles 
provided by the caller of cardmod. Other drivers will return
an error if this routine called. 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5190 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-09 14:33:52 +00:00
dengert 025da6d0f5 Fix #325 add SC_PKCS15_PRKEY_USAGE_ENCRYPT and SC_PKCS15_PRKEY_USAGE_DECRYPT
to PIV KEY Management keys and certificates, includeing the Retired keys. 
This applies to 0.12.0 and needs to be in 0.12.1


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5189 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-08 15:49:35 +00:00
dengert 98aa4cb571 Fix uninitialized variables and warning messages.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5188 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-07 16:23:54 +00:00