vtarasov
49fb08f923
pkcs15init: use macro for the maximal number of linked ACL for one operation ...
...
Thanks to NdK.
http://www.opensc-project.org/pipermail/opensc-devel/2011-April/016448.html
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5406 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-27 14:45:23 +00:00
vtarasov
8098e82b16
libopensc: in 'READ BINARY' ignore the 'FILE_END_REACHED' error ...
...
see discussion
http://www.opensc-project.org/pipermail/opensc-devel/2011-April/016413.html
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5405 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-27 14:37:57 +00:00
vtarasov
5471aea023
libopensc: new error code macros -- 'corrupted data' and 'file end reached'
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5404 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-27 14:28:03 +00:00
vtarasov
670942a0b4
iasecc: when preparing data to update PRIVATE KEY SDO use index to enumerate the SDO components
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5403 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-27 14:12:40 +00:00
vtarasov
ad478eb9cc
iasecc: write 'compulsorily use' data for the new key slot ...
...
Once written the 'compulsorily use' data cannot be changed.
Write this data immediately after a new key slot has been created.
It helps to avoid further confusion between 'use new key slot' and 'reuse existing slot'.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5402 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-27 14:06:58 +00:00
vtarasov
6c3b43f636
iasecc: when signing short data sequence with PSO_DST ...
...
... 'last-hash-step' APDU do not includes the 'pre-hash' and 'counter' data -- only the 'last-data-block'.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5401 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-27 13:56:31 +00:00
vtarasov
06347f3a44
iasecc pkcs15init: when creating key slot, there is no needs to write zero value components
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5400 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-27 13:45:27 +00:00
vtarasov
81e1676122
iasecc pkcs15init: create/delete SDO private/public RSA key
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5399 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-26 17:32:34 +00:00
vtarasov
c9bf9bc22c
iasecc: 'DELETE SDO' card ctl ...
...
to be used by Obertbur's IAS/ECC card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5398 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-26 17:29:08 +00:00
vtarasov
346490b953
iasecc: 'CREATE SDO' card ctl ...
...
; static function dedicated to emulate FCP data of application DF when it's not returned by card
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5397 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-26 16:42:48 +00:00
vtarasov
3b9f5b94ae
iasecc: encode data for the SDO creation, ...
...
; dedicated function to parse ACLs from DOCP data;
; when converting ACL chack and parse ACLs;
; change prototype of the internal static functions.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5396 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-26 16:34:44 +00:00
vtarasov
5e6d310491
iasecc: pkcs15init profiles: add 'CREATE' acl for the Oberthur's application DF ...
...
Obertbur's card do not returns FCP for selected application DF.
Newly introduced option will supply the missing ACL when creating new objects or files.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5395 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-26 16:27:42 +00:00
martin
1cdb3fa971
APDU parsing: switch to Frank Morgner's implementation
...
Patch by Frank Morgner, proposed in
http://www.opensc-project.org/pipermail/opensc-devel/2011-April/016419.html and
http://www.opensc-project.org/pipermail/opensc-devel/2011-April/016420.html :
* replace partly incorrect extended APU parsing implementation
with one factored-out in function sc_bytes2apdu() in apdu.c
* re-factor APDU parsing functions in
- opensc-explorer
- opensc-tool
- piv-tool
to make use of sc_bytes2apdu()
Thanks to Peter Marschall and Frank Morgner
This fixes #260 and #351 .
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5394 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-26 07:29:53 +00:00
vtarasov
27cd40629e
iasecc: Oberthur's card strictly follows specification in 'IO buffer size' ...
...
Most of the card producers interpret 'send' values in 'IO buffer size' data as "maximum APDU data size" .
The last Oberthur's card strictly follows specification and interpret these values as "maximum APDU command size".
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5392 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-24 17:57:49 +00:00
vtarasov
a14bbe7e32
opensc-explorer: DF_NAME type path value should not be appended by the file ID ...
...
When composing path to file (for ex. to be read), if the type of parent DF is DF_NAME,
the value of the parent path is moved to the aid path member and
file ID takes place of the path value.
; 'cd ..' command takes into account the parent can be presented by DF_NAME
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5391 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-23 06:32:53 +00:00
vtarasov
54f3e8c423
pkcs15init: little correction of r5386
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5390 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-22 14:02:45 +00:00
vtarasov
6b04ab7650
pkcs15init: in 'change-attribute' procedure use card specific 'update DF' handler ...
...
... when it's available.
'Change-attribute' is used by pkcs15 framework for PKCS#11.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5389 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-22 14:00:47 +00:00
vtarasov
4fa9679463
pkcs15init: use dedicated function to fix the EC parameters ...
...
; use pointQ data to calculate intrinsic ID for the EC keys/certs
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5388 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-22 13:50:01 +00:00
vtarasov
9376b73d14
EC support: new exported function to fill up the EC parameters data ...
...
for ex. with the given named curve fills the 'OID' and 'encoded OID' members
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5387 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-22 13:35:57 +00:00
vtarasov
78d90c4765
EC support: introduce data type dedicated to EC parameters ...
...
EC parameters can be presented in a three forms: namedCurve, OID and implicit data.
This new data type will facilitate manipulation of ec-parameters in the OpenSC tools and library.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5386 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-22 13:08:45 +00:00
vtarasov
3e9b88d6d6
pkcs15init iasecc: old syntax in the profile of the Oberthur's generic application
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5385 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-21 17:20:39 +00:00
vtarasov
7db9532f00
pkcs11 framework-pkcs15: add EC key generation mechanism
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5384 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-21 16:29:13 +00:00
vtarasov
e430fe9d87
pkcs11-tool: add test procedure for EC keys ...
...
... for a while it includes key generation and data signing.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5383 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-21 16:18:23 +00:00
vtarasov
9758bb28bf
pkcs11: copy&past issue in r5356
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5382 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-21 16:14:36 +00:00
vtarasov
c2a87ae2b1
pkcs11-tool: prepare 'gen_keypair' procedure to generate also the EC keys ...
...
... 'prime256v1' and 'secp384r1'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5381 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-21 14:29:51 +00:00
vtarasov
38103c64cf
pkcs15: new function to encode an OID in DER format
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5380 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-21 14:12:03 +00:00
vtarasov
669a10572a
asn1: now sc_der_copy() returns int value
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5379 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-21 13:46:28 +00:00
andre
094eb8697c
opensc-tool.c: Fixes literal names in 'const id2str_t alg_type_names[]'.
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5375 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 13:45:30 +00:00
andre
9026ea6f3f
pkcs11-tool.c: Avoid warning:
...
pkcs11-tool.c:1978: warning: ‘getPUBLIC_EXPONENT’ defined but not used
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5374 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 13:03:49 +00:00
andre
ff7bb8fbf4
profile.c: Avoid warning:
...
profile.c:1212: warning: comparison between signed and unsigned
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5373 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 12:59:23 +00:00
andre
fa8fd1602d
types.h: Avoid warning:
...
opensc-tool.c:356: warning: comparison between signed and unsigned
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5372 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 12:34:16 +00:00
martin
8f0ba374f3
Add reminders to bytes2apdu style code blocks.
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5370 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 10:51:27 +00:00
martin
1932ce861f
opensc-{explorer,tool}: allow sending extended APDUs
...
In do_apdu() resp send_apdu/(, flexibilize parsing the APDU string passed
so that extended APDUs are accepted a valid APDUs too.
While at it, fix a bug where more data than available would have been copied,
potentially leading to a SIGSEGV.
Signed-off-by: Peter Marschall <peter@adpm.de>
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5369 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 10:51:22 +00:00
martin
9dc233163a
opensc-tool: convert print_file() to using tables
...
Use ID<->name tables in print_file() innstead of arrays of strings where
the index was treated like some "magic" constant. With the new mapping tables,
the meaning is obvious.
While on it, fix a bug with ac_ops_df[]: before the conversion, it was a list
of pointers to strings but was in one case treated like it was a mapping table.
With the conversion to a mapping table, and the adaption of other code parts
this bug got fixed "automagically" ;-)
Signed-off-by: Peter Marschall <peter@adpm.de>
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5368 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 10:51:16 +00:00
martin
be5456d3ca
opensc-tool: make list_algorithms() table driven
...
Use easily extensible tables instead of explicit coding to display
algorithm names and options in list_algorithms.
Leverage the new tables to add more RSA hashes.
Signed-off-by: Peter Marschall <peter@adpm.de>
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5367 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 10:51:11 +00:00
martin
e5a133d00c
Fix a crash on Windows, where pkcs15-tool -E would always crash in sc_pkcs15_free_card()
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5366 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 10:51:06 +00:00
andre
6409755bea
pkcs11-tool.c: Avoid warning:
...
pkcs11-tool.c:2000: warning: comparison between signed and unsigned
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5363 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 09:18:12 +00:00
andre
261d5269e5
pkcs15-init.h: Avoid warning:
...
pkcs15-init.c:1473: warning: assignment discards qualifiers from pointer target type
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5362 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 09:12:17 +00:00
andre
90ffef6dc9
asn1.c: Check boundaries __before__ accessing memory.
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5361 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-18 12:29:47 +00:00
martin
007d27feeb
Introduce sc_ctx_log_to_file to set the debug file of libopensc.
...
On Windows every DLL has their own file descriptor table, thus specifying
-v from any of the OpenSC tools resulted in a crash when the tool tried to override
ctx->debug_file with stderr.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5359 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-18 10:01:27 +00:00
vtarasov
8de6b57882
pkcs15init: different possible kinds of EC generate key parameters ...
...
named curve, oid and der
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5357 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-17 18:48:12 +00:00
vtarasov
ef1726e782
pkcs11: process the EC key generation type
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5356 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-17 18:45:27 +00:00
vtarasov
caf3789439
asn1: in encode-object-id procedure do not stop on zero -- it's a valid value
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5355 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-17 18:39:01 +00:00
vtarasov
2202614fdc
pkcs15init setcos: no need of card specific 'delete-object' callback ...
...
there is nothing specific inside and it's never called by pkcs15init
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5349 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-16 17:57:49 +00:00
vtarasov
28ccae7918
card-piv: store serial number into the 'serialnr' member of sc_card structure ...
...
... when serial number was asked for the first time.
Then return the stored value for the every next request of serial number.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5348 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-16 17:35:56 +00:00
vtarasov
d673e5f109
pkcs15init myEID: in profile increase size of xDF files, also ...
...
during initialization add the all xxDF to the ODF
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5344 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-15 17:11:38 +00:00
vtarasov
614e9fa566
pkcs15init: sipmlify the 'delete-object' callaback prototype ...
...
now it takes 'sc_pkcs15_object' argument instead of two arguments - object's type and object's data.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5343 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-15 16:50:04 +00:00
vtarasov
3aae1d39c2
framework-pkcs15: minor coding style issues
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5342 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-15 16:35:29 +00:00
vtarasov
fb97d8b4b4
pkcs15-tool: print title and size of the EC public keys
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5341 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-15 16:34:22 +00:00
vtarasov
99fac2685a
piv-tool: increase receive buffer for the 'send-apdu' command
...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5340 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-15 16:33:18 +00:00