Commit Graph

5012 Commits

Author SHA1 Message Date
Peter Marschall 9e04ae46bb OpenPGP: implement pgp_find_blob()
Replace the "one-trick-pony" pgp_do_iswritable() with a more generic
function returning the blob matching the passed tag.

This way we can get rid of the one-line function pgp_blob_iswritable() too.
comparisons like these can be done in the caller.
2012-06-08 20:17:35 +02:00
Peter Marschall f5dc252aa9 OpenPGP: set pin references to 0x01 - 0x03
Set pin references to 0x01 - 0x03 instead of 0x81 - 0x83.
The PINs are referenced as PIN1- PIN3 (resp. PW1 - PW3) in the OpenPGP
card specification.
Technically the APDUs to verify/change the PINs contain the values OR-ed
with 0x80, but this is just a technical detail of the implementation
which the emulated file system can hide in pgp_pin_cmd().

Pros & Cons:
+ consistent PIN naming
+ no trouble entering the correct PIN names in opensc-explorer et.al.
  ("verify CHV1" is way better than "verify CHV129")
- manually entering the correct APDU for VERIFY is a bit more complex.
  (who does this anyway, when there are better functions)

While at it, change if .. elsif ... cascade to switch statement.
2012-06-08 20:17:35 +02:00
hongquan 89c1dd37e4 OpenPGP PKCS#15: Add declaration of certificate object. Allow to read
certificate via PKCS#11 (not writing yet).
2012-06-08 20:17:35 +02:00
hongquan f515ed5be3 OpenPGP: Change the criteria to use ext APDU for put data.
Saner whitespace in logs
Correct spelling
2012-06-08 20:17:35 +02:00
hongquan df39590aa4 OpenPGP: Correct adding read access to ACL. 2012-06-08 20:17:35 +02:00
hongquan e269907e1d OpenPGP: support key generation in driver. 2012-06-08 20:17:35 +02:00
Nguyễn Hồng Quân 9dd5a64d43 OpenPGP: Support another variant of PUT DATA to write to Extended Header list. 2012-06-08 20:17:35 +02:00
Nguyễn Hồng Quân fefe8bf2e6 OpenPGP: Check data size in pgp_put_data. 2012-06-08 20:17:35 +02:00
Nguyễn Hồng Quân f188a5dda3 OpenPGP: Implement pgp_update_binary() to update file content. 2012-06-08 20:17:35 +02:00
Nguyễn Hồng Quân 935a7505d7 OpenPGP: Add Access Control List for emulated files. 2012-06-08 20:17:35 +02:00
Nguyễn Hồng Quân c891544990 OpenPGP: Use command chaining to send large data if extended APDU is not supported. 2012-06-08 20:17:35 +02:00
Peter Marschall 387da4c793 opensc-explorer: document 'echo' command 2012-06-08 20:17:35 +02:00
Nguyễn Hồng Quân f3955e2475 opensc-explorer: implement put_data
opensc-explorer: use larger buffer for put_data
2012-06-08 20:17:35 +02:00
Nguyễn Hồng Quân 5673d13c15 OpenPGP: implement pgp_delete_file() 2012-06-08 20:17:35 +02:00
Nguyễn Hồng Quân 72088b6eeb OpenPGP: implement pgp_strip_path()
Strip away the non-existant DF 5015 from paths passed the driver.
2012-06-08 20:17:35 +02:00
Nguyễn Hồng Quân f7785ad1ec OpenPGP: correct use of pin_reference 2012-06-08 20:17:34 +02:00
Nguyễn Hồng Quân 3ac834e277 OpenPGP: implement pgp_put_data() 2012-06-08 20:17:34 +02:00
Nguyễn Hồng Quân a1ed22b6fd OpenPGP: implement pgp_do_iswritable() 2012-06-08 20:17:34 +02:00
Nguyễn Hồng Quân d8d6902699 OpenPGP: implement pgp_seek_blob() 2012-06-08 20:17:34 +02:00
Nguyễn Hồng Quân 7e24102f2b OpenPGP: Make DO 7F21 treated as simple DO
Make DO 7F21 treated as simple DO, to make certificate contained in it visible.
2012-06-08 20:17:34 +02:00
Ludovic Rousseau 02a2b3d887 Display the flags argument of C_Initialize()
The the pInitArgs argument of C_Initialize() is not NULL it is a pointer
to a CK_C_INITIALIZE_ARGS structure.
This structure contains a flags bitfield with possible values:
- CKF_LIBRARY_CANT_CREATE_OS_THREADS
- CKF_OS_LOCKING_OK

