Commit Graph

30 Commits

Author SHA1 Message Date
Doug Engert f704e4f23e Pkcs11-tool changes to test a modules ability to use threads
Option --use-locking has C_Initialize pass in parameters with the
CKF_OS_LOCKING_OK to tell module to use threads. The default is it passes NULL
which says threads are not needed.

The following is not designed to be used by the general user. There are for debugging
and test scripts and only compiled if the system has threads.

    Option --test-threads <arg> can be passed multiple times. Each one starts a thread.
    <arg> is a list of 2 byte commands seperated by ":". The thread will execute these.
    Current commands are:
       IN - C_Initialize(NULL)
       IL - C_Initialize with CKF_OS_LOCKING_OK
       Pn - Pause for n seconds
       GI - C_GetInfo
       SL - C_GetSlotList
       Tn - C_GetTokenInfo  from slot_index n

These are just enough calls to see if threads are working in the module.
Output is written to stderr.

 Changes to be committed:
	modified:   doc/tools/pkcs11-tool.1.xml
	modified:   src/tools/Makefile.am
	modified:   src/tools/pkcs11-tool.c
2021-01-26 12:50:39 +01:00
Doug Engert d369965a7f pkcs11-tool support key-gen for GENERIC secret key
Fixes #2139

Added code to support  mechanism GENERIC-SECRET-KEY-GEN.

Improved --help  and doc/tools/pkcs11-tool.1.xml because key gen
of symmetric keys pass CKA_VALUE_LEN which is length of key in bytes.

Tested with:

./pkcs11-tool --module /usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so \
 --login --label generic-64 --keygen --key-type GENERIC:64 \
 --mechanism GENERIC-SECRET-KEY-GEN

./pkcs11-tool --module /usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so --login -O
2021-01-26 12:34:15 +01:00
Jakub Jelen 7f9e8ba85c pkcs11-tool: Add option to list PKCS #11 3.0 interfaces 2021-01-11 14:49:22 +01:00
Conrado P. L. Gouvea 40da5cace2 pkcs11-tool: add --allow-sw flag that removes CKF_HW and allows using software tokens 2020-09-28 12:59:58 +02:00
Peter Marschall 16c889cf7d spelling fixes
Fix various spelling errors, mostly in comments but also in texts displayed.

Errors found & interactively fixed using 'codespell', with additional manual
checks after the fixes.
2020-08-30 10:35:14 +02:00
Frank Morgner 0cd19b59e1 pkcs11-tool: add --usage-wrap (disabled by default)
fixes https://github.com/OpenSC/OpenSC/issues/1913
2020-02-01 22:29:35 +01:00
Raul Metsma 3a192e2c87 pkcs11-tool: Add extractable option to key import
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-06-03 10:59:58 +02:00
Raul Metsma 91a1dd9af4 Option to delete object by index
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-04-17 14:38:40 +02:00
Jakub Jelen fc4d600634 pkcs11-tool: Allow to set CKA_ALLOWED_MECHANISMS when creating an objects
Also list them in the attributes listing
2019-04-08 11:15:19 +02:00
Mat e19fe680c4 Add object type "secrkey" to help of --type switch in pkcs11-tool (#1575)
* Add object type "secrkey" to help of --type switch in pkcs11-tool

Reading an object with pkcs11-tool requires the `--type` switch. The help for that switch is currently incomplete as it is missing the (not very friendly named" *secrkey* option used to read out a secret key object.

I have added this information to the help description.

* Update man page

Describe secrkey option of pkcs11-tool's --type switch in man page
2019-01-15 07:32:41 +01:00
Hannu Honkanen 9e5a324903 Edited according to PR review: CKA_ALWAYS_AUTHENTICATE only associated with private keys. Defined a custom attribute to achieve same functionality with secret keys. Updated man pages. 2018-12-05 12:10:42 +01:00
Jakub Jelen 9a853176b8 pkcs11-tool: Support for signature verification
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2018-09-30 21:23:27 +02:00
Jakub Jelen fb94b639bc doc: Fix the pkcs11-tool example
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2018-09-30 21:23:27 +02:00
Frank Morgner 1798bbe692 manuals: added missing "Authors" section 2018-05-16 13:43:25 +02:00
Peter Marschall 5abe99d228 fix typos
Mass-typo fixing, almost exclusively in comments and text strings.

While at it also fixed a few (very few) grammar errors.
2018-04-15 09:34:45 +02:00
Jakub Jelen 29a27dd6d7 pkcs11-tool: Add examples section to the manual page 2018-04-13 09:28:09 +02:00
Jakub Jelen 161e83a243 Add missing pkcs11-tool options to man page 2018-04-04 21:43:01 +02:00
AnthonyA 74885fb1c1 pkcs11-tool: allow mechanism to be specified in hexadecimal
To support vendor mechanisms, let -m accept hexadecimal strings,
e.g., -m 0x80001234
2018-03-31 21:39:53 +02:00
Jakub Jelen 391ad1db01 Use filename replacement to allow completion 2018-02-07 11:13:09 +01:00
Jakub Jelen 5cb0484ea6 Correctly autocomplete --write-object option 2018-02-07 11:13:09 +01:00
Mouse e4c589639d Add support in pkcs11-tool and pkcs11-spy for RSA-OAEP (#1169)
* Add RSA-OAEP documentation
* Add definitions and structures needed for RSA-OAEP
* Add ability to display RSA-OAEP parameters to SPY

Closes https://github.com/OpenSC/OpenSC/issues/1170
2017-10-19 22:12:47 +02:00
Jakub Jelen bdb1961dee Enable RSA-PSS signatures in pkcs11-tool (#1146)
* Add missing SHA224 RSA algorithms

* Fix wrong replacement in pkcs11-tool manual page

* Add MGF and PSS_PARAMS definitions in PKCS#11 header file

* Inspect PSS signature parameters in pkcs11-spy

* Enable RSA-PSS signatures in pkcs11-tool

* Added short names to RSA-PSS methods

* Reintroduce portable NORETURN indication for functions and use it to avoid compilers complaining
2017-09-21 11:19:22 +02:00
Christoph Müllner c77cb511d9 pkcs11-tool: Add feature to get random data. (#995)
* pkcs11-tool: Add feature to get random data.

Getting random data is an essential part of the PKCS11 API.
This patch provides a new command line parameter to get
random data from the pkcs11-tool.

Tested with a Yubikey (PIV applet) and the following command line:

$ pkcs11-tool --slot=0 --generate-random=128 | hexdump -C
  00000000  0c 35 85 2e 85 68 ab ce  e8 56 b3 f6 f3 33 e6 37  |.5...h...V...3.7|
  00000010  12 10 eb fd 8a 1e 75 b7  3f 4d fa 61 8f ab d8 bf  |......u.?M.a....|
  00000020  f7 2c 7d ba 07 a5 45 6e  a7 85 1c 47 3b 46 01 2c  |.,}...En...G;F.,|
  00000030  79 18 6e 51 4d c4 ae 20  37 37 1d 7b 7e b0 d5 18  |y.nQM.. 77.{~...|
  00000040  ef a4 3c 09 91 68 db dd  2a a8 fc b9 34 06 2a ee  |..<..h..*...4.*.|
  00000050  5a 86 55 54 11 1f ef 4e  07 73 79 27 0a e4 58 cf  |Z.UT...N.sy'..X.|
  00000060  f4 bd bc 2f ad 27 b1 a7  a4 fa c7 1a 7b 31 de a3  |.../.'......{1..|
  00000070  e8 dc 85 28 18 82 00 45  3c f8 eb 48 a4 20 e4 3b  |...(...E<..H. .;|
  00000080

Signed-off-by: Christoph Müllner <christophm30@gmail.com>

* pkcs11-tool: Add documenation for --generate-random.

Signed-off-by: Christoph Müllner <christophm30@gmail.com>
2017-03-27 10:52:38 +02:00
Jakub Jelen 972a93ab47 pkcs11-tool.1.xml: Add documentation for missing options in pkcs11-tool 2016-04-17 12:56:18 +02:00
Viktor Tarasov f0189e8378 pkcs11-tool: option to 'decrypt some data' 2015-04-30 15:57:44 +02:00
Frank Morgner 4459e146c4 use util_get_pin in tools 2014-11-04 22:07:07 +01:00
Ludovic Rousseau 5979e2fed8 Add documentation for --list-token-slots, -T 2013-10-20 13:32:45 +02:00
Peter Marschall 6a6898a2ea pkcs11-tool.1.xml: sort options alphabetically 2011-08-21 13:47:48 +02:00
Peter Marschall a9c320f8f8 doc/tools/*.xml: more consistent formatting
uUse specific tags:
<command> for commands
<option> for options
<replaceable> for values that need to be replaced with real values
2011-08-21 13:47:48 +02:00
Peter Marschall aa5974bf58 doc/tools/*.xml: include manpage sections in file names
Rename source XML files so that their names contain the manpage sections.
2011-08-20 16:54:35 +02:00