Commit Graph

5493 Commits

Author SHA1 Message Date
Frank Morgner 8ed4db76c8 Merge pull request #238 from eighthave/master
generate bash completion scripts from XML doc files
2014-10-22 16:15:29 +02:00
Doug Engert 73a150352b Merge pull request #298 from dengert/pkcs11Hashes
PKCS#11 hashes for cards without RAW (see #241)
2014-10-16 08:48:32 -05:00
Doug Engert 0dfb45b420 Merge pull request #279 from dengert/master
pkcs11-tool sets CKA_DECRYPT=true rather then CKA_DERIVE=true when gener...
2014-10-13 21:51:41 -05:00
Doug Engert 189e998486 PKCS#11 hashes for cards without RAW (see #241)
The framework-pkcs15.c did not add hashes correctly if the card did not support RSA RAW.
    This change fixes that and only adds hashes if the card did not specify a list of hashes.
    It also will not add hashes done in software if ENABLE_OPENSSL is not specified.
    Some error conditions are also tested for EC mechanisms.

    See bug report #241 for more information.
2014-10-13 10:29:27 -05:00
Doug Engert 9a82a95132 Merge branch 'master' of github.com:OpenSC/OpenSC 2014-10-03 06:50:04 -05:00
Hans-Christoph Steiner d72324ddf5 generate bash completion scripts from XML doc files
This generates the scripts that lets bash do completion per specific tool.
It gets the options from the documentation XML files that are also the
source for the man pages and HTML.
2014-10-01 20:53:30 -04:00
Ludovic Rousseau 34587eac9c Fix compiler warning
p15card-helper.c:23:5: warning: 'ENABLE_OPENSSL' is not defined, evaluates to 0
      [-Wundef]
    ^
2014-10-01 22:11:38 +02:00
Ludovic Rousseau 09c2847b7e Fix compiler warning
pkcs15-dnie.c:242:13: warning: function declaration isn't a prototype [-Wstrict-prototypes]
 const char *sc_driver_version()
             ^
2014-10-01 22:11:38 +02:00
Ludovic Rousseau fb7bbf1e80 build: disable Secure Messaging if OpenSSL is not used
If OpenSSL is not present or --disable-openssl then Secure Messaging is
disabled.

The problem was that some Secure Messaging code is missing if OpenSSL is
absent. The build/link failed with some missing symbols.

Fix issue #293
2014-10-01 22:11:38 +02:00
Ludovic Rousseau c8545baf90 pkcs15-dnie: fix compilation when OpenSSL is not used
If OpenSSL is not used then the functions from card-dnie.c are not
defined and in particular dnie_match_card() is not defined.
In that case we use a fake dnie_match_card() that just returns false.
2014-10-01 22:11:38 +02:00
Philip Wendland 955a339148 Merge PR#288 from philipWendland:upstream-ecc-fix
add the possibility to store public ECC keys encoded according to SPKI
EC pubkey storing: Check if params are available before copying.
pkcs15-lib.c / sc_pkcs15init_store_public_key may be called with keyargs->key.u.ec.params.value == NULL. In this case, allocating and copying the parameters will fail. Add a check to prevent this.
2014-10-01 15:27:26 +02:00
Dirk-Willem van Gulik 4e73d0e36f Merge PR#280 from dirkx/master: --no-prompt flag
Add a --no-prompt flag to pkcs15-tool (i.e. the equivalent of the --no-prompt flag of pkcs15-init). As to aid readers with keypads (as commonly used in the medical space).
2014-10-01 14:36:52 +02:00
Ludovic Rousseau ea712bfd56 Fix compiler warning
The same function iasecc_sm_external_authentication() was declared in
two different .h files.

In file included from ../../src/libopensc/iasecc.h:27:0,
                 from sm-card-iasecc.c:44:
../../src/libopensc/iasecc-sdo.h:324:5: warning: redundant redeclaration of `iasecc_sm_external_authentication' [-Wredundant-decls]
In file included from ../../src/libopensc/opensc.h:44:0,
                 from sm-card-iasecc.c:40:
../../src/libopensc/sm.h:352:5: note: previous declaration of `iasecc_sm_external_authentication' was here
2014-09-29 16:08:33 +02:00
Doug Engert cb89a870ae Merge pull request #280 from shootingatshadow/aes-support
Remove hardcodes from Mutual Authenticate
2014-09-18 16:32:21 -05:00
Ludovic Rousseau 99281793e0 Fix secure messaging library name on Mac OS X
Mac OS X uses "libsmm-local.3.dylib" as library name. The default value
"libsmm-local.so.3" is correct for Linux but not for Mac OS X.

This bug prevented the "opensc-tool -a" to work correctly and return the
ATR if an IAS card is present in the reader.
2014-09-16 20:53:48 +02:00
Andreas Schwier be200ab3c8 Merge pull request #282 from CardContact/fix-deleted-related-public-key
framework-pkcs15: Duplicate public key related to private key rather than referencing the framework object