This flags parameter is now parsed and displayed.
2012-06-04 15:42:57 +02:00
Viktor Tarasov 2cff47d9b3 pkcs11-tool: support for secret-key objects
support of 'secret-key' objects
key conversion procedures are now in libopensc library
change name for OPENSC NON-REPUDIATION CKA attribute
2012-06-02 18:25:23 +02:00
Viktor Tarasov 53330f9f89 tools: avoid possible matching of zero length ATR 2012-06-01 16:58:47 +02:00
Viktor Tarasov c7258a6b52 pkcs15-tool: list secret keys objects ...
and print its attributes.
Print attributes of 'authentication-key' object.
2012-06-01 16:58:47 +02:00
Viktor Tarasov 525f61af73 pkcs15-init: 'erase-application', 'update-lastUpdate', ...
New operations:
- 'erase-application' -- erase on-card application indicated by it's AID;
- 'update-lastupdate' -- parse tokenInfo, set 'lastUpdate' value to the current date and write back tokenInfo content;
- 'ignore-ca-certificates' -- when importing PKCS#12 ignore all CA certificates;
2012-06-01 16:58:47 +02:00
Viktor Tarasov fbc9bb35dc opensc-explorer: when printing file content read entire file
When reading and printing file content, do not read it by small chunks,
but read an entire file.
It allows to verify how card driver reads the data of maximal size
that is allowed for one transaction ('max_recv_size').
2012-06-01 16:58:47 +02:00
Viktor Tarasov d7022d3300 ias-ecc: add tool with IAS/ECC specific query operations 2012-06-01 16:58:39 +02:00
Viktor Tarasov 635be92a0c pkcs15init: call sc_profile_finish() with 'app-info' data ...
call sc_profile_finish() with application info data as an argument;
in delete-by-path procedure, when getting authorization to delete file, make distinction between 'DELETE' and 'DELETE-SELF';
call card specific 'store' handler updating PrKDF and PubKDF files;
deduce the private key pkcs#15 attributes (like subject) from the friend certificate;
ignore SM authentication type when getting authorisation for operation;
copy GUID from the object create data to the pkcs#15 object attributes.
2012-05-31 18:33:50 +02:00
Viktor Tarasov 7819e5ab89 minidriver: 'write' mode
Picked from SM branch of OpenSC, where it was tested mostrly with IAS/ECC card.
Also was used with rutoken and other cards.
2012-05-31 17:21:21 +02:00
Viktor Tarasov 6c2fa7b462 pkcs15-skey: support for 'SecretKey' object type
For a while only implemented decoding of 'genericSecretKey', 'desKey', 'des2Key' and 'des3Key' keys.
2012-05-31 11:36:04 +02:00
Viktor Tarasov 1d2661c7ce pkcs15-pin: 'PIN' as particular choice of 'AuthenticationType'
Encode/decode 'PIN' pkcs15 object as particular choice of 'AuthenticationType' data.
Rudimental encoding/decoding of 'authKey' object.
2012-05-31 10:37:38 +02:00
Viktor Tarasov 666e08ffde pkcs15-pubkey: add 'subjectName' to 'CommonPubKeyAttributes'
Decode/encode 'subjectName' attribute from the 'CommonPubkeyAttributes'
Use macros for the size of the asn1_entry tables.
Use short call form for debug messages.
Procedure to convert the pkcs15 public key to EVP_PKEY type key.
Coding style issues.
2012-05-31 10:26:38 +02:00
Viktor Tarasov 4be79f3d30 pkcs15-prkey: 'algReference' from 'CommonKeyAttributes'
Decoding/encoding of the 'algReference' attribute from the 'CommonKeyAttributes'.
Use macros for the size of the asn1_entry tables.
Use short call form for debug messages.
Procedure to deduce from certificate the attributes of private key PKCS#15 object.
Procedure to convert the pkcs15 private key to EVP_PKEY type key.
Coding style issues.
2012-05-31 09:32:21 +02:00
Viktor Tarasov f7b5a6b6af PIV: pickup card driver from the SM branch
... where it was tested by Douglas.
2012-05-30 19:40:05 +02:00
Viktor Tarasov fe80ffdbd2 pkcs11-spy: invalid ExpandEnvironmentStrings() call parameter
pkcs11-spy.c(168) : warning C4047: 'function' : 'DWORD' differs in levels of indirection from 'DWORD *'
pkcs11-spy.c(168) : warning C4024: 'ExpandEnvironmentStringsA' : different types for formal and actual parameter 3
pkcs11-spy.c(205) : warning C4047: 'function' : 'DWORD' differs in levels of indirection from 'DWORD *'
pkcs11-spy.c(205) : warning C4024: 'ExpandEnvironmentStringsA' : different types for formal and actual parameter 3
2012-05-30 10:08:30 +02:00
Peter Marschall aca314b1f8 opensc-explorer: remove outdated usage text for verify
Wuth the key types explicitly listed in the usage line,
it is not necessary to list them separately.
2012-05-30 09:39:12 +02:00
Peter Marschall f04a1c5fef OpenPGP: stricter validity checks in PKCS15 init
Only add private/public keys that habe been defined:
check finger prints & algorithm identifier
2012-05-30 09:39:12 +02:00
Peter Marschall 742186f32f OpenPGP: remove unnecessary call to sc_get_data 2012-05-30 09:39:12 +02:00
Peter Marschall d38d615025 OpenPGP: parse more (extended) capabilities on init
* parse more extened capabilities & features into a private enum
* for v2.0 cards, always parse the "historical bytes" DO
  reason: ATR may be static and thus cannot reflect the state
2012-05-30 09:39:12 +02:00
Peter Marschall 67136b1781 OpenPGP: revert 7b4532736e
PKCS#15 spec v1.1 says:
TokenInfo.version: This field contains the number of the particular version
of this specification the application is based upon. For this version of this
document, the value of version shall be 0 (v1).

Thanks to Martin Paljak for the finding.
2012-05-30 09:39:12 +02:00
Peter Marschall 93cb77079b tools: re-factor usage message function
* change order of long & short option names: letters first, then the long names
  Effect: nicely aligned short and long option names in the help text
* more space between option names and explanation
  Effect: better readability on long options
* print "Options:" header only if there is at least one non-hidden options
  Effect: nicer output when all options are hidden
* only show printable, non-space short options letters
  Effect: no control codes printed to terminal
* get rid of a temporary variable
2012-05-30 09:39:12 +02:00
Peter Marschall 367ebd94d4 tools: allow arguments to be printed in usage message
Extend util_print_usage_and_die() by a string argument that describes
further arguments to the program.

1st user: opensc-explorer
2012-05-30 09:39:12 +02:00
Peter Marschall 61ca69c251 OpenPGP: documentation for openpgp-tool 2012-05-30 09:39:12 +02:00
Peter Marschall 8238239852 OpenPGP: extend openpgp-tool 2012-05-30 09:39:12 +02:00
Peter Marschall c58e94810b opensc-explorer: update documentation 2012-05-30 09:39:12 +02:00
Peter Marschall 965d44ec40 opensc-explorer: use case-insensitive pin types in PACE 2012-05-30 09:39:12 +02:00
Peter Marschall cd2cdf77f6 opensc-explorer: explicitly mention key types 2012-05-30 09:39:12 +02:00
Peter Marschall 2276c7e7e4 opensc-explorer: do not use hard-coded string length
Determine length of prefix dynamically instead of using a hard-coded, common
value for all prefixes.
2012-05-30 09:39:12 +02:00
Peter Marschall 2efc9b76df opensc-explorer: document new command line parameter SCRIPT 2012-05-30 09:39:11 +02:00
Peter Marschall 458517783c OpenPGP: fix access conditions for DOs
Follow the specs.
2012-05-30 09:39:11 +02:00