Commit Graph

5077 Commits

Author SHA1 Message Date
Nguyễn Hồng Quân b67063dcd8 pkcs15init-openpgp: Support for private key import in pkcs15init.
Example command:
pkcs15-init --delete-objects privkey,pubkey --id 3 --store-private-key quan-key.pem  --auth-id 3 --verify-pin --extractable --id 3

pkcs15init-OpenPGP: Some parts in openpgp.profile are not used.
2012-07-29 13:09:08 +02:00
Nguyễn Hồng Quân 7123638454 OpenPGP: Correct access condition for some pubkey blobs.
OpenPGP: Don't really delete pubkeys blobs.
2012-07-29 13:09:08 +02:00
Nguyễn Hồng Quân affb38304e pkcs15-init tool: Change the order of action.
DELETE_OBJECT will be done before STORE_XXX.
2012-07-29 13:09:08 +02:00
Nguyễn Hồng Quân 70b7b4aa54 pkcs15init-OpenPGP: Add store_data functions.
We need this function to use OpenPGP's specific action flow instead pkcs15init's default.
This will help to avoid redundant steps which may make the overall process fail.
2012-07-29 13:09:08 +02:00
Viktor Tarasov 0518ced8e0 asn1: export 'asn1-write-element' function
... used by OpenPGP driver
2012-07-29 13:09:00 +02:00
Nguyễn Hồng Quân 42ad3c1dff OpenPGP: Add support for key import at driver level.
OpenPGP: Some indentations need to be tab-size-independent.

OpenPGP: Check for null data when storing fingerprints.

OpenPGP: Allow to provide creation time to store (when gen/import key).
Old: Only store current time.
New: Can provide time to store, not only calculate current time.

OpenPGP: Correct setting content of pubkey blobs after key generation.

cardctl: Add definitions to support key import in OpenPGP.

OpenPGP: Add support for key import at driver level.
2012-07-29 12:48:59 +02:00
Nguyễn Hồng Quân 69e30ead89 openpgp-tool: Key generation support.
openpgp-tool: PIN verfication support.
openpgp-tool: Add notification in case of error.
openpgp-tool: Add manual for key generation and PIN verification.
2012-07-29 12:48:45 +02:00
Nguyễn Hồng Quân 50e37aa849 OpenPGP: Correct the way to set output after generating key.
Correct the way to parse response data.
Updated wrong blob for pubkey info <~~ Fix.

OpenPGP: Store creation time after generating keys.

OpenPGP: Put_data: Handle the case that DO exists but its blob does not.
When checking DO before writing, relying on blobs only will miss the case that DO exists but its blob does not, when DO is non-readable.

OpenPGP: Set algorithm attributes before generating key.

OpenPGP: Add dependency of OpenSSL.

OpenPGP: Calculate and store fingerprint.
Calculate and store fingerprint after generating key.

OpenPGP: Update blob of pubkey info.
Update blob holding pubkey info after generating key.

OpenPGP: Add step to update card algorithms.
Update card algorithms after generating key. However, this step is not implemented yet, because of suspection about wrong data (see code comment).
2012-07-29 12:48:21 +02:00
Nguyễn Hồng Quân 8261490ec1 PKCS15-OpenPGP: Change the way emu_init return in error case. 2012-07-29 12:09:56 +02:00
Nguyễn Hồng Quân ed0e2be305 Add pkcs15init-binding for OpenPGP 2012-07-29 12:09:56 +02:00
Doug Engert 58a4821689 piv-tool -s not sending APDU - missing code
The code to send the APDU to the piv card when using
piv-tool -s xx:xx:xx... was inadvertently removed
on 2011-04-26 02:29:53 by: 1cdb3fa971
APDU parsing: switch to Frank Morgner's implementation

The missing code is replaced.

The -s option is infrequently used, so the problem
was not spotted earlier.
2012-07-29 11:29:14 +02:00
Kalev Lember 124d6e3a40 esteid: Do not set CKA_ALWAYS_AUTHENTICATE for the "Allkirjastamine" key
CKA_ALWAYS_AUTHENTICATE implies CKU_CONTEXT_SPECIFIC login, but all this
key really should need is a C_Login with CKU_USER.

The historical reason for having CKA_ALWAYS_AUTHENTICATE set was to keep
Firefox/NSS from using that particular key for SSL connections. However,
starting with Firefox 8, NSS ignores Non Repudiation certificates for
SSL and that makes the CKA_ALWAYS_AUTHENTICATE workaround unnecessary.

