| 1 |
|
| 2 |
|
| 3 |
openCryptoki FAQ - Kent Yoder <[email protected]> |
| 4 |
----------------------------------------------------------------------------- |
| 5 |
|
| 6 |
1. Q. All openCryptoki applications are returning CKR_TOKEN_NOT_PRESENT, |
| 7 |
even though the token is there, and its STDLL is in the right place. |
| 8 |
What's the problem? |
| 9 |
|
| 10 |
A1. The user who's executing the application is probably not a member |
| 11 |
of the pkcs11 group. |
| 12 |
|
| 13 |
A2. Check that the device driver for your hardware token is loaded. |
| 14 |
(`lsmod` in Linux). |
| 15 |
|
| 16 |
A3. If you're doing development, this error will also be returned of your |
| 17 |
token's STDLL has unresolved symbols in it. Enable debugging and |
| 18 |
check the debug log to find out what symbols are undefined. |
| 19 |
|
| 20 |
2. Q. When C_Initialize() gets called by my app, openCryptoki returns |
| 21 |
CKR_HOST_MEMORY, even though I've got lots of free memory. What's |
| 22 |
the problem? |
| 23 |
|
| 24 |
A1. CKR_HOST_MEMORY is returned also if openCryptoki cannot attach |
| 25 |
to shared memory. This can happen if: |
| 26 |
|
| 27 |
a1. The user who's executing the application is not a member of |
| 28 |
the pkcs11 group. |
| 29 |
|
| 30 |
a2. pkcsslotd is not running. |
| 31 |
|
| 32 |
3. Q. pkcsconf is returning: |
| 33 |
|
| 34 |
Error getting token info: 0x2 |
| 35 |
This is CKR_HOST_MEMORY, see question 2. |
| 36 |
|
| 37 |
Error getting token info: 0x3 |
| 38 |
The slot ID you're providing is invalid. |
| 39 |
|
| 40 |
4. Q. How can I get the complete debug logs from openCryptoki? |
| 41 |
|
| 42 |
A. In opencryptoki version 3.3, tracing was introduced. There is no |
| 43 |
longer a need to compile opencryptoki with debug enabled via |
| 44 |
"configure --enable-debug" to debug problems. Trace messages are |
| 45 |
enabled via the environment variable, OPENCRYPTOKI_TRACE_LEVEL=<level>. |
| 46 |
Set this environment variable to one of several trace levels available: |
| 47 |
1 - log error messages |
| 48 |
2 - log warning messages |
| 49 |
3 - log informational messages |
| 50 |
4 - log development debug messages; these messages may help debug |
| 51 |
while developing pkcs#11 applications. |
| 52 |
5 - debug messages that are useful to opencryptoki developers; |
| 53 |
this level must be enabled via --enable-debug option in the |
| 54 |
configure script. |
| 55 |
|
| 56 |
Note: Trace messages increase as the trace level increases. |
| 57 |
In other words, trace level 4 includes all the messages from |
| 58 |
trace levels 1, 2 and 3. |
| 59 |
|
| 60 |
An additional level 5 is included for those implementing new |
| 61 |
features into opencryptoki source code. This level 5 allows for more |
| 62 |
debug output. Level 5 is enabled when compiling opencryptoki |
| 63 |
source code using "configure --enable-debug" and exporting |
| 64 |
OPENCRYPTOKI_TRACE_LEVEL=5. |
| 65 |
|
| 66 |
All trace output is logged into trace.<pid> file in the |
| 67 |
/var/log/opencryptoki directory. A trace file is created per |
| 68 |
process. |
| 69 |
|
| 70 |
Prior to opencryptoki version 3.3, opencryptoki had to be compiled |
| 71 |
with debugging enabled, i.e configure --enable-debug. Debug messages |
| 72 |
were then logged to the file specified with the |
| 73 |
OPENCRYPTOKI_DEBUG_FILE environment variable. If the environment |
| 74 |
variable was not set, then opencryptoki debug messages were not logged. |
| 75 |
Debugging does not have to be enabled for syslog messages to be |
| 76 |
logged. Syslog messages are logged according to the system's syslog |
| 77 |
configuration. |
| 78 |
|
| 79 |
For versions of openCryptoki starting with openCryptoki-2.0 and before |
| 80 |
openCryptoki-2.4, define the environment variable PKCS11_API_LOG_DEBUG=1 |
| 81 |
(in versions of openCryptoki before 2.0, define |
| 82 |
AIX_PKCS11_API_LOG_DEBUG=1). |
| 83 |
|
| 84 |
Also, apparently by default syslogd does not have an entry in |
| 85 |
/etc/syslogd.conf for debug messages, so even if you have debug |
| 86 |
messages enabled in your openCryptoki compile, you'll not get them in |
| 87 |
the system log until you edit /etc/syslogd.conf and restart syslogd. |
| 88 |
Add an entry in /etc/syslogd.conf such as: |
| 89 |
|
| 90 |
# vi /etc/syslogd.conf |
| 91 |
--- |
| 92 |
[...] |
| 93 |
|
| 94 |
*.debug /var/log/debuglog |
| 95 |
--- |
| 96 |
# killall -HUP syslogd |
| 97 |
|
| 98 |
Now, when openCryptoki is configured with the --enable-debug |
| 99 |
option (or if you install the -debug rpms), /var/log/debuglog |
| 100 |
will receive its debugging messages. |
| 101 |
|
| 102 |
|
| 103 |
----------------------------------------------------------------------------- |
| 104 |
openCryptoki FAQ |