Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to get pkcs11-spy to show both the start and end time of a given operation? #2894

Closed
assarbad opened this issue Oct 7, 2023 · 1 comment

Comments

@assarbad
Copy link

assarbad commented Oct 7, 2023

pkcs11-spy.so is a really great help for debugging issues around PKCS#11, thanks.

When working with it, I was wondering if there is a way to show not just the start time, but also the end time.

The reason I would like to see both is that if C_Sign is the last operation "seen" by pkcs11-spy.so, there's no time to estimate or calculate the time this operation takes. This is presumably true for any operation that comes last.

Is there an environment variable or another way to influence the level of detail pkcs11-spy.so outputs?

Thank you.

@Jakuje
Copy link
Member

Jakuje commented Oct 8, 2023

I do not think this is implemented in the OpenSC's pkcs11-spy. It just prints what it prints and there is no configuration.

One option to get annotated log, you can pass it through pipe to another script that will add time information useing something like in the following answer https://serverfault.com/a/310104

I know that NSS can print some statistics from the time each PKCS#11 operation took when the environment variable NSS_DEBUG_PKCS11_MODULE (I think) is defined. But this would mean you would have to call the singature request from the NSS.

https://www-archive.mozilla.org/projects/security/pki/nss/tech-notes/tn2

The last option would be to implement it and contribute this functionality to opensc. The pkcs11-spy is quite straight-forward and functions use macros to print specific parts, so just modifying the enter() and retne() should allow you to record and print all the information you need.

C_Sign(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants