Commit Graph

5695 Commits

Author SHA1 Message Date
Frank Morgner a05e7ca84d ignore errors on `apt-get update` 2015-03-31 18:48:33 +02:00
Thomas Calderon 4a4d750e73 iasecc: Fix log output is always displayed
* iasecc_read_public_key function uses SC_SUCCESS instead of log level
  value, hence the log output is always displayed. This uses
  SC_LOG_DEBUG_NORMAL instead.

VTA: updated to use short form of LOG macro
2015-03-31 18:47:11 +02:00
Thomas Calderon 117f3a74be iasecc: Fix key usage when provisioning card
* Avoids overriding key_usage when creating objects on the card.
2015-03-31 18:25:54 +02:00
Robert Quattlebaum 548c2780d3 Add support for ACOS5-64 cards.
The ACOS5-64 cards have a different ATR than the original
ACOS5-32 cards. This change simply adds this ATR so that it
will be recognized properly.
2015-03-29 14:09:35 +02:00
vletoux 5007e9fc9f md: fix build without OPENSSL_VERSION_NUMBER
Fix the WCHAR / CHAR conversion problem in CardAuthenticateEx in case of PinPAD (vs->wzPinContext is UNICODE)
Fix UNICODE compilation problem( MessageBoxA instead of MessageBox)
2015-03-29 13:59:21 +02:00
vletoux 3b873adad2 win32: allows UNICODE built.
UNICODE is set by default by Visual Studio (but can be deactived)
The trick is to force ANSI version by appending a A to the function calls.
2015-03-29 13:54:51 +02:00
Philip Wendland c8d206ece1 IsoApplet: Increase indicated version to 00.06
Backward compatiblity with 00.05 is kept.
2015-03-29 13:34:58 +02:00
Philip Wendland 9078856675 IsoApplet: register ECC mechanisms only when ECC is supported by card
There are few Java Cards that do not support ECDSA at all.
Starting with IsoApplet version 00.06, the applet returns whether the card
supports ECDSA or not. This commit uses this information to decider whether to
register ECDSA mechanisms or not.
2015-03-29 13:34:58 +02:00
Philip Wendland 76facf0d73 IsoApplet: add support for GET CHALLENGE 2015-03-29 13:34:58 +02:00
Philip Wendland e258cec13e IsoApplet: Add nistp224, secp192k1 and secp256k1 curves
secp*k1 curves are only supported applet version >= 0.6.0 because of an issue
with encoding ECC public keys with small parameters.
2015-03-29 13:34:58 +02:00
Philip Wendland ab5ca331b2 IsoApplet: Obtain applet version and card capabilities *after* match_card() 2015-03-29 13:34:58 +02:00
Philip Wendland bba6e17aa9 isoApplet: Fix indentation of isoApplet.profile 2015-03-29 13:34:58 +02:00
Viktor Tarasov 090aed2fc2 ec: fix length of allocated mem for EC signature
discussion in PR #398
2015-03-29 13:08:01 +02:00
Philip Wendland 4b51b99748 pkcs11-tool: harmonize supported ECC curves
pkcs15-pubkey.c holds a struct containing supported ECC curves. The contents of
this struct are being harmonized with pkcs11-tool supported curves.
2015-03-29 12:55:54 +02:00
Frank Morgner f3573ede0d fixed requesting PACE features 2015-03-29 12:42:13 +02:00
Andreas Schwier b1bdfae200 sc-hsm: revert broken a4c8d671
sc-hsm: Fixed minimum value for number of password shares
2015-03-29 12:40:44 +02:00
Wouter Verhelst 5149dd3e62 belpic: Support 2K cards
Recent BELPIC cards (issued since March 2014) have a validity of 10
years (rather than 5 as before), and therefore also increased the key
size from 1024 bits to 2048 bits.

Key size can be detected by checking the applet version, for which we
have to issue a "GetCardData" command. If the applet is version 0x17 or
higher, keys are 2048 bits.

Use #defines rather than magic numbers

Keeps the code slightly more readable.

While we're at it, refactor slightly so that the code which issues the
GET CARD DATA command doesn't just keep the applet version, but also
makes other things available.

This latter in preparation of setting the serial number.
2015-03-29 12:11:44 +02:00
Frank Morgner c019a62309 pkcs11: parameter checking for 'get_mechanism_list'
fixes #409
2015-03-29 12:11:08 +02:00
Thomas Calderon 435291f216 iasecc: initial support for Morpho IAS Agent Card
* This commit adds initial support for Morpho French Agent card which is an
    IAS card. Signature operations are working. Since my test card was
    read-only, I was unable to test object management functions.

  * Add missing copy of AID in structure
2015-03-29 12:10:55 +02:00
Viktor Tarasov c0c8a89126 mcrd: move driver to the end of detection list
the drivers that need to probe the AIDs to recognize its supported card
have to be placed at the end of the list of internal drivers
2015-03-20 18:08:18 +01:00
Hannu Honkanen 2fffbce65c myeid: update EC support for MyEID-v4 card 2015-03-14 17:47:44 +01:00
Frank Morgner b8c0df725a Merge pull request #390 from lbakman/master
Fixed issue with building dnie-tool bash_completion script

closes #392
2015-03-11 21:55:04 +01:00
Lau bakman 1becc45c10 Updated dnie-tool.1.xml for consistency
Experienced a problem with dnie-tool where I would receive a warning with the content of /etc/bash_completion.d/dnie-tool.

The cause of the error was a missing case label which in turn was caused by the formatting of the dnie-tool.1.xml.

Options were formatted like <term><option--xarg, -x</option></term> which were not handled by the sed regular expression in the makefiles.

Modified the dnie-tool.1.xml file to be consistent with the other doc files and to generate the dnie-tool file correctly.
2015-03-11 18:22:56 +01:00
Viktor Tarasov 877fa862d9 isoApplet: prototype of asn1_sig_value_sequence_to_rs() has changed 2015-03-10 09:09:14 +01:00
viktorTarasov 595be37fee Merge pull request #305 from philipWendland/master
Add support for the IsoApplet Java Card applet
2015-03-07 23:36:25 +01:00
Viktor Tarasov 2abe135f97 asn1: re-fix error in EC signature encode helper
see comment for 8cf99a9372
2015-03-07 22:40:43 +01:00
Viktor Tarasov 1739300657 pkcs15: fix name of EC curve, add new ones 2015-03-05 10:32:54 +01:00
Viktor Tarasov 6f6286de99 pkcs11: generate EC key: use allocated EC params
For internal use allocate and copy the EC params data from the caller's template,
rather then use them directly as a pointer in internal public key data.
2015-03-04 19:47:13 +01:00
Viktor Tarasov 31124ac4f9 pkcs15init: allocate EC parameters 2015-03-04 19:46:21 +01:00
Viktor Tarasov 1123768ac3 libopensc: invalid 'free' and 'assign NULL' order 2015-03-04 19:45:23 +01:00
Viktor Tarasov 8cf99a9372 asn1: fix error in EC signature encode helper
The raw format of EC signature was invalid when 'r' and 's' had different length.
https://github.com/OpenSC/OpenSC/pull/381#issuecomment-77016382

According to PKCS#11 v2.20:
"If r and s have different octet length, the shorter of both must
be padded with leading zero octets such that both have the same octet length."
2015-03-04 19:43:15 +01:00
Philip Wendland 74aeb8c923
IsoApplet: register supported EC curve *per curve* 2015-02-22 23:08:18 +01:00
Doug Engert 58d1f1db3f Merge pull request #385 from darconeous/patch-2
Allow PKCS15 cache to work with PIV cards (if enabled)
2015-02-21 21:51:50 -06:00
Philip Wendland 85d16fbc57
IsoApplet: use helper function sc_asn1_sig_value_sequence_to_rs() introduced in #381 2015-02-20 23:02:04 +01:00
Philip Wendland 1aeebdaf1c
IsoApplet: react to changes of _sc_card_add_ec_alg() in fa923831f8 2015-02-20 22:56:23 +01:00
Philip Wendland 59eeacb74b
IsoApplet: react to removal of sc_pkcs15_ec_parameters in fa923831f8 2015-02-20 22:07:49 +01:00
Philip Wendland a9d43af4bf
IsoApplet: use a buffer large enough when generating EC keys larger than 320 bit 2015-02-20 21:55:35 +01:00
Philip Wendland 3312c1e2b9
IsoApplet: install isoApplet.profile on windows 2015-02-20 21:55:35 +01:00
Philip Wendland da05fa2a47
IsoApplet: try to fix EC parameters when importing private keys from file 2015-02-20 21:55:35 +01:00
Philip Wendland 44d724b012
IsoApplet: fix more (comment) alignment issues with tabstop=8 2015-02-20 21:55:35 +01:00
Philip Wendland 5628a06353
IsoApplet: Align comments with spaces instead of tabs
Better view with tabstop=8.
2015-02-20 21:55:35 +01:00
Philip Wendland 43fa99c0f2
IsoApplet: Move the key gen debug info to the right places 2015-02-20 21:55:35 +01:00
Philip Wendland 0473decae4
IsoApplet: clear memory after prkey import.
Private key import via plain APDUs is dangerous and not recommended anyway, but clearing the apdu buffer does not hurt anyone.
2015-02-20 21:55:34 +01:00
Philip Wendland 73b391731b
IsoApplet: Don't set ECC field length of 512
512 is wrong for EC FP (correct would be 521 bit), and neither of those
two are currently supported by OpenSC.
2015-02-20 21:55:34 +01:00
Philip Wendland e791948e42
IsoApplet: Simplify the private key import
Use the new features of sc_asn1_put_tag introduced in OpenSC/OpenSC#314.
Additionally, a RSA private key is sent from one large buffer using either extended APDUs or chaining (in compliance to IsoApplet API version 00.05).
2015-02-20 21:55:34 +01:00
Philip Wendland 6cdf6c08a5
IsoApplet: use AID directly when selecting applet
Now that apdu.data is const (see ef94c6b875), this can be done without discarding the const qualifier of the aid parameter.
2015-02-20 21:55:34 +01:00
Philip Wendland 09acfd7ec0
IsoApplet: ECDSA signatures - only strip excess zeroes
It is required to strip excessive zeroes returned by some Java Cards when removeing the ASN1 structural information for PKCS#11 so that the x/y can be calculated by dividing the signature length by 2. However, the leading zero may only be stripped if it is excessive (outside the field length). Otherwise generated signatures are wrong in rare cases (1 out of 256).
2015-02-20 21:55:33 +01:00
Philip Wendland c463f1a7a1
IsoApplet: Do not set RSA hashes
See: 189e998486
The IsoApplet requires the host to do the hashes with RSA. OpenSC will
add all hashes that are available in software and will not expect the
card to do the hashing.
2015-02-20 21:55:33 +01:00
Philip Wendland e3cc851b72
IsoApplet: EC key-gen rework and refactorings
Rework the EC key generation mechanism to send the curve parameters to
the card. In earlier versions, the applet had a copy of the curve
parameters and there was a different algorithm reference for every
curve. This is unfeasible when trying to support a larger number of
curves because of size limitations of the applet.
This commit additionally includes some refactorings that should not
change the functionality.
2015-02-20 21:55:33 +01:00
Philip Wendland 6f9e894ebe
IsoApplet: set lock when doing command chaining 2015-02-20 21:55:33 +01:00