Commit Graph

945 Commits

Author SHA1 Message Date
andre 5481e61dad cardos-tool.c: According to ANSI C the type of size_t is always an unsigned type.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5009 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-31 00:00:00 +00:00
vtarasov 5a9e4b1ca6 pkcs15-tool: minor change of the private key info layout
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5000 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-30 12:29:29 +00:00
andre 02c4f1ec77 pkcs11-tool.c: Avoid compiler warning 'may be used uninitialized in this function'.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4968 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-18 00:44:12 +00:00
andre b7fad04e10 pkcs11-tool.c: Simplifies interface to show_key() and avoids more compiler warnings.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4967 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-17 23:02:03 +00:00
andre 548630971e pkcs11-tool: replaced OPENSSL_NO_EDSA with OPENSSL_NO_ECDSA
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4922 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 16:28:26 +00:00
vtarasov e353c1bf2f win32: 'netkey' and 'westcos' tools are OpenSSL dependents
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4919 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 15:20:19 +00:00
martin b5f329ba7c tools: EC(DSA) requires OpenSSL >= 0.9.8.
This fixes building for OS X 10.5.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4918 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 14:41:15 +00:00
dengert 3cfcb5cdc6 Minor corrections to r4906
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4907 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-03 15:44:29 +00:00
dengert b7f4537031 Test for OPENSSL_NO_EC as some systems build OPENSSL without EC.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4906 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-03 15:15:29 +00:00
dengert c2fe4609a9 Modifications to support EC and ECDSA for
emulated cards. True PKCS#15 cards with EC 
will need additional changes. 

Main changes are in framework-pkcs15.c, mechanism.c,
padding.c, pkcs15-algo.c and pkcs15-sec.c 
where switch statements for key type, and testing
of flags was modified to make it easier to add 
additional key types in the future. 

The code was tested using RSA and ECDSA using a PIV card 
from pkcs11-tool, OpenSSL and Thunderbird with 
modifications to NSS-3.12.7 to get ECDSA to sign e-mail. 

Only named curves are supported for ECDSA, ECDH is still 
needed. pkcs11-tool has only minimal changes need to work 
with the -O option to list EC keys. 

One additional line was added to pkcs15-sec.c which 
should get GOSTR sign to work. 

libp11 and engine do not yet have EC support. 

 --This line, and those below, will be ignored--

M    src/tools/piv-tool.c
M    src/tools/pkcs11-tool.c
M    src/pkcs11/framework-pkcs15.c
M    src/pkcs11/mechanism.c
M    src/pkcs11/pkcs11-object.c
M    src/libopensc/pkcs15-prkey.c
M    src/libopensc/card-piv.c
M    src/libopensc/padding.c
M    src/libopensc/cardctl.h
M    src/libopensc/pkcs15-algo.c
M    src/libopensc/libopensc.exports
M    src/libopensc/pkcs15-piv.c
M    src/libopensc/pkcs15-sec.c


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4904 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-01 20:08:42 +00:00
martin 113dfda494 EstEID: add support for v 3.0 cards with 2048b keys
* Detect different cards based on ATR-s and on card objects
 * Set the card name from the ATR table
 * Conditionally add support for 2048b keys
 * Add workarounds for broken MULTOS and JavaCard cards.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4893 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 14:22:01 +00:00
andre fd11c909bd pkcs11-tool: Completing the output of "Mechanism Information Flags".
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4885 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-28 23:46:12 +00:00
andre 146041fcee pkcs11-tool: Correcting the behaviour in the case where C_SignUpdate fails. Quotation from PKCS#11:
"A call to C_SignUpdate which results in an error terminates the current signature operation."

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4884 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-28 22:16:50 +00:00
andre b63a601666 pkcs11-tool: Use attributes MODULUS and PUBLIC_EXPONENT instead of VALUE to retrieve RSA-Public-Key. The first two attributes are valid whereas the latter is not.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4883 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-28 18:09:30 +00:00
andre bcef13cfd2 In login() the flag CKF_LOGIN_REQUIRED is now ignored. This makes the behaviour of login() more predictable. If parameter --login is specified on the command line, then C_Login() is always called.fixes #220
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4875 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-18 14:56:26 +00:00
ludovic.rousseau 07ccc3965e pkcs15-tool.c: In function ‘verify_pin’:
pkcs15-tool.c:976: warning: declaration of ‘r’ shadows a previous local
pkcs15-tool.c:972: warning: shadowed declaration is here


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4867 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 17:05:32 +00:00
ludovic.rousseau 8dd3b98b1d pkcs15-tool.c:150: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:151: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:152: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:153: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:154: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:155: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:156: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:157: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:158: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:159: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:160: warning: initialization discards qualifiers from pointer target type


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4866 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 17:04:04 +00:00
ludovic.rousseau 3c12d20bfa piv-tool.c: In function ‘gen_key’:
piv-tool.c:292: warning: declaration of ‘newkey’ shadows a global declaration
piv-tool.c:97: warning: shadowed declaration is here
piv-tool.c: At top level:
piv-tool.c:97: warning: ‘newkey’ defined but not used


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4865 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 17:01:17 +00:00
ludovic.rousseau f841b88e06 opensc-explorer.c:89: warning: function declaration isn’t a prototype
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4860 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 16:53:11 +00:00
dengert 641ea4eddd Fix compile warning message.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4852 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-01 15:44:17 +00:00
dengert bd93b97674 Additianl changes to r4805 which made cert->pubkey a pointer to sc_pkcs15_pubkey_t
Thanks to Andre Zepezauer for pointing out most of these. 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4828 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-25 20:58:02 +00:00
s 150d26d51e fix: opensc-tool: invalid output of access control for EF (add to r4509)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4826 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-23 06:54:56 +00:00
martin fa0e236881 Missed these from r4818
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4820 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-20 12:33:07 +00:00
martin 6a750e6cc0 tools: -v sets ctx->debug only if set more than once. -vv also makes the debug go to stderr.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4818 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-20 07:53:19 +00:00
martin 364ba4882d pkcs11-tool: handle non-recognized tokens gracefully.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4803 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-08 08:36:56 +00:00
martin fad0116fef pkcs11-tool: if no slot is specified on the command line, try to locate a slot with a token.
A modified patch from Andre Zepezauer.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4802 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-08 08:36:48 +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
martin b060049fa4 opensc-tool: don't print reader driver (only one is enabled by default), instead print the presence of a card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4782 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 14:58:22 +00:00
dengert e9d1f10084 PIV support for NIST 800-73-3 objects,
PIV driver client can build and run without OpenSSL,
(admin functions and piv-tool still need OpenSSL)
define PIV specific ctrl codes and structures.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4767 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-24 20:37:22 +00:00
martin f339f9ba77 pkcs11-tool: only do hotplug testing before other activities.
Thanks to Andre Zepezauer for noticing.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4765 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-24 07:24:43 +00:00
viktor.tarasov 652a1801e0 opensc-explorer: to use AID of maximal allowed length in 'cd' command
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4754 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-22 11:46:33 +00:00
martin 3202355fa3 pkcs11-tool: print the token before asking for a PIN code; shorten CKU_CONTEXT_SPECIFIC prompt
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4751 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 16:11:49 +00:00
martin 01931d6794 pkcs11-tool: do --test even without a slot, at least hotplug. print a proper error name for C_GetSlotInfo
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4750 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 16:11:44 +00:00
martin 294a8bca3d pkcs11-tool: pkcs11-tool --verbose does not affect OpenSC debugging. Document a workaround
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4748 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 16:11:36 +00:00
martin 50952cdcba pkcs11-tool: cleanup whitespace and remove unused OpenSSL ERR_* calls.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4747 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 16:11:31 +00:00
martin 2dff969e05 pkcs11-tool: better separation between opaqe slot IDs and slot list indexes.
--slot will take the actual CK_SLOT_ID
--slot-label will use the token label to find the correct slot
--slot-index will use the N-th slot from the list returned by C_GetSlotList

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4746 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 16:11:26 +00:00
martin a404370f0c pkcs15-tool: harmonize and align the output of --dump
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4738 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-20 23:10:29 +00:00
martin 09fb4468d0 pkcs15-tool: only print Auth ID if present
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4737 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-20 23:10:23 +00:00
martin 215b3fc056 pkcs15-tool: pretty-print common object flags.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4736 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-20 23:10:16 +00:00
martin 53c3c486af MacInstaller: statically link libltdl for 10.5, as 10.5 PPC comes without the necessary .dylib (i386 has it)
Thanks to Kalev Lember for the original patch.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4735 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-20 15:01:45 +00:00
viktor.tarasov 8aa2a64261 opensc tools: to be compiled with Visual Studio
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4716 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-13 08:08:42 +00:00
martin 72d961beb2 Fix #216: initial go with multiple reader subsystem removal.
* One sc_context has only a single reader driver.
 * remove dynamic reader driver loading capabilities
 * remove opensc-tool -R command
 * change the internal API, we don't need to pass around a "driver data" pointer as it can be found directly from the context.
 * check in ./configure for only a single enabled reader driver

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4709 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-11 13:00:47 +00:00
martin 7a66f4e339 pkcs11-tool: recognize user PIN related token flags
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4691 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 16:53:02 +00:00
ep f5ef30bdd7 Pass SFI as an appropriately-sized number
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4676 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 22:58:31 +00:00
martin 49577941d6 Fixup for #102: also in command help.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4675 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 18:23:49 +00:00
viktor.tarasov 0285264af5 #73: pkcs15-tool: when changing PIN, print message if no PIN value supplied
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4658 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-30 16:37:15 +00:00
martin b4f9ac456a pkcs15-init: fix leftover from [4646]
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4656 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-27 09:28:42 +00:00
martin 9a63e03e9a pkcs11/pkcs15-init: remove automagic software key generation. Remove software based secret key handling from PKCS#11.
Support for importing cleartext keys is left untouched, but all transparent key generation by either opensc-pkcs11.so or pkcs15-init is removed, to make the operation with cleartext keys visible to the user and his explicit wish.
OpenSC is a PKCS#11 library for accessing keys protected by a smart card. Key material in software is not protected by smart cards and can leave a false sense of security to the user.

