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

Include uri in pkcs11-tool -L option #3125

Merged
merged 2 commits into from Apr 30, 2024

Conversation

sarroutbi
Copy link
Contributor

@sarroutbi sarroutbi commented Apr 19, 2024

Fixes: #3123

Tests performed with Yubico Yubikey 5 NFC:

$ opensc-tool -n
Using reader with a card: Yubico YubiKey OTP+CCID 00 00
Personal Identity Verification Card

@sarroutbi sarroutbi force-pushed the 202404191601-print-uri-p11-tool branch 7 times, most recently from 3558894 to c27e972 Compare April 19, 2024 15:05
@sarroutbi
Copy link
Contributor Author

sarroutbi commented Apr 19, 2024

I have also cross-checked the output with other tools, and it seems reasonable:

$ systemd-cryptenroll --pkcs11-token=list; ./src/tools/pkcs11-tool -L | grep uri | awk -F ': ' '{print $NF}' 
| tr -d ' '
URI                                                                                        LABEL  MANUFACTURER MODEL           
pkcs11:model=PKCS%2315%20emulated;manufacturer=piv_II;serial=abcdef1234567890;token=clevis clevis piv_II       PKCS#15 emulated
pkcs11:model=PKCS%2315%20emulated;manufacturer=piv_II;serial=abcdef1234567890;token=clevis

@sarroutbi sarroutbi marked this pull request as ready for review April 19, 2024 15:35
Copy link

@ccamposr ccamposr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

src/tools/pkcs11-tool.c Outdated Show resolved Hide resolved
src/tools/pkcs11-tool.c Outdated Show resolved Hide resolved
@sarroutbi sarroutbi force-pushed the 202404191601-print-uri-p11-tool branch 3 times, most recently from 5c0c15b to b645d41 Compare April 25, 2024 10:35
Fixes: OpenSC#3123

Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
@sarroutbi sarroutbi force-pushed the 202404191601-print-uri-p11-tool branch from b645d41 to 700b6e7 Compare April 25, 2024 10:39
Copy link
Member

@Jakuje Jakuje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good to go.

One possible area to extend this could be printing the URI for the objects too (which could reuse most of the current code) and some test coverage to see the URIs printed make sense. Should be quite easy to start from for example tests/test-pkcs11-tool-import.sh and grep for the important uri parts.

src/tools/pkcs11-tool.c Outdated Show resolved Hide resolved
Co-authored-by: Jakub Jelen <jakuje@gmail.com>
@sarroutbi
Copy link
Contributor Author

I think this is good to go.

One possible area to extend this could be printing the URI for the objects too (which could reuse most of the current code) and some test coverage to see the URIs printed make sense. Should be quite easy to start from for example tests/test-pkcs11-tool-import.sh and grep for the important uri parts.

Sure. I will open an issue for it and I will create a PR for that.

Thanks for your help, @Jakuje

Copy link
Member

@Jakuje Jakuje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Lets wait if others will have some comments and if not, I will merge it next week.

@Jakuje Jakuje merged commit 1fb5655 into OpenSC:master Apr 30, 2024
44 of 45 checks passed
@Jakuje
Copy link
Member

Jakuje commented Apr 30, 2024

Thank you for your contribution!

@sarroutbi sarroutbi deleted the 202404191601-print-uri-p11-tool branch April 30, 2024 07:59
@sarroutbi
Copy link
Contributor Author

I think this is good to go.

One possible area to extend this could be printing the URI for the objects too (which could reuse most of the current code) and some test coverage to see the URIs printed make sense. Should be quite easy to start from for example tests/test-pkcs11-tool-import.sh and grep for the important uri parts.

Hello Jakub. I opened #3129 for this extension.

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

Successfully merging this pull request may close these issues.

pkcs11-tool should provide an option to get slot information as pkcs11-uri
3 participants