Commit Graph

4978 Commits

Author SHA1 Message Date
Viktor Tarasov fe80ffdbd2 pkcs11-spy: invalid ExpandEnvironmentStrings() call parameter
pkcs11-spy.c(168) : warning C4047: 'function' : 'DWORD' differs in levels of indirection from 'DWORD *'
pkcs11-spy.c(168) : warning C4024: 'ExpandEnvironmentStringsA' : different types for formal and actual parameter 3
pkcs11-spy.c(205) : warning C4047: 'function' : 'DWORD' differs in levels of indirection from 'DWORD *'
pkcs11-spy.c(205) : warning C4024: 'ExpandEnvironmentStringsA' : different types for formal and actual parameter 3
2012-05-30 10:08:30 +02:00
Peter Marschall aca314b1f8 opensc-explorer: remove outdated usage text for verify
Wuth the key types explicitly listed in the usage line,
it is not necessary to list them separately.
2012-05-30 09:39:12 +02:00
Peter Marschall f04a1c5fef OpenPGP: stricter validity checks in PKCS15 init
Only add private/public keys that habe been defined:
check finger prints & algorithm identifier
2012-05-30 09:39:12 +02:00
Peter Marschall 742186f32f OpenPGP: remove unnecessary call to sc_get_data 2012-05-30 09:39:12 +02:00
Peter Marschall d38d615025 OpenPGP: parse more (extended) capabilities on init
* parse more extened capabilities & features into a private enum
* for v2.0 cards, always parse the "historical bytes" DO
  reason: ATR may be static and thus cannot reflect the state
2012-05-30 09:39:12 +02:00
Peter Marschall 67136b1781 OpenPGP: revert 7b4532736e
PKCS#15 spec v1.1 says:
TokenInfo.version: This field contains the number of the particular version
of this specification the application is based upon. For this version of this
document, the value of version shall be 0 (v1).

Thanks to Martin Paljak for the finding.
2012-05-30 09:39:12 +02:00
Peter Marschall 93cb77079b tools: re-factor usage message function
* change order of long & short option names: letters first, then the long names
  Effect: nicely aligned short and long option names in the help text
* more space between option names and explanation
  Effect: better readability on long options
* print "Options:" header only if there is at least one non-hidden options
  Effect: nicer output when all options are hidden
* only show printable, non-space short options letters
  Effect: no control codes printed to terminal
* get rid of a temporary variable
2012-05-30 09:39:12 +02:00
Peter Marschall 367ebd94d4 tools: allow arguments to be printed in usage message
Extend util_print_usage_and_die() by a string argument that describes
further arguments to the program.

1st user: opensc-explorer
2012-05-30 09:39:12 +02:00
Peter Marschall 61ca69c251 OpenPGP: documentation for openpgp-tool 2012-05-30 09:39:12 +02:00
Peter Marschall 8238239852 OpenPGP: extend openpgp-tool 2012-05-30 09:39:12 +02:00
Peter Marschall c58e94810b opensc-explorer: update documentation 2012-05-30 09:39:12 +02:00
Peter Marschall 965d44ec40 opensc-explorer: use case-insensitive pin types in PACE 2012-05-30 09:39:12 +02:00
Peter Marschall cd2cdf77f6 opensc-explorer: explicitly mention key types 2012-05-30 09:39:12 +02:00
Peter Marschall 2276c7e7e4 opensc-explorer: do not use hard-coded string length
Determine length of prefix dynamically instead of using a hard-coded, common
value for all prefixes.
2012-05-30 09:39:12 +02:00
Peter Marschall 2efc9b76df opensc-explorer: document new command line parameter SCRIPT 2012-05-30 09:39:11 +02:00
Peter Marschall 458517783c OpenPGP: fix access conditions for DOs
Follow the specs.
2012-05-30 09:39:11 +02:00
Peter Marschall 26aac71c9f OpenPGP: correct PIN type to UTF-8
OpenPGP card spec v1.1 and v2.0 make it absolutely clear:
"... The format of the CHVs is UTF-8 (case sensitive) ...".
2012-05-30 09:39:11 +02:00
Viktor Tarasov 6d4d1b4aca win32: do not export 'sc_pkcs15_remove_df' procedure
in source it replaced by static 'sc_pkcs15_remove_dfs'
2012-05-30 09:25:57 +02:00
Viktor Tarasov 177af40535 md: prototype of sc_pkcs15_get_guid() has been changed
introduced 'flags' parameter
2012-05-30 09:18:03 +02:00
Viktor Tarasov 6337149ef7 pkcs15: decode 'seInfo', 'profileIndication', 'lastUpdate'
Encode,decode  'lastUpdate', 'seInfo', 'profileIndication' of TokenInfo (CIAInfo).
Trailing whitespaces.
2012-05-30 09:03:27 +02:00
Viktor Tarasov be81263d8e log: config option to reopen debug file at every debug log ...
To be used in windows:
"In Windows, file handles can not be shared between DLL-s, each DLL has a separate file handle table.
For that reason reopen debug file before every debug message."