http://www.opensc-project.org/pipermail/opensc-devel/2010-April/013877.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4646 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-23 14:47:07 +00:00
ep 6474853217 Support reading record files by SFI
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4641 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-21 20:12:59 +00:00
ep cba47b33bf Only free current_file if it is set
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4640 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-21 20:12:56 +00:00
ep fd396a0546 Refactored the "select the file referenced by current_path; die on error" idiom in opensc-explorer.
This version, additionally, skips this step entirely if there is no current_path; this is useful when starting with --mf "".

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4638 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-20 22:51:42 +00:00
ep 4e726bd09b Fix and document opensc-explorer's new -m, --mf option
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4637 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-20 22:51:39 +00:00
ludovic.rousseau f47416d60e Do not cast the return value of malloc(3) and calloc(3)
From http://en.wikipedia.org/wiki/Malloc#Casting_and_type_safety
" Casting and type safety

malloc returns a void pointer (void *), which indicates that it is a
pointer to a region of unknown data type. One may "cast" (see type
conversion) this pointer to a specific type, as in

int *ptr = (int*)malloc(10 * sizeof (int));

When using C, this is considered bad practice; it is redundant under the
C standard. Moreover, putting in a cast may mask failure to include the
header stdlib.h, in which the prototype for malloc is found. In the
absence of a prototype for malloc, the C compiler will assume that
malloc returns an int, and will issue a warning in a context such as the
above, provided the error is not masked by a cast. On certain
architectures and data models (such as LP64 on 64 bit systems, where
long and pointers are 64 bit and int is 32 bit), this error can actually
result in undefined behavior, as the implicitly declared malloc returns
a 32 bit value whereas the actually defined function returns a 64 bit
value. Depending on calling conventions and memory layout, this may
result in stack smashing.

The returned pointer need not be explicitly cast to a more specific
pointer type, since ANSI C defines an implicit conversion between the
void pointer type and other pointers to objects. An explicit cast of
malloc's return value is sometimes performed because malloc originally
returned a char *, but this cast is unnecessary in standard C
code.[4][5] Omitting the cast, however, creates an incompatibility with
C++, which does require it.

The lack of a specific pointer type returned from malloc is type-unsafe
behaviour: malloc allocates based on byte count but not on type. This
distinguishes it from the C++ new operator that returns a pointer whose
type relies on the operand. (see C Type Safety). "

See also
http://www.opensc-project.org/pipermail/opensc-devel/2010-August/014586.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4636 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-18 15:08:51 +00:00
ep b279287701 strlcat(3) implementation
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4634 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-18 13:42:26 +00:00
martin 409284ed60 opensc-tool: Fix ACL reporting for EF-s. Patch by Emanuele Pucciarelli.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4623 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-14 12:18:27 +00:00
martin 11dc9ba797 cardos-tool: fix handing of --help/--verbose/--debug
--debug was not documented and not used by other tools; --help was not handled.

Thanks to Ludolf Holzheid for noticing this.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4596 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-26 11:18:00 +00:00
martin 002843c140 pkcs15-init: fix help text ordering (Ludolf Holzheid)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4595 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-26 11:17:57 +00:00
viktor.tarasov 13a42de128 pkcs11 tool: fix messages
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4593 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-21 09:50:10 +00:00
viktor.tarasov 3a3c41a6db pkcs15: encode/decode 'AccessControlRules' in 'CommonObjectAttributes'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4515 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-06 09:09:04 +00:00
viktor.tarasov 1090d19d30 #60: pkcs11-tool: print key sizes from CK_MECHANISM_INFO
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4513 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-05 14:43:31 +00:00
viktor.tarasov ae14336221 pkcs15init: create frame to implement card specific 'sanity check' procedure
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4508 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-02 14:26:29 +00:00
viktor.tarasov 765ea98cfb tools opensc-explorer: for 'apdu' command accept space separated hexadecimal data
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4500 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-01 12:31:52 +00:00
martin bcc4500f24 pkcs15-init: only override --verbose to ctx->debug if it was set on command line.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4423 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-16 21:04:36 +00:00
martin d40da986db Revert "pkcs15-init tool: with the new option 'use-default-debug-settings' the debug settings from opensc.conf are used"
This reverts commit b7d492fbae.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4422 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-16 15:08:14 +00:00
martin df64d39f68 westcos-tool: remove compiler warnings
westcos-tool.c: In function ‘main’:
westcos-tool.c:375: warning: unused variable ‘lecteur’
westcos-tool.c:373: warning: unused variable ‘card_presente’
westcos-tool.c:372: warning: unused variable ‘p’
westcos-tool.c:371: warning: unused variable ‘i’
westcos-tool.c: At top level:
westcos-tool.c:43: warning: ‘version’ defined but not used
westcos-tool.c:45: warning: ‘nom_card’ defined but not used
westcos-tool.c:103: warning: ‘no_lecteur’ defined but not used

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4420 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-16 14:11:39 +00:00
martin 3cfc64ee6b style: // -> /* */
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4412 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-11 07:35:45 +00:00
jps f9daf30bba cardos-tool.c can be now compiled with OpenSSL 0.9.7 (SHA256 checksum verification is replaced by SHA1)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4401 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-08 14:41:49 +00:00
martin 127136caf8 tools: Mac OS X 10.5 uses OpenSSL 0.9.7 which does not include SHA256 support. Fix building for 10.5.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4400 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-08 10:45:07 +00:00
viktor.tarasov fec213ad2e pkcs11: DER encoded value for CKA_SERIAL_NUMBER
discussed in http://www.opensc-project.org/pipermail/opensc-devel/2010-May/014264.html



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4375 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-25 08:06:28 +00:00
viktor.tarasov 73c516a7a0 pkcs11: resolve 'endless polling' in C_WaitForSlotEvent()
http://www.opensc-project.org/pipermail/opensc-devel/2010-April/013947.html

Tested with Firefox 3.6.3 in WinXP SP3 .




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4363 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-19 09:18:38 +00:00
flc 6f1683d7bd wetcos-tools: add util.c to compile.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4339 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-11 14:40:10 +00:00
flc 5ae92ebcec clean some code and use more opensc standard
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4336 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-11 14:34:39 +00:00
flc a4df57eb4d --wait option don't need argument
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4335 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-11 14:30:15 +00:00
viktor.tarasov ac41eba3ac win32: merge the branches/vtarasov/opensc-sm.trunk
update win32 compilation;
Unix style line ending in src/pkcs15init/pkcs15-oberthur.h;
variables declaration issue in src/tools/cardos-tool.c.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4280 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-01 12:15:36 +00:00
viktor.tarasov f505d4f5be pkcs15-init tool: remove blank line after PIN was prompted
Noted by Martin.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4273 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-28 09:20:19 +00:00
viktor.tarasov f17ca0fd74 tools: in local 'getpass' procedure getline() is not used any more
Without GNU C extention 'getline()' the same code of the local 'getpass' procedure is used for Mac OS and Linux.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4272 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-28 09:20:18 +00:00
viktor.tarasov 7d5b34d4e8 tools: thanks to Andreas; for win32 'get password' procedure uses _getch() instead of getchar()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4268 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-27 07:30:38 +00:00
viktor.tarasov 25fa645b90 pkcd15-tool: use local 'getpass' procedure
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4267 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-26 12:29:44 +00:00
viktor.tarasov 122d357fde tools: thanks to Ludovic; check for getline() in configure.ac and use 'HAVE_GETLINE' macro in get password procedure.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4266 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-26 12:29:42 +00:00
jps aa4d951101 Support for CardOS 4.4
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4264 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-21 14:38:23 +00:00
viktor.tarasov 34841669a2 fix #118: thanks to Andreas: list algorithms in opensc-tool
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4260 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-20 15:43:44 +00:00
viktor.tarasov b7d492fbae pkcs15-init tool: with the new option 'use-default-debug-settings' the debug settings from opensc.conf are used
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4258 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-19 12:13:16 +00:00
viktor.tarasov 07c98da3a8 pkcs15-init: #101: use PIN object's label in the PIN prompt
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4254 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-18 16:01:13 +00:00
viktor.tarasov 3c813ce57b pkcs15-init tool: use Ctrl-C sensible 'getpass'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4252 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-18 09:45:44 +00:00
viktor.tarasov a10bf0e356 pkcs11-tool: #120: use 'getpass' sensible to Ctrl-C, thanks to Andreas
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4251 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-18 08:32:35 +00:00
viktor.tarasov d0618ba24c tools: #120: 'getpass' sensible to Ctrl-C, thanks to Andreas
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4249 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-18 07:47:16 +00:00
viktor.tarasov f7575879cc pkcs11-tool: useless assignment
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4248 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-18 07:30:21 +00:00
viktor.tarasov ce485e4895 pkcs11-tool: fix #124; thanks to Thomas Harnings: for the signature tests cannot be used private key without corresponding public key or certificate
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4247 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-17 19:59:32 +00:00
martin be43ca7bb2 Remove cardos-info (renamed to cardos-tool in 2008)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4234 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-13 11:29:53 +00:00
martin a20fa13922 pkcs15-init: remove dead code
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4233 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-13 11:29:50 +00:00
martin 75df8e9d2a piv-tool: remove dead code.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4232 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-13 11:29:45 +00:00
martin 349b31ecf3 westcos-tool: fix header, the file is .c not .exe
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4230 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-13 11:29:37 +00:00
martin f63e2eef4b cryptoflex-tool: remove dead code from 2002
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4229 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-13 11:29:33 +00:00
martin 57c38d94ad cryptoflex-tool: remove dead code.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4228 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-13 11:29:27 +00:00
martin f161552890 netkey-tool: The tool is included in OpenSC, no need to have a compilation tip in the file header.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4227 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-13 11:29:21 +00:00
martin c73aaf990a pkcs15-tool: fix help text, reader must no be a number
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4226 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-13 11:29:17 +00:00
martin 119546e7bc cryptoflex-tool: use the code in util.c to connect to the card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4225 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-13 11:29:12 +00:00
martin 9361c956ad pkcs15-crypt: remove useless #if 1
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4224 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-13 11:29:08 +00:00
martin 7720f3759c eidenv: remove a redundant sc_lock call, already done in util.c
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4223 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-13 11:29:03 +00:00
martin 5b40b0eb0c pkcs15-tool: Remove a redundant sc_lock/sc_unlock pair
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4222 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-13 11:28:59 +00:00
viktor.tarasov 741d8fc0b8 pkcs11-tool: #75: key for signature can be selected by object_id
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4214 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-11 17:44:39 +00:00
martin 379519e84e Revert r4191 "Fix logic in pkcs15-tool/pkcs15-init -v"
This reverts commit a61f619296.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4206 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-02 13:11:07 +00:00
martin d1d47d44c5 Fix #198: set correct access flags to private keys
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4193 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-01 14:16:43 +00:00
martin cd83821502 Don't use sc_debug in src/tools/*, use fprintf(stderr) instead.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4192 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-01 14:16:23 +00:00
martin a61f619296 Fix logic in pkcs15-tool/pkcs15-init -v
Only override ctx->debug if -v given.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4191 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-01 13:44:02 +00:00
ludovic.rousseau 629aef2ee8 Use an argument to cardos_format()
Thanks to Andreas Jellinghaus for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2010-March/013849.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4190 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-01 11:21:57 +00:00
martin 8323182d4a Remove leftover from r4113, allow easy side-by-side comparison
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4189 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-01 10:14:22 +00:00
ludovic.rousseau 502db6bd36 Do not cast a pointer to a type of possibly different size.
Would fail on PowerPC in 64-bits for example.

pkcs15-crypt.c: In function ‘sign_ext’:
pkcs15-crypt.c:293: warning: dereferencing type-punned pointer will break strict-aliasing rules
pkcs15-crypt.c:299: warning: dereferencing type-punned pointer will break strict-aliasing rules


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4183 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-29 14:10:17 +00:00
ludovic.rousseau ad648c4a18 Use the correct type (const_DES_cblock *) instead of (const_DES_cblock)
for DES_ecb_encrypt() input and output parameters.

I have no idea how it could have worked.

Fix
cardos-tool.c: In function ‘cardos_sm4h’:
cardos-tool.c:421: warning: passing argument 1 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:421: warning: passing argument 2 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:426: warning: passing argument 1 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:426: warning: passing argument 2 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:432: warning: passing argument 1 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:432: warning: passing argument 2 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:434: warning: passing argument 1 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:434: warning: passing argument 2 of ‘DES_ecb_encrypt’ from incompatible pointer type
cardos-tool.c:472: warning: passing argument 1 of ‘DES_ecb3_encrypt’ from incompatible pointer type
cardos-tool.c:472: warning: passing argument 2 of ‘DES_ecb3_encrypt’ from incompatible pointer type
cardos-tool.c:483: warning: passing argument 1 of ‘DES_ecb3_encrypt’ from incompatible pointer type
cardos-tool.c:483: warning: passing argument 2 of ‘DES_ecb3_encrypt’ from incompatible pointer type


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4181 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-29 12:55:13 +00:00
ludovic.rousseau 4ce1e8c831 Rename parameter wait in do_wait
util.c:11: warning: declaration of ‘wait’ shadows a global declaration
/usr/include/sys/wait.h:255: warning: shadowed declaration is here


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4180 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-29 08:23:07 +00:00
ludovic.rousseau cf8a7f894f use a (const char *) for the reader_id and fix 2 warnings
opensc-explorer.c:1606: warning: passing argument 3 of
‘util_connect_card’ discards qualifiers from pointer target type
rutoken-tool.c:492: warning: passing argument 3 of ‘util_connect_card’
discards qualifiers from pointer target type


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4179 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-29 08:20:27 +00:00
ludovic.rousseau d24de6ab58 Fix
piv-tool.c: In function ‘load_object’:
piv-tool.c:130: warning: implicit declaration of function ‘sc_asn1_find_tag’
piv-tool.c:130: warning: nested extern declaration of ‘sc_asn1_find_tag’
piv-tool.c:130: warning: cast from function call of type ‘int’ to non-matching type ‘u8 *’
piv-tool.c:130: warning: cast to pointer from integer of different size


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4178 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-29 08:13:55 +00:00
ludovic.rousseau 6946e513da Fix piv-tool.c:216: warning: suggest parentheses around comparison in
operand of |


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4177 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-29 08:11:32 +00:00
ludovic.rousseau 6add573782 Do not cast to a possibly different type size.
Would fail on PowerPC in 64-bits for example.

Fix pkcs11-tool.c:2954: warning: dereferencing type-punned pointer will
break strict-aliasing rules


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4174 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-28 20:40:13 +00:00
ludovic.rousseau 5be62d9d67 Use a "const char *" to store a const C-string ptr.
Fix
pkcs11-tool.c:1899: warning: assignment discards qualifiers from pointer target type
pkcs11-tool.c:1902: warning: assignment discards qualifiers from pointer target type
pkcs11-tool.c:1906: warning: assignment discards qualifiers from pointer target type
pkcs11-tool.c:1910: warning: assignment discards qualifiers from pointer target type
pkcs11-tool.c:1914: warning: assignment discards qualifiers from pointer target type
pkcs11-tool.c:1918: warning: assignment discards qualifiers from pointer target type
pkcs11-tool.c:1922: warning: assignment discards qualifiers from pointer target type


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4173 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-28 20:30:25 +00:00
ludovic.rousseau 0c60be861c Use a "const char *" to store a const C-string ptr.
Fix
westcos-tool.c:41: warning: initialization discards qualifiers from pointer target type
westcos-tool.c:43: warning: initialization discards qualifiers from pointer target type


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4168 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-28 19:57:24 +00:00
ludovic.rousseau cd89cb31cf Use a "const char *" to store a const C-string ptr.
Fix
netkey-tool.c:43: warning: initialization discards qualifiers from pointer target type
netkey-tool.c:63: warning: initialization discards qualifiers from pointer target type


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4167 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-28 19:55:39 +00:00
ludovic.rousseau 2b57feadf2 Use a temporary variable to not lose negative values (errors)
Fix
westcos-tool.c:591: warning: comparison of unsigned expression < 0 is always false
westcos-tool.c:615: warning: comparison of unsigned expression < 0 is always false


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4166 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-28 16:15:26 +00:00
ludovic.rousseau 30b7888c34 Remove unused variables. Fix warning: unused variable
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4157 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-28 11:43:17 +00:00
ludovic.rousseau 9b73e45a07 Fix westcos-tool.c:322: warning: no previous prototype for ‘usage’
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4146 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-28 08:33:14 +00:00
viktor.tarasov 42b90f8ada pkcs11-tool: to be compiled without OpenSSL
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4136 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-18 10:49:53 +00:00
viktor.tarasov e214ba206c pkcs15init: emulation API
Four method are added to the 'sc_pkcs15init_operations':
emu_update_dir		-- create or not the DIR file;
emu_update_any_df	-- update the non-pkcs15 descriptors that are equivalents to pkcs15 xDF files;
emu_update_tokeninfo	-- update analog of tokenInfo;
emu_write_info		-- to not create OPENSC-INFO file;


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4128 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-18 09:10:51 +00:00
viktor.tarasov a17e519708 pkcs15-tool: 'verify-pin' is not an action
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4127 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-17 18:24:26 +00:00
viktor.tarasov e0f39c529c pkcs15-init tool: make possible pin verification immidiately after card was binded
It's implemented for the card with emulated pkcs#15 and protected private object attributes.

Update to man pages is comming soon.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4126 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-17 18:16:27 +00:00
aj 84934adab9 don't complain about missing "--slot" parameter, when you don't
need it (if you only "--list-slots").


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4122 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-16 14:59:20 +00:00
aj 5972022ffc Add code to write pubkey objects to pkcs11-tool.
By: Jaroslav Benkovský <jaroslav.benkovsky@nic.cz>

Slightly modified by me.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4121 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-16 14:11:39 +00:00
viktor.tarasov c74016b8cc fix #202: pkcs15-tool: print message when there is PIN verify error
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4119 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-15 17:58:17 +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 0fdb4478bc On blank, but otherwise perfectly supported card, we get an error here
(with "Unsupported card"). This needs to be improved.