Referencing the related public key is required to return PKCS#11 attributes for a private key only available
in the public key object (i.e. CKA_MODULUS). This patch adds a copy of the public key to the private key object rather than
referencing the public key object in the framework. This prevents SEGV when the public key framework object
is deleted with C_DestroyObject, but the reference from the public key remains intact.

The bug leads to all kind of stability problems when keys are created and deleted in the same session.

The patch is in particular important if OpenSC is used with EJBCA or any other application using the
SUN PKCS#11 provider: When generating key pairs, then the public key object is eventually garbage collected
which removes the related object in the PKCS#11 module. Because there is no fixed time for this operation,
corruption occurs at random.

In a next step, the remaining related_xxx fields in sc_pkcs11_object should be revised and possibly removed.

framework: Added more error checking
2014-09-07 23:47:24 +02:00
Andreas Schwier 7db99500a0 sc-hsm: Fix certificate delete bug
If a certificate is deleted after the related private key, then the driver
picks the wrong certificate EF, leading to an CKR_GENERAL_ERROR or the wrong
certificate being deleted.
2014-09-07 23:10:48 +02:00
Andreas Schwier f9b8b2c220 sc-hsm: Added error if private key import tried
Private key import is not supported by the SmartCard-HSM. However there is no error code
if it is still tried using pkcs15-init or from within Firefox.
2014-09-07 23:10:48 +02:00
Andreas Schwier 08f07adf59 sc-hsm: Improve error detection and reporting in sc-hsm-tool 2014-09-07 23:02:08 +02:00
Sumedha Widyadharma 1fc0a7e7d6 Merge pull request #274 from github-asmw/private-do-3
openpgp-tool: Added PRIVATE-DO-3 dump option

The bytes of private-do-3 will be written to stdout raw.
Requires pin and verify to work.

openpgp-tool: Fix private-do-3 dump for Windows

fwrite will convert line endings on Windows if the destination
is not openend in binary mode. As this actually dumps binary data,
it makes sense to reopen stdout in binary mode for the dump.

openpgp-tool: Enable dumping of all DOs

PRIVATE-DO-<X> can now be dumped via the -d/--do switches and
the DO number as a parameter.
PRIVATE-DO-[12] can be dumped without verification.
PRIVATE-DO-3 requires CHV2, PRIVATE-DO-4 CHV3.

openpgp-tool: Dump DOs as hex into a tty, binary otherwise

This prevents messing up a terminal if there really _is_
binary data in a private DO. To force the binary data to a terminal,
pipe through cat.

openpgp-tool: Hint at the pin and verify options on error

SC_ERROR_SECURITY_STATUS_NOT_SATISFIED is the error code
here when dumping a private DO without the appropriate verification.

openpgp-tool: Explictly use --raw for binary ouput

The --raw switch already exists. If present, raw binary will be written,
a pretty-printed hex/ascii representation otherwise.
2014-09-07 22:32:13 +02:00
andbil 139333f85a Fix error when signing with Swedish BankID card
Added card type check in addition to check for SC_SEC_ENV_KEY_REF_PRESENT

Added card type check in addition to check for SC_SEC_ENV_KEY_REF_PRESENT
2014-09-07 22:19:00 +02:00
Frank Morgner bb160bfd99 pkcs15-tool: fixed file reading 2014-09-07 22:13:04 +02:00
Andreas Schwier e6505b3d9c pkcs11: Fixed wrong reference to PIN object in C_SetPIN() for SO-PIN 2014-09-07 22:11:39 +02:00
Raul Metsma f80759b65e Target minimum OSX version to 10.7 2014-09-07 22:07:57 +02:00
Frank Morgner ed73851c41 fixed pkcs15 version check 2014-09-07 22:06:11 +02:00
Frank Morgner 5d6c4b391d Merge pull request #253 from github-frankmorgner/remove-deadcode
card-asepcos: removed dead code
card-authentic: removed dead code
card-belpic: removed dead code
card-epass2003: removed dead code
card-flex: removed dead code
card-gpk: removed dead code
card-oberthur: removed dead code
card-piv: removed dead code
card-setcos: removed dead code
ctbcs: removed dead code
cwa14890: removed dead code
muscle: removed dead code
pkcs15-atrust-acos: removed dead code
pkcs15-gemsafeV1: removed dead code
pkcs15-skey: removed dead code
reader-ctapi: removed dead code
framework-pkcs15: removed dead code
pkcs11-object: removed dead code
pkcs15-asepcos: removed dead code
pkcs15-cardos: removed dead code
pkcs15-jcop: removed dead code
pkcs15-lib: removed dead code
pkcs15-oberthur: removed dead code
parse: removed dead code
sclex: removed dead code
sm-card-authentic: removed dead code
sm-card-iasecc: removed dead code
sm-cwa14890: removed dead code
sm-global-platform: removed dead code
sc-test: removed dead code
pkcs11-tool: removed dead code
pkcs15-tool: removed dead code
2014-09-07 21:22:43 +02:00
Viktor Tarasov df959efab5 md: install minidriver by default 2014-09-07 21:08:54 +02:00
William Roberts 3a0ca5aa7d Remove hardcodes from Mutual Authenticate
Support nonces that are not only 8 bytes in
Mutual Authenticate. Use the witness length
to determine the nonce size, thus existing
systems using 8 bytes will continue to use 8
bytes. However, with AES 256, the nonces could
be a single block size of 16 bytes or greater.
2014-09-03 10:53:30 -07:00
Doug Engert b84a1c9a90 Merge branch 'master' of github.com:OpenSC/OpenSC 2014-09-02 16:37:45 -05:00
Doug Engert 3260ca3eab Merge pull request #270 from shootingatshadow/aes-support
Add AES support for PIV General Authenticate

 adds new routine sc_right_trim in sc.c and opensc.h. It is used by  PIV card driver when using the piv-tool.
2014-09-02 16:29:57 -05:00
Doug Engert 2de38a1230 pkcs11-tool sets CKA_DECRYPT=true rather then CKA_DERIVE=true when generating EC keys (#277)
RSA and EC keys have different usage attributes. Appropriate attributes are set
When using --keypairgen the user can use the --usage-sign, --usage-decrypt,
and --usage-derive. to get finer control.

 Changes to be committed:
	modified:   tools/pkcs11-tool.c
2014-08-26 09:59:40 -05:00
William Roberts 295c523e4e Add AES support for PIV General Authenticate
This adds algorithm IDs 0xA, 0xA, 0xC which as documented
by the NIST PIV specification is algorithms AES-128, AES-192
and AES-256 respectively.

This patch also addresses some of the hardcodes that prevented
nonces greater than the single byte TLV length tags would allow.
It was explicitly tested with AES-256 and 256 byte nonces.

Signed-off-by: William Roberts <w2.roberts@samsung.com>
2014-08-25 18:27:13 -07:00
Andreas Schwier 5279bfa2d1 sc-hsm: Prevent double-free crash if key generation fails
Fixes #262 (SEGV when reader does not support extended length ADPU)
2014-07-09 14:27:08 +02:00
Viktor Tarasov db60f8da59 release 0.14.0 2014-06-26 19:15:33 +02:00
Andreas Schwier 440289a091 sc-hsm: reduce indicated maximum PIN length to 15
Fix bogus minimum PIN length to support more PIN pad readers
2014-06-26 17:57:26 +02:00
Raul Metsma cd7fbe3f8c MacOSX: Build fat binaries i386...
revert part of 6e255a95

Chrome is still 32 bit only
This allows plugins running in Chrome (32bit) to use OpenSC PKCS#11, which would otherwise be only 64bit. Tokend "hides" the cpu architecture issue otherwise.
2014-06-26 17:56:09 +02:00
Viktor Tarasov 852a4719cf
release: OpenSC-0.14.0 RTM 2014-06-09 16:34:06 +02:00
Frank Morgner 35b74f3923 fixed warning unused variable 2014-06-09 16:03:14 +02:00
Frank Morgner 359660c454 dnie: removed dead and untested SM wrapping code 2014-06-09 15:48:20 +02:00
Raul Metsma 55bb8e9ff8 New generation card-s don't have issues with T1 and 3.5 card with same ATR has issues with T0 (recursive GET BINARY/GET DATA) 2014-06-09 15:46:13 +02:00
Andreas Schwier 072dfeb71c sc-hsm-tool: Fixed SEGV if no or invalid card in reader 2014-06-09 15:05:42 +02:00
Henryk Plötz b1b5a39ffa Use sc_pkcs15_find_pin_by_auth_id() in asepcos_create_key() to correctly set the newly created key up for use with the configured PIN. 2014-06-06 18:46:48 +02:00
Nikos Mavrogiannopoulos 77d8fa390d base64 decoding: Do not assume that char is signed.
In the systems where char is unsigned by default the base64 decoding
would crash.
2014-06-06 11:06:09 +02:00
Joachim Bauch 2f6b5174a8 Support "D-TRUST card 2.4 2ce". 2014-06-06 10:25:24 +02:00
Viktor Tarasov 3f13f571c0 openpgp-tool: issue-220: read and display OpenPGP data 2014-06-01 19:42:01 +02:00
Emanuele Pucciarelli ee0566af09 pkcs11: pr-239: PKCS15 pubkey release fix 2014-06-01 18:55:56 +02:00
Raul Metsma 77c71be833 Don't depend configuration default value 2014-05-31 21:15:19 +02:00
Raul Metsma ccf6da2dbe Add windows onepin makefile 2014-05-31 21:15:19 +02:00
Raul Metsma 8e13acf51e Restore pkcs11 onepin module for Firefox usage 2014-05-31 21:15:19 +02:00
Viktor Tarasov f87a364ddc release: candidate for the next stable version 2014-05-31 20:06:30 +02:00