Now that Firefox is fixed, drop the workaround in OpenSC so that
applications that follow the pkcs11 spec wouldn't have to login twice to
access the key.
2012-07-22 20:02:24 +03:00
Nguyễn Hồng Quân 4e5ef8f1c9 PKCS15 - OpenPGP: Add more comments. 2012-07-07 19:00:36 +02:00
Nguyễn Hồng Quân 0b469ed31e OpenPGP: Add an explanation when building APDU. 2012-07-07 19:00:35 +02:00
Peter Marschall 4b9ca80434 tools docu: correct typo, improve style 2012-07-07 19:00:35 +02:00
Peter Marschall 8583197b6b opensc-explorer docs: various improvements
* document the UNBLOCK function
* format the examples better, and explain what they do
* extend the documentation for CD
2012-07-07 19:00:26 +02:00
Nguyễn Hồng Quân cf6b5e7903 pkcs15init: Add more debug log. 2012-07-07 18:42:36 +02:00
Frank Morgner 31bdbd6b6a use error code if no SM was applied 2012-07-05 10:12:34 +02:00
Diego Elio Pettenò 1d6fae2241 build: use autoconf's MKDIR_P not automake's (deprecated) mkdir_p. 2012-07-01 17:03:27 +02:00
Mathias Brossard e423bac474 Move case block so that fall-through works as intended 2012-06-28 16:59:40 +02:00
Mathias Brossard bfbef6fe2b Support key type inference for CKM_GOSTR3410_KEY_PAIR_GEN 2012-06-28 16:56:59 +02:00
Mathias Brossard 3fc4547e45 Add CKM_GOSTR3410_KEY_PAIR_GEN if card supports onboard generation 2012-06-26 10:48:49 +02:00
Viktor Tarasov 0914b1eca7 libopensc: SM: not all the APDUs need to be wrapped
For some cards some APDUs are always transmitted in a plain mode,
even if SM session is opened.
For these APDUs the 'get_sm_apdu' card's handler returns SUCCESS without wrapped APDU version.
In such cases 'transmit' is called for the plain APDU.
2012-06-19 18:04:37 +02:00
Viktor Tarasov 68e217ceee pkcs15: free NULL key is not error
when freeing key object, do not throw an error if supplied key pointer is NULL;

sc_pkcs15_free_prkey() procedure should not free the supplied key pointer,
the body of this procedure is replaced by body of sc_pkcs15_erase_prkey().
staitc sc_pkcs15_erase_prkey() is not more used.
2012-06-19 17:58:12 +02:00
Viktor Tarasov f9a13179d8 AuthentIC: when using SM decrease max-send-size value
update list of APDUs that always sent in plain (non SM wrapped) mode
2012-06-19 17:37:51 +02:00
Peter Marschall 34541e95c4 OpenPGP: add LOG_FUNC_CALLED() for "symmetric" logging 2012-06-17 10:49:00 +02:00
Nguyễn Hồng Quân 8db8f76bad OpenPGP: Change whitespace. 2012-06-16 15:43:51 +02:00
Nguyễn Hồng Quân ccb1067d75 OpenPGP: Correct the APDU preparation step for key generation. 2012-06-16 15:43:09 +02:00
Peter Marschall 0b0aae8bc8 openpgp-tool: remove unnecessary commas in man page 2012-06-16 15:35:04 +02:00
Peter Marschall db06b043ca PKCS15 - OpenPGP: re-factor certificate object init
restrict scope of some variables.
2012-06-15 14:56:46 +02:00
Nguyễn Hồng Quân 735883d8f6 PKCS15 - OpenPGP: Change way to check certificate object.
Old: If cert is missing, raise error.
New: If cert have data, declare object, otherwise, just ignore it.
2012-06-15 14:45:44 +02:00
Nguyễn Hồng Quân 5e295ba08d OpenPGP: Remove unused constants. 2012-06-15 14:40:14 +02:00
Viktor Tarasov c64a5f34d3 pkcs15init: application path selection in bind procedure
Application path can contain non-zero length path value and AID.
In this case select AID as DF_NAME only if length of path value is zero.