This patch changes the "initialization" to "binding", so we at least
can tell people: you need to initialized an empty card first.
Needs to be improved of course.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4117 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-15 10:34:18 +00:00
aj 02768fb5dc remove "split-key" option and emulat sign for sign,decrypt keys with padding
and decrypt() for cardos.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4113 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-13 22:52:51 +00:00
aj 5bc11ac39c Redirect output to file given by "--output" / "-o" option. Closes bug #200.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4112 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-13 22:47:58 +00:00
aj c1bb3ae9cd compile tools with PTHREAD so we can debug them in GDB.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4111 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-13 22:26:07 +00:00
viktor.tarasov f9b27b1699 pkcs15-tool: 'pkcs15_pin_info' parameter replaced by 'pkcs15_object'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4107 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-11 13:00:07 +00:00
martin 72a9d8e58f pkcs15-init: sign key usage shortcut does not expand to non-repudiation.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4106 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-11 11:23:47 +00:00
viktor.tarasov 052881c38f libopensc: in pkcs15 PIN commands 'pin_info' parameter replaced by 'pin_object'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4103 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-10 09:23:01 +00:00
viktor.tarasov 93210eae9f pkcs15-tool: add 'verify-pin' option" src/tools/pkcs15-tool.c
Implemented to have the possibility to verify PIN after binding of the pkcs15 card and before any 'substantial' operation.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4093 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-09 14:51:48 +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
flc 7a48d4a6f2 add support for westcos card with crypto component and minor renames to westcos-tool
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4072 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-25 15:16:23 +00:00
viktor.tarasov 535131adda pkcs15init: instead of static keycache use the pincache as a content of the pkcs15 AUTH object
Tested with cards:
CardOS v4.3B;
SetCOS 4.4.1B;
Oberthur;
Cryptoflex 16k, 32k e-gate, 32k e-gate token;
GPK 8K;
Athena;
Aventra;
Fetian;
Rainbow 3000 (STARCOS SPK 2.3)




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4058 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-21 18:24:41 +00:00
martin ba4b02e098 pkcs15-init: don't suggest using --erase-card with --create-pkcs15 in help message.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4053 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-21 09:09:33 +00:00
viktor.tarasov 0330993a61 pkcs15-init tool: simplify 'pristine' test - it's ok if MF, DIR or PKCS15-AppDF is not selectable
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4014 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-11 12:14:03 +00:00
aj 9406ce2885 Updated piv driver by Douglas E. Engert:
the PIV driver no longer need to set the card max_*_size parameters
   to get around emulating read_binary and write_binary. It can
   now handle partial reads and writes.

   The assumptions for write_binary are that the first chuck will
   have idx = 0, and the last chunk will write the last byte.
   The flags parameter will contain the total length.

   The only write_binary operations are done when initializing
   a card, and this is only done from piv-tool.c which was modified
   to pass in the length and other flags.

   Piv-tool continues to be a primative test tool for inializing test
   cards. But it has been expanded to be able to write other objects
   on test cards.

   The serial number of a PIV  card is obtained from the CHUID object
   if present which has a FASC-N which is an ID number created by the
   issuer. Normally PIV cards are issued the U.S. Federal government
   But there are ways to use the same cards with a non government CA.
   This is then be referred to as PIV Compatible. In this case,
   the FASC-N should start with an agency code = 9999 and an RFC 4122
   GUID should be present in the CHUID. If this is the case, the GUID
   is used as the serial number.

   Windows 7 comes with a PIV card card driver, but to get it use one of
   these card the CHUID is required. (piv-tool can now write one.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3998 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-05 06:16:37 +00:00
aj de05af6632 fold ui.c/h into pkcs15-init.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3994 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-04 06:33:33 +00:00
aj b113b90000 remove ui code from library.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3992 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-04 06:19:52 +00:00
martin b3428a684d [tools] If started with --wait, also wait for a reader if necessary.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3988 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-03 09:58:37 +00:00
alonbl a6f9f023a0 [WINDOWS] Remove tool specific file description support resource file
The implementation was based on the previous MSC build, each tool had its own
description in version resource.

This change sets a single version resource to all files, and produces much
simpler build.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3980 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-02 14:50:42 +00:00
aj ac9f672189 update windows makefiles: only create one dll.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3973 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-01 15:22:28 +00:00
aj 4b2fe63ac2 build only one shared library instead of many.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3971 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-01 15:12:53 +00:00
aj 72d5ebb79c make erase incompatible with all other actions.
thus we don't need to worry about if the pin/so-pin was passed
for the old structures (before erase) or the new ones (if used
with create).


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3966 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-30 19:25:22 +00:00
viktor.tarasov 8aa2128423 pkcs15-init tool: don't ask for PUK value when creating PIN with 'unblock-disabled' in flags
- prepare pkcs15-init tool for creating a pkcs15 PinObject for PUK.




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3948 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-27 17:38:43 +00:00
viktor.tarasov 4662812e93 pkcs15-init tool: when importing bunch of certificates, break after the first error
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3938 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-25 15:53:29 +00:00
viktor.tarasov 97d5b3e6e7 sorry, commit by error; reverting back to r3935
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3937 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-25 15:30:33 +00:00
viktor.tarasov 6e9c7e5619 pkcs15-init tool: when importing bunch of certificate, break after the first errorsrc/tools/pkcs15-init.c
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3936 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-25 15:11:35 +00:00
martin 5a0cc50123 tools: remove slots; implement change in sc_disconnect_card(); convert util_connect_card()/--wait to support the changes in r3931
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3933 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-24 15:29:47 +00:00
martin 561507769a tools: cardos-tool uses OpenSSL, link against it.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3924 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-22 12:11:41 +00:00
viktor.tarasov 54ee99d486 pkcs15init: use pinpad
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3917 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-17 21:08:13 +00:00
martin 875fe4a50f pkcs11-tool: test hotplug partial commit fix + make a slot ID mandatory and parse it as an unsigned long, not int.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3911 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-15 09:36:00 +00:00
martin c5effc32c3 pkcs11-tool: test hotplugging and events (C_GetSlotList/C_WaitForSlotEvent) before others tests and only if --hotplug is given
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3910 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-15 09:33:27 +00:00
martin cc5c03197d pkcs11-tool: Check for CKA_ALWAYS_AUTHENTICATE and CKU_CONTEXT_SPECIFIC login for --test operations.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3909 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-15 09:27:17 +00:00
martin e595042474 pkcs11-tool: Call C_Finalize when a fatal error happens. (Otherwise OSX pcsc locks up)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3908 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-15 09:22:03 +00:00
viktor.tarasov e2dae6b97b Unlock User PIN with PKCS#11:
One of the three unblock methods can be activated from the 'opensc-pkcs11' section of opensc.conf:
- C_SetPin() in the unlogged sesssion;
- C_SetPin() in the CKU_SPECIFIC_CONTEXT session;
- C_InitPin() in CKU_SO session (inspired by Pierre Ossman).
-- This last one works, for a while, only for the pkcs15 cards without SOPIN auth object.
   For the pkcs15 cards with SOPIN, this method will be useful for the cards 
   that do not have then modes '00' and '01' of ISO command 'RESET RETRY COUNTER'.

Test commands:
# pkcs11-tool --module ./opensc-pkcs11.so --slot 0 --unlock-pin --puk "123456" --new-pin "9999"
# pkcs11-tool --module ./opensc-pkcs11.so --slot 0 --unlock-pin -l --login-type context-specific --puk "123456" --new-pin "9999"
# pkcs11-tool --module ./opensc-pkcs11.so --slot 0 --init-pin -l --new-pin "9999"



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3901 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-08 15:41:07 +00:00
viktor.tarasov 39ca6b156f pkcs15-init tool: delete both key parts when deleting splitted key
Splitted key is stored as the two private keys with the same ID.
(It's not conform to PKCS#15, but tolerated by OpenSC.)
Previously used 'sc_pkcs15_find_prkey_by_id()' is not appropriated to the case of splitted key.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3900 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-03 18:26:46 +00:00
viktor.tarasov 5bf000da18 pkcs15-tool: unblock PIN with pinpad
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3884 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 13:11:56 +00:00
viktor.tarasov 193ca76980 pkcs15-tool: change PIN with pinpad
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3883 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 12:51:12 +00:00
viktor.tarasov 44e94c8c94 opensc-explorer: remove debug messages
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3882 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 11:59:48 +00:00
aj 4730e98da1 Thomas Uhle: Just this morning I realised that there is
a minor mistake in my patch for opensc_info(). For the Sun Studio 12.1
compiler (__SUNPRO_C == 0x5100) and later versions also, it must be
(__SUNPRO_C >> 4) & 0xFF to split the micro and mask the major version
number.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3881 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 11:13:17 +00:00
viktor.tarasov 6ff96b8c66 pinpad support of PIN changing and unlocking
Oberthur and opensc-explorer


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3880 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 11:11:04 +00:00
aj b2c5ab3209 Thomas Uhle: Add information about sun compiler to opensc-tool.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3875 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 07:03:53 +00:00
aj 06aaa718cc Describe now option for --help.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3874 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-02 11:10:16 +00:00
aj 724c3485a6 remove dead code for now - easy to recreate later.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3873 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-02 11:07:45 +00:00
aj 29407cf2d8 fixed and tested by Viktor TARASOV. Thanks!
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3872 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-02 09:52:12 +00:00
aj 5b21dd6a05 basic command to change startkey,
so far untested.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3871 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-01 21:10:06 +00:00
viktor.tarasov b9935bf410 cardos-tool: invalid parsing of the 'common system keys' info
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3870 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-01 11:47:19 +00:00
s e4780e82ec add to pkcs11-tool: GOST mechanisms and GOSTR3410 key to show objects on token
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3869 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-27 11:15:33 +00:00
martin f2d6ec2c76 Always print the slot description (reader name in case of OpenSC)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3867 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-25 18:01:30 +00:00
s 56dd3ec0ea Modification Rutoken S binary interfaces by Aktiv Co. (OpenSC+Rutoken S driver for Windows works now)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3865 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-23 16:38:02 +00:00
s 5320ca6fd1 Corrected GOSTR3410 public key structure
Working now with GOST R 34.10:
$ pkcs15-init --store-private-key key --key-usage sign,decrypt --auth-id 2 --id 1 --pin "12345678"
$ pkcs15-init --store-certificate my_cert --id 1 --pin "12345678"

But have problem: no CKA_GOSTR3410_PARAMS by retrieve pub_key from certificate, if pub_key object was removed (see parse_x509_cert, asn1_decode_gostr3410_params)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3859 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-19 15:41:03 +00:00
viktor.tarasov a8dc5bdeef opensc-explorer::do_apdu() number of bytes in printed message 'Sending'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3849 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-14 21:55:17 +00:00
martin df20fe72e1 merge [3823:3844/trunk]
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3845 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-13 19:01:21 +00:00
martin 533a33521f * Update opensc-tool and opensc-explorer man pages
* Remove not implemented pksign/pkdecrypt commands from opensc-explorer. Use pkcs15-crypt instead.


git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3843 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-13 14:51:32 +00:00
martin 0eac0fb14c Fix #58: properly document "pkcs15-init -T"
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3841 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-13 12:25:18 +00:00
martin 2dfbf4f934 Fix compiler warnings
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3837 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-13 11:21:58 +00:00
martin e95b0662f6 Fix compiler warning
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3836 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-13 11:21:39 +00:00
martin bc1d4c4e06 Fix compiler warnings and a typo
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3835 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-13 11:21:09 +00:00
martin 3ea5bb7987 Merge [3804:3822/trunk]
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3824 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-13 09:45:21 +00:00
martin 30ab50600b Merged [3783:3794/trunk]
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3795 c6295689-39f2-0310-b995-f0e70906c6a9
2009-10-25 20:22:11 +00:00
martin 56fb57603b Merge [3758:3783/trunk]
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3785 c6295689-39f2-0310-b995-f0e70906c6a9
2009-10-22 09:18:16 +00:00
martin 95a5ab0654 Re-implement PIN cache on PKCS#15 layer; remove it from PKCS#11. Re-name and log PKCS#15 options to better reflect the purpose.
Data objects and PKCS#15 init are left broken currently.



git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3784 c6295689-39f2-0310-b995-f0e70906c6a9
2009-10-22 08:59:59 +00:00
martin f6d4da7919 PC/SC: Improve core and pinpad code
* Make opensc-tool -l display pinpad capabilities, if available
 * Detect reader capabilities when a reader is found, not when a connection to a card is opened
 * Fix unpadded PIN block parameters to not be rejected by the latest free CCID driver
 * When locking the card and it has been reset by some other application (or re-attached), clear cache and lock again
 * Enable pinpad detection by default


git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3730 c6295689-39f2-0310-b995-f0e70906c6a9
2009-09-14 09:48:56 +00:00
martin 6a48771ce1 Implement CKA_ALWAYS_AUTHENTICATE
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3722 c6295689-39f2-0310-b995-f0e70906c6a9
2009-09-14 08:51:53 +00:00
martin d672fde449 Remove sc_error and sc_ctx_suppress_errors_* in favor of sc_debug/fprintf
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3721 c6295689-39f2-0310-b995-f0e70906c6a9
2009-09-14 08:46:59 +00:00
martin d3201511c7 r3717:3719 from trunk
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3720 c6295689-39f2-0310-b995-f0e70906c6a9
2009-09-12 11:46:00 +00:00
ludovic.rousseau 490d1b84aa print_file(): inverse "write" and "erase"
Thanks to Aleksey Samsonov for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2009-June/012212.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3695 c6295689-39f2-0310-b995-f0e70906c6a9
2009-06-16 09:17:53 +00:00
ludovic.rousseau 8b4a1f673b cardos_sm4h(): fix memory leaks. Thanks to cppckeck(1)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3694 c6295689-39f2-0310-b995-f0e70906c6a9
2009-05-12 14:35:49 +00:00
aj 3fa5747e33 Fix security issue.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3688 c6295689-39f2-0310-b995-f0e70906c6a9
2009-05-07 10:57:07 +00:00
ludovic.rousseau dd9a40ad0e avoid a compilation failure with --disable-openssl
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3687 c6295689-39f2-0310-b995-f0e70906c6a9
2009-05-06 16:25:50 +00:00
martin 16baddcc74 Engine API is not used.
Thanks to Robert Konklewski for noticing this.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3678 c6295689-39f2-0310-b995-f0e70906c6a9
2009-04-08 09:40:21 +00:00
ludovic.rousseau 9ef196c2cd store the generated public key on the token.
Thanks to Rickard Bondesson for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2009-February/011884.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3663 c6295689-39f2-0310-b995-f0e70906c6a9
2009-03-12 08:33:37 +00:00
alonbl 8828faeccf Allow delete data objects by specifying application-name and label
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3608 c6295689-39f2-0310-b995-f0e70906c6a9
2008-12-28 21:28:53 +00:00
martin 5b5a7d3c58 Upgrade to safe and sane values of late 2008
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3602 c6295689-39f2-0310-b995-f0e70906c6a9
2008-12-06 20:04:11 +00:00
martin de89aa47e7 Fixes #109
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3600 c6295689-39f2-0310-b995-f0e70906c6a9
2008-12-06 11:41:00 +00:00
martin a7967258aa DWIM: If you don't specify a reader on the command line and you have more than one reader (for example, OpenCT virtual readers and one existing PC/SC reader) the tools will skip to the first reader that has a card in it.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3597 c6295689-39f2-0310-b995-f0e70906c6a9
2008-12-05 15:48:49 +00:00
martin 1e41d4d267 * Fix issues with pkcs11-tool testing of C_GenerateRandom/C_SeedRandom and OpenSC PKCS#11 implementation of those functions.
Thanks goes to Rickard Bondesson who noticed the issues.

http://www.opensc-project.org/pipermail/opensc-devel/2008-November/011436.html



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3595 c6295689-39f2-0310-b995-f0e70906c6a9
2008-11-24 22:06:27 +00:00
martin 04b30cdac3 Add --list-token-slots / -T to pkcs11-tool to list only slots with tokens.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3592 c6295689-39f2-0310-b995-f0e70906c6a9
2008-11-21 22:34:31 +00:00
alonbl df74ebcdc0 Handle spaces correctly
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3577 c6295689-39f2-0310-b995-f0e70906c6a9
2008-10-04 19:52:56 +00:00
alonbl 2659c00f0d Make src/tools/cardos-info.bat DOS format
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3575 c6295689-39f2-0310-b995-f0e70906c6a9
2008-10-04 19:33:31 +00:00
alonbl 3508110177 Fixup cardos-info scripts
1. They are not binaries.
2. No need for resources.
3. Put in separate files.

Anyway, do we actually need these? why not just document
that cardos-tool should be used instead?



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3574 c6295689-39f2-0310-b995-f0e70906c6a9
2008-10-04 19:32:05 +00:00
aj a767600ee8 fix apdu length check: 0..3 is wrong (too short). 4 is ok.
5 is not (length byte for data, but no data?). 6 or more is ok
(length byte and data). checking for "5" is not important.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3573 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-22 14:36:46 +00:00
jps 042d9d06a5 An erased CardOS with a StartKey version 0xFF can now be directly formatted.
Verbose output contains now some useful data.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3572 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-22 14:21:01 +00:00
jps 8136c8b40f fix some bad crash on Mac
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3571 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-22 10:38:34 +00:00
jps 524672345b CardOS 4.2C is working too after changing Default StartKey to 16 * 0xFF
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3570 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-22 09:47:43 +00:00
jps e0d1bb5410 fixing typo
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3569 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-22 08:35:54 +00:00
aj aee10c8a13 Fix a comment and allow cardos 4.3B too.
Thanks to JP for testing.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3568 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-22 07:01:34 +00:00
aj cbf0c28d63 fix a few missing \n
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3567 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-19 10:21:14 +00:00
aj 5c29dcdb94 commit changes: cardos-info is now cardos-tool.
and it knows to format, at least some cards/tokens with cardos.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3566 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-18 17:44:54 +00:00
aj 021dfaccba rename files only.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3565 c6295689-39f2-0310-b995-f0e70906c6a9
2008-09-18 17:43:38 +00:00
aj 5ef6b5ff7d remove check for label - if you set one with "pkcs15-init -C -l your-label"
this check doesn't work correctly.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3555 c6295689-39f2-0310-b995-f0e70906c6a9
2008-08-12 14:48:54 +00:00
aj 07247596d6 Apply security fix.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3552 c6295689-39f2-0310-b995-f0e70906c6a9
2008-07-31 13:25:16 +00:00
cg2v 625d14c880 Don't free uninitialized memory if pem_encode fails.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3539 c6295689-39f2-0310-b995-f0e70906c6a9
2008-07-27 15:18:59 +00:00
aj 758adbc7ac Chaskiel Grundman:
I found the following patch to opensc-explorer handy when cleaning up 
after some failed keygens (but not all, since you can't delete private
key objects). It switches the card to the admin lifecycle at startup:


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3538 c6295689-39f2-0310-b995-f0e70906c6a9
2008-07-21 14:39:37 +00:00
alonbl 47013af374 opensc-explorer double free and cleanups
$ opensc-explorer
OpenSC Explorer version 0.11.4-svn
OpenSC [3F00]> cat
only working EFs may be read
OpenSC [3F00]> cat
only working EFs may be read
opensc-explorer: sc.c:492: sc_file_free: Assertion `sc_file_valid(file)' failed.
Aborted

$ opensc-explorer
OpenSC Explorer version 0.11.4-svn
OpenSC [3F00]> cd ff00
OpenSC [3F00/FF00]> cat
only working EFs may be read
OpenSC [3F00/FF00]> cd ..
opensc-explorer: sc.c:492: sc_file_free: Assertion `sc_file_valid(file)' failed.
Aborted

By Aktiv Co. Aleksey Samsonov
And some more Cleanups 



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3526 c6295689-39f2-0310-b995-f0e70906c6a9
2008-05-26 10:46:16 +00:00
ludovic.rousseau 91177e51ec Use size_t instead of int when needed, plus some other minor changes
Patch bug.1 included in Ticket #176


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3510 c6295689-39f2-0310-b995-f0e70906c6a9
2008-05-05 13:00:01 +00:00
ludovic.rousseau 8624796f37 use type size_t instead of int since the 3rd argument of
sc_format_asn1_entry() is void *
using int will fail on a 64-bits platform

Closes Ticket #176


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3509 c6295689-39f2-0310-b995-f0e70906c6a9
2008-05-05 09:51:39 +00:00
alonbl e237574742 Plug&Play support
This is not the best solution, but focus on smallest code change.

Changes:

1. Add detect_readers() to reader opts, this adds new readers to the end
   of the readers list until list is full.

2. Add sc_ctx_detect_readers() that calls readers' detect_readers().

3. Fixup pcsc_lock() so that it reconnect to the card and report proper
   error so caller may be notified if session was lost.

4. Allow context to be created without readers.

5. Call sc_ctx_detect_readers() from PKCS#11 C_GetSlotList with NULL_PTR.

6. Allow no reader at detect_card, as reader my be removed.

7. Since I broke ABI, I updated the external module version requirement
   to match OpenSC version. In the future a separate version should be
   maintained for each interface, this should be unrelated to the package
   version.

Alon

---

svn merge -r 3480:3505 https://www.opensc-project.org/svn/opensc/branches/alonbl/pnp

M    src/tools/opensc-tool.c
M    src/pkcs11/pkcs11-global.c
M    src/pkcs11/slot.c
M    src/libopensc/reader-pcsc.c
M    src/libopensc/internal-winscard.h
M    src/libopensc/ctx.c
M    src/libopensc/reader-ctapi.c
M    src/libopensc/libopensc.exports
M    src/libopensc/reader-openct.c
M    src/libopensc/opensc.h


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3506 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-29 17:01:19 +00:00
alonbl 6c740b907e More MSVC fixups by Douglas E. Engert
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3503 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-29 06:09:00 +00:00
alonbl 514d471f0e Use O_BINARY at rutoken
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3492 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-25 12:49:11 +00:00
alonbl 597bcd7635 Cleanup some Windows issues with open
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3491 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-25 11:51:03 +00:00
alonbl 8d7bce4de2 ruToken fixups
http://www.opensc-project.org/pipermail/opensc-devel/2008-April/011057.html

By Aktiv Co. Aleksey Samsonov



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3478 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-18 14:08:23 +00:00
alonbl 606052c901 Add --get-conf-entry, --set-conf-entry to opensc-tool
Although not perfect, will enable installer/users
to perform some simple tasks against configuration file.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3472 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-12 21:54:02 +00:00
alonbl 865f6e9c70 More fixups to maintainer-clean
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3471 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-11 12:52:46 +00:00
alonbl d84077749b Distribute autoconf generated files for MSVC build
Construct resource files and winconfig.h using autoconf
substitutions.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3468 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-08 18:36:42 +00:00
alonbl 54c1c735f3 Attached are the latest mode to OpenSC svn 3462 to use the Makefile.mak
files to build on Windows.

I got rutoken to compile, and took out the #ifdef's I had in last week.
The rutoken programmer declared some variables in the middle of a block
rather then having all the declare statements at the beginning of a block
as is normally done in C. The Microsoft compile treats this as an error.
(Actual many errors.)

The makedef.pl is no longer needed, as the exports files can be used.
Note that in the original Makefile.mak files only opensc.def and
pkcs15init.def were created.

winconfig.h has a number of changes. As discussed last week this could
be created by autoconf. I also noted that the Active State Perl that
was required for the makedef.pl has a psed command that could be used
like sed to update winconfig.h.  I did not attempt to do this.



  win32/Make.rules.mak - Use ENABLE_OPENSSL and ENABLE_ZLIB

  src/tools/Makefile.mak - add the rutoken.tool.exe

  src/tools/eidenv.c - use PACKAGE_VERSION

  src/pkcs11/Makefile.mak - reorder the objest to match the list in the
           Makefile.am. Makes it easier to read.

  src/include/winconfig.h - The windows version of the config.h
           Changes based on discussions on the list last week.

  src/common/Makefile.mak - renamed modules.

  src/pkcs15init/Makefile.mak - reordered, and added back the rutoken modules
           replaced the use of makdef.pl to sue the exports file.

  src/scconf/Makefile.mak - reordered objects.

  src/libopensc/card-rutoken.c -
           error. Moved the declares to the beginning of blocks.

  src/libopensc/Makefile.mak - reorder names, and add rutoken.
           Use the libopensc.exports file.

  src/libopensc/pkcs15-prkey-rutoken.c - more moving of declare statements.

By Douglas E. Engert

http://www.opensc-project.org/pipermail/opensc-devel/2008-April/011011.html



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3464 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-07 19:42:43 +00:00
alonbl 87db3c96c2 More separate srcdir fixups
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3450 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-01 19:04:33 +00:00
alonbl 39abe22798 More separate srcdir fixups
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3449 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-01 17:08:17 +00:00
ludovic.rousseau 7e30721378 use $(srcdir) when needed to be able to build in separate build
directories using: cd foobar ; ../configure srcdir=..

Thanks to Douglas E. Engert for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2008-March/010959.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3445 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-01 12:43:26 +00:00
ludovic.rousseau 77fac9721f #include <opensc/pkcs15.h> to avoid a compilation warning
rutoken.h:4: warning: 'struct sc_pkcs15_prkey' declared inside parameter
list
rutoken.h:4: warning: its scope is only this definition or declaration,
which is probably not what you want


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3443 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-01 09:32:40 +00:00
alonbl 80a16f686d ruToken cleanups
Move constants out of standard files.
Create ruToken specific interface.
Update symbols.

Thread at:
http://www.opensc-project.org/pipermail/opensc-devel/2008-March/010917.html

Cleanup of:
http://www.opensc-project.org/pipermail/opensc-devel/2007-December/010617.html



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3439 c6295689-39f2-0310-b995-f0e70906c6a9
2008-03-26 06:24:37 +00:00
alonbl 8ac87f1b1e Remove useless comments
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3414 c6295689-39f2-0310-b995-f0e70906c6a9
2008-03-09 21:24:24 +00:00
alonbl 0a809dd5cb Complete rewrite of OpenSC build system.
1.  Build system now supports MinGW (Windows) compilation using msys and cross compilation.
2.  Ability to explicitly disable and enable dependencies of the package.
3.  openct, pcsc and nsplugins features are disabled by default.
4.  Modified pcsc driver to use pcsc dynamically, no compile time dependency is required.
5.  --enable-pcsc-lite configuration option renamed to --enable-pcsc.
6.  Install opensc.conf file (as opensc.conf.new if opensc.conf exists).
7.  Add--enable-doc configuration option, allow installing documentation into target.
8.  Add --disable-man configuration option, allow msys mingw32 users to
    build from svn without extra dependencies.
9.  Add export files to each library in order to export only required symbols.
    Windows native build may use these files instead of scanning objects' symbols.
10. Add opensc-tool --info to display some general information about the build.
11. Create compatibility library to be linked against library instread of recompiling the
    same source files in different places.
12. Add different win32 version resource to each class of outputs.
13. Make xsl-stylesheets location selectable.
14. Some win32 fixups.
15. Some warning fixups.
16. Many other autoconf/automake cleanups.

Alon Bar-Lev

svn diff -r 3315:3399 https://www.opensc-project.org/svn/opensc/branches/alonbl/mingw

_M   .
D    configure.in
_M   src
_M   src/openssh
M    src/openssh/Makefile.am
_M   src/tools
M    src/tools/rutoken-tool.c
M    src/tools/opensc-tool.c
M    src/tools/cardos-info.c
M    src/tools/pkcs15-crypt.c
M    src/tools/pkcs15-init.c
M    src/tools/piv-tool.c
M    src/tools/netkey-tool.c
M    src/tools/eidenv.c
M    src/tools/cryptoflex-tool.c
M    src/tools/util.c
M    src/tools/pkcs11-tool.c
M    src/tools/pkcs15-tool.c
M    src/tools/util.h
M    src/tools/opensc-explorer.c
M    src/tools/Makefile.am
_M   src/pkcs11
M    src/pkcs11/pkcs11-global.c
M    src/pkcs11/framework-pkcs15.c
M    src/pkcs11/mechanism.c
M    src/pkcs11/pkcs11-display.c
M    src/pkcs11/pkcs11-object.c
A    src/pkcs11/opensc-pkcs11.exports
M    src/pkcs11/sc-pkcs11.h
M    src/pkcs11/pkcs11-spy.c
M    src/pkcs11/openssl.c
M    src/pkcs11/Makefile.am
A    src/pkcs11/pkcs11-spy.exports
_M   src/tests
_M   src/tests/regression
M    src/tests/regression/Makefile.am
M    src/tests/sc-test.c
M    src/tests/pintest.c
M    src/tests/Makefile.am
_M   src/include
_M   src/include/opensc
M    src/include/opensc/Makefile.am
A    src/include/opensc/svnignore
M    src/include/Makefile.am
_M   src/signer
_M   src/signer/npinclude
M    src/signer/npinclude/Makefile.am
M    src/signer/Makefile.am
A    src/signer/signer.exports
_M   src/common
A    src/common/compat_dummy.c
D    src/common/getopt.txt
D    src/common/strlcpy.c
D    src/common/LICENSE
A    src/common/compat_getopt.txt
A    src/common/compat_strlcpy.c
A    src/common/LICENSE.compat_getopt
A    src/common/compat_getopt.c
D    src/common/strlcpy.h
D    src/common/ChangeLog
D    src/common/getpass.c
D    src/common/my_getopt.c
A    src/common/compat_strlcpy.h
A    src/common/compat_getpass.c
A    src/common/compat_getopt.h
A    src/common/ChangeLog.compat_getopt
D    src/common/README.strlcpy
D    src/common/my_getopt.h
A    src/common/compat_getpass.h
A    src/common/README.compat_strlcpy
D    src/common/strlcpy.3
A    src/common/README.compat_getopt
D    src/common/getopt.3
D    src/common/README.my_getopt
A    src/common/compat_strlcpy.3
A    src/common/compat_getopt.3
M    src/common/Makefile.am
M    src/Makefile.am
_M   src/pkcs15init
M    src/pkcs15init/pkcs15-oberthur.c
M    src/pkcs15init/profile.c
M    src/pkcs15init/pkcs15-lib.c
M    src/pkcs15init/pkcs15-rutoken.c
A    src/pkcs15init/pkcs15init.exports
M    src/pkcs15init/pkcs15-gpk.c
M    src/pkcs15init/Makefile.am
_M   src/scconf
M    src/scconf/Makefile.am
M    src/scconf/parse.c
A    src/scconf/scconf.exports
_M   src/libopensc
M    src/libopensc/card-rutoken.c
M    src/libopensc/compression.c
M    src/libopensc/sc.c
M    src/libopensc/card-piv.c
M    src/libopensc/pkcs15-openpgp.c
M    src/libopensc/pkcs15-postecert.c
M    src/libopensc/pkcs15-tcos.c
M    src/libopensc/opensc-config.in
M    src/libopensc/reader-pcsc.c
A    src/libopensc/internal-winscard.h
M    src/libopensc/ctx.c
A    src/libopensc/libopensc.exports
M    src/libopensc/pkcs15-piv.c
M    src/libopensc/pkcs15-infocamere.c
M    src/libopensc/internal.h
M    src/libopensc/pkcs15-actalis.c
M    src/libopensc/pkcs15-starcert.c
M    src/libopensc/card-oberthur.c
M    src/libopensc/pkcs15-atrust-acos.c
M    src/libopensc/p15card-helper.c
D    src/libopensc/part10.h
M    src/libopensc/ui.c
M    src/libopensc/card-gpk.c
M    src/libopensc/pkcs15-wrap.c
M    src/libopensc/pkcs15-gemsafeGPK.c
M    src/libopensc/log.c
M    src/libopensc/pkcs15-esteid.c
M    src/libopensc/pkcs15-prkey-rutoken.c
M    src/libopensc/log.h
M    src/libopensc/Makefile.am
M    src/libopensc/reader-openct.c
_M   aclocal
M    aclocal/Makefile.am
_M   win32
M    win32/Makefile.am
A    win32/versioninfo.rc.in
A    win32/ltrc.inc
A    configure.ac
_M   doc
_M   doc/tools
M    doc/tools/pkcs15-profile.xml
D    doc/changelog.sh
D    doc/export-wiki.xsl
_M   doc/api
_M   doc/api/file
M    doc/api/man.xsl
_M   doc/api/asn1
_M   doc/api/apps
_M   doc/api/init
_M   doc/api/types
_M   doc/api/card
M    doc/api/html.xsl
_M   doc/api/misc
_M   doc/api/util
M    doc/Makefile.am
D    doc/export-wiki.sh
AM   doc/nonpersistent
A    doc/nonpersistent/export-wiki.xsl
A    doc/nonpersistent/Makefile.am
A    doc/nonpersistent/export-wiki.sh
A    doc/nonpersistent/svn2cl.xsl
D    doc/generate-man.sh
D    doc/svn2cl.xsl
M    Makefile.am
A    svnignore
_M   etc
M    etc/opensc.conf.in
M    etc/Makefile.am
D    man
_M   solaris
M    solaris/Makefile



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3405 c6295689-39f2-0310-b995-f0e70906c6a9
2008-03-06 16:06:59 +00:00
alonbl 741330ba19 Allow specifying application name for data objects at pkcs15-init.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3403 c6295689-39f2-0310-b995-f0e70906c6a9
2008-03-06 15:00:04 +00:00
ludovic.rousseau e9135ff347 print_binary(): everything except printable characters (including space)
are displayed in hex

Thanks to Ian Young for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2008-January/010641.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3313 c6295689-39f2-0310-b995-f0e70906c6a9
2008-01-04 13:13:53 +00:00
ludovic.rousseau bf9d6beaac new patch for ruToken support
Thanks to Andrew V. Stepanov
http://www.opensc-project.org/pipermail/opensc-devel/2007-December/010631.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3310 c6295689-39f2-0310-b995-f0e70906c6a9
2008-01-03 08:59:14 +00:00
pk 513a3dde0a support for TCOS3
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3309 c6295689-39f2-0310-b995-f0e70906c6a9
2007-12-28 18:18:57 +00:00
jps 27257f2278 support for Siemens CardOS V4.2C
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3306 c6295689-39f2-0310-b995-f0e70906c6a9
2007-12-19 09:58:29 +00:00
ludovic.rousseau bb7bdc208f redefine trace macro to avoid compiler warnings when _DEBUG is not
defined

rutoken-tool.c:107: warning: statement with no effect
rutoken-tool.c:165: warning: left-hand operand of comma expression has no effect


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3305 c6295689-39f2-0310-b995-f0e70906c6a9
2007-12-17 13:47:25 +00:00
ludovic.rousseau 0ecc294ed8 add support of ruToken
Thanks to Andrew V. Stepanov for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2007-December/010617.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3304 c6295689-39f2-0310-b995-f0e70906c6a9
2007-12-17 13:39:20 +00:00
gurer ab94915277 two new debugging commands.
asn1 2f01
Dumps asn.1 content of a file

apdu 00:20:00:00:04:31:31:32:32
Send the custom APDU inside the session


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3275 c6295689-39f2-0310-b995-f0e70906c6a9
2007-09-27 18:19:17 +00:00
aj 3264588c3e restores ability to change opensc-explorer debug level at
runtime, using "debug" command from opensc prompt. by Jakub Bogusz


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3247 c6295689-39f2-0310-b995-f0e70906c6a9
2007-08-14 06:02:51 +00:00
ludovic.rousseau 0cebca4ceb the commands line tools do not call lt_dlopen() so do not need to link
with libltdl


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3244 c6295689-39f2-0310-b995-f0e70906c6a9
2007-08-13 08:32:07 +00:00
aj a7912a2426 add information about cardos 4.2b - latest cardos update.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3237 c6295689-39f2-0310-b995-f0e70906c6a9
2007-08-08 20:06:53 +00:00