sc_context_repair() procedure from Hunter William
"Workaround some threading and data lifetime issues when card handle changes and need to re-associate card"
http://www.opensc-project.org/pipermail/opensc-devel/2011-December/017445.html
2012-05-29 19:44:54 +02:00
Viktor Tarasov 954d0b9375 pkcs15: DIR EF can have EF_LINEAR structure
and so, in this case the checking file size is not appropriate method to validate it.
;use short call form for the log messages;
2012-05-29 19:19:06 +02:00
Viktor Tarasov 9d5404bac6 libopensc: some usefull macros, crc32 calculation procedure
Introduce some usefull define macros, error code 'inconsistent configuration'.
Introduce procedure to calculate CRC32 digest,
to be used in minidriver to calculate the 'freshness' values.
2012-05-29 11:29:44 +02:00
Viktor Tarasov 9c882ff5c2 AuthentIC: add SM related procedures
Added to facilitate future SM merge,
for a while disabled by conditional macro.
2012-05-29 09:52:33 +02:00
Viktor Tarasov 230b782309 pkcs15: add 'sc_pkcs15_derive' missing for ECDH support
also, key path, that has to be selected before crypto operation,
can contain an aid.
2012-05-28 23:15:37 +02:00
Viktor Tarasov 9c5dbea883 pkcs11: ECHD and secret keys support from Douglas
This support were initially proposed by Douglas (https://github.com/dengert/OpenSC/commits/ecdh) and
then merged into SM branch (https://github.com/viktorTarasov/OpenSC-SM/tree/secure-messaging).
2012-05-28 20:06:23 +02:00
Viktor Tarasov 76b8ad8ad6 pkcs11-spy: timestamp, environment strings in paths
Add to the spy logs the timestamp with millisecond resolution.
Environment strings are accepted in the key registries paths related to spy module.

pkcs11-spy: code formatting
2012-05-28 20:05:28 +02:00
viktorTarasov 388d68fb1a Merge pull request #37 from marschap/staging
improvements to opensc-explorer & new tool openpgp-tool

Usefull improvement: probably could be used in automated tests.

I follow Ludovic and attract your attention onto the necessity, in the nearest future, 
to supply the doc/man for the tool newly introduced.
Without it the build of OpenSC package will simply not be possible.
2012-05-26 05:29:24 -07:00
viktorTarasov c6cae25470 Merge pull request #41 from viktorTarasov/pull-request--multi-applications-mixed-slots
Multi on-card applications in PKCS#11 OpenSC module
2012-05-26 04:44:20 -07:00
Viktor Tarasov 363e374664 pkcs15init: syntax changed for the ias(ecc) profiles 2012-05-26 09:36:49 +02:00
Viktor Tarasov b432e9767f pkcs15init: add 'minidriver-style' profile option
The on-card support of minidriver could need some MD specific pkcs#15 (DATA) objects.
There is no standard for these objects.
New option will allow to choose one of the possible implementations.
2012-05-26 09:36:49 +02:00
Viktor Tarasov 10e1ad001d pkcs15init: change sc_pkcs15init_bind() prototype
Add new argument 'application-info',
that will allow to select the on-card application to by binded with.

pkcs11: use sc_pkcs15init_bind with 'AID' argument

Prototype of sc_pkcs15init_bind() has been changed to add argument with
AID of the on-card application to be binded with.
2012-05-26 09:36:25 +02:00
Viktor Tarasov bf752f3c61 pkcs15: new procedure to find an Auth PKCS#15 object (PIN) by flags 2012-05-25 09:19:19 +02:00
Viktor Tarasov 343fa20a00 pkcs11: create tokens and slots for multiple on-card applications
In card detection procedure bind all present applications
and create tokens for them.

Treatement of the different 'create-slots' configuration cases,
joining the objects from different applications into one slot
are previewed for the next commits.
2012-05-23 09:22:41 +02:00
Viktor Tarasov 80266ff466 pkcs15: new procedure to get application by it's symbolic name
At the moment symbolic names for the on-card applications are 'generic', 'protected'.
This distinction used by pkcs11 and minidriver module to select the
'master' application in the cases when only reduced number of slots (one)
can be exposed by module (minidriver) or particular configuration (pkcs11).
2012-05-23 08:50:18 +02:00
Viktor Tarasov 14049fb806 pkcs11: prepare internal API for multi-application mode
- simplify some of framework handles: remove from it's prototype the arguments that can be derived from the other arguments;
for exemple: foo(slot, slot->card) --> foo(slot)
- add the 'application' argument to the bind, unbind and similar handles;
- preview more then one framework data attached to the pkcs11card object.
- placehold for the future 'derive' and 'can_do' handles.
2012-05-22 17:18:00 +02:00
Viktor Tarasov d1cf65754b pkcs11: no more 'hacked' mode and 'onepin' module version
'OnePIN' version of opensc-pkcs11 module is not installed.
Instead, in the 'pkcs11' section of OpenSC configuration,
there is a possibility to define in a different manner
how to create slots for the present PINs and applications.
2012-05-21 19:19:38 +02:00
Peter Marschall 38be3c1a4a opensc-explorer: better names for some functions 2012-05-20 18:20:24 +02:00
Peter Marschall 1f70902da5 opensc-explorer: add 'echo' command
Add 'echo' command that simply displays its arguments.

With the recently committed script interpreter feature and this echo command,
nice litte scripts can be written, like e.g.

 $ cat opengpg-userinfo
 #!/usr/bin/opensc-explorer
 cd 0065
 echo Name:
 cat 005B
 echo Language:
 cat 5F2D
 echo Gender:
 cat 5F35
 quit
2012-05-20 18:19:48 +02:00
Peter Marschall f8f02dbd65 opensc-explorer: allow acting as script interpreter
Take a filename as argument and interpret the commands in it.
2012-05-20 17:12:14 +02:00
Peter Marschall 69e9861ddd OpenPGP: first go at openpgp-tool 2012-05-20 00:00:14 +02:00
Viktor Tarasov 4b745f51af openpgp: 'ushort' type not defined for WIN32
Change-Id: Ifb28730af2d39440721be9d1e38ea1c6106167a2
2012-05-16 23:14:42 +02:00
Diego Elio Pettenò e88c08d138 build: allow cross-compilation build by reordering libraries' order.
If the system libraries are set before the locally built libraries,
libtool will pick the system copy of OpenSC instead of the local one,
and that can make cross-builds fail badly.

This patch is already applied in Gentoo for proper building.
2012-05-16 17:18:38 +02:00
Diego Elio Pettenò 3c324b8b73 build: fix parallel install by creating directory in the rule
Relying on the rule that creates the directory is a bad idea to be
parallel safe.
2012-05-16 17:18:38 +02:00
Peter Marschall 07d51bea36 OpenPGP: get PKCS#15 token info from preparsed card data
Determine data for sc_pkcs15_card's tokeninfo structure
from sc_pkcs15_card's card structure.
This makes sure the two stay consistent as much as possible.
2012-05-16 17:01:09 +02:00
Peter Marschall 7b4532736e OpenPGP: set version for PKCS#15 2012-05-16 17:01:09 +02:00
Peter Marschall bc0949140d OpenPGP: format paths more nicely 2012-05-16 17:01:09 +02:00
Peter Marschall 0283a6f24e OpenPGP: only add keys with legal algorithm identifier 2012-05-16 17:01:09 +02:00
Peter Marschall 671ac54b71 OpenPGP: more data driven logic
Tie together in a struct what belongs together instead of relying
on the ordering of multiple unrelated arrays.
2012-05-16 17:01:09 +02:00
Peter Marschall 076a4ed2dc OpenPGP: slight cleanup
Use typedef'd types instead of their underlying structs,
use helper functions instead of reinventing the wheel,
and fix typos.
2012-05-16 17:01:09 +02:00