Segfault: dereferencing NULL pointer, thanks to Magosányi Árpád
2012-06-13 08:31:46 +02:00
Viktor Tarasov d3dbe444e1 pkcs15-init: coverity scan warning NEGATIVE-RETURNS
CID 402540: Argument cannot be negative (NEGATIVE_RETURNS)
2012-06-11 21:28:37 +02:00
Viktor Tarasov 61254f8651 muscle: coverity scan warning OVERRUN-STATIC
CID 402559: Out-of-bounds access (OVERRUN_STATIC)
CID 402558: Out-of-bounds access (OVERRUN_STATIC)
2012-06-11 21:18:51 +02:00
Viktor Tarasov ce23bba622 gemsafeV1: coverity scan warning OVERRUN-STATIC
CID 402560: Out-of-bounds read (OVERRUN_STATIC)
2012-06-11 21:08:21 +02:00
Viktor Tarasov aa46a210fc iasecc: coverity scan warning OVERRUN-STATIC
CID 402562: Out-of-bounds read (OVERRUN_STATIC)
2012-06-11 20:59:45 +02:00
Viktor Tarasov 12dcf13236 pkcs15-init: coverity scan warning RESOURCE-LEAK
CID 402619: Resource leak (RESOURCE_LEAK)
2012-06-11 20:10:42 +02:00
Viktor Tarasov c6f4e09477 pkcs15-tool: coverity scan warning RESOURCE-LEAK
Coverity scan CID 402622: Resource leak (RESOURCE_LEAK)
2012-06-11 20:04:08 +02:00
Viktor Tarasov 62eb0d05d7 jcop: coverity scan warning RETURN_LOCAL
CID 402623: Pointer to local outside scope (RETURN_LOCAL)
2012-06-11 19:59:36 +02:00
Viktor Tarasov 629c0e8df4 libopensc: resource leak coverity scan warning
Coverity warning CID: 203380: RESOURCE_LEAK;
use short call form of the debug messages;
code layout.
2012-06-11 19:45:26 +02:00
Viktor Tarasov 9466891752 openpgp: coverity scan warning MISSING_RETURN
Coverity Scan CID: 709045
2012-06-11 18:51:06 +02:00
Viktor Tarasov a305f4a99b build: increase minor version number
let's start to prepare next release
2012-06-10 14:32:46 +02:00
Peter Marschall a09f304817 OpenPGP: clean up & fix pgp_delete_file()
* use LOG_FUNC_CALLED() .. LOG_FUNC_RETURN for "symmetric" logging
* don't zero-fill the DO's contents but empty it
* get rid of unnecessary variables
* select parent DF after deletion (required by to ISO 7816-9)
* don't try to delete MF
2012-06-09 13:48:09 +02:00
Peter Marschall 2aa4cf57ed OpenPGP: simplify pgp_update_binary() even more
Fail on idx > 0 in order to avoid the requirement to read from the DO.
The DO may be read-protected, and this might either fail or produce
wrong results.
2012-06-09 13:48:09 +02:00
Peter Marschall d7f58f7ea7 OpenPGP: cleanup & fix pgp_update_binary()
* use LOG_FUNC_CALLED() .. LOG_FUNC_RETURN for "symmetric" logging
* update comment
* check that blob->data is defined
* fix writing new data to the correct offset
* use calloc() instead of malloc() & memset()
* align pgp_ops function pointer list
2012-06-09 13:48:09 +02:00
Peter Marschall c8e802eab6 OpenPGP: simplify & clean up pgp_put_data()
* make sure variables of type u8 do only get passed fitting data
* use LOG_FUNC_CALLED() .. LOG_FUNC_RETURN for "symmetric" logging
* leave most of the spcial casing in ADPU handling to sc_adpu_transmit()
* use SC_ADPU_CASE_1 for empty buffer (avoids special casing Lc=0)
* clean up log strings & comments
2012-06-09 13:48:09 +02:00
Peter Marschall 0010fcbe6b OpenPGP: make pgp_set_blob() a bit more resilient
* use calloc() instead of malloc() to have defined contents
* only copy from passed data when it is not NULL
2012-06-09 13:48:09 +02:00
Nguyễn Hồng Quân 73387d4b84 OpenPGP: Correct ACL key_ref
Correct ACL key_ref after redefining conventional OpenPGP key-ref (0x81-0x83 -> 1-3).
2012-06-09 08:04:19 +02:00
Peter Marschall 825c8578a9 tools: fix typo/thinko in util_print_usage_and_die()
Fix a typo/thinko in util_print_usage_and_die() that led to the short option
names not to be shown at all.
2012-06-08 20:32:33 +02:00