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

Add command for importing objects into a PKCS#11 token #588

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bash-completion/p11-kit
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _p11-kit()
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
return
elif [[ $cword -eq 1 ]]; then
local commands='list-mechanisms generate-keypair export-object delete-object list-objects add-profile delete-profile list-profiles list-modules list-tokens print-config extract server remote'
local commands='list-mechanisms generate-keypair import-object export-object delete-object list-objects add-profile delete-profile list-profiles list-modules list-tokens print-config extract server remote'
COMPREPLY=( $(compgen -W "$commands" -- "$cur") )
fi
} &&
Expand Down
19 changes: 18 additions & 1 deletion doc/manual/p11-kit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<cmdsynopsis>
<command>p11-kit list-objects</command> ...
</cmdsynopsis>
<cmdsynopsis>
<command>p11-kit import-object</command> ...
</cmdsynopsis>
<cmdsynopsis>
<command>p11-kit export-object</command> ...
</cmdsynopsis>
Expand Down Expand Up @@ -138,6 +141,20 @@ $ p11-kit list-objects pkcs11:token

</refsect1>

<refsect1 id="p11-kit-import-object">
<title>Import Object</title>

<para>Import object into a PKCS#11 token.</para>

<programlisting>
$ p11-kit import-object --file=file.pem &lsqb;--label=label&rsqb; &lsqb;--login&rsqb; pkcs11:token
</programlisting>

<para>This takes either a X.509 certificate or a public key in form of a PEM file
and imports it into PKCS#11 token that matches given URI.</para>

</refsect1>

<refsect1 id="p11-kit-export-object">
<title>Export Object</title>

Expand Down Expand Up @@ -171,7 +188,7 @@ $ p11-kit delete-object pkcs11:token
<para>Generate key-pair on a PKCS#11 token.</para>

<programlisting>
$ p11-kit generate-keypair &lsqb;--label=label&rsqb; --type=algorithm &lcub;--bits=n|--curve=name&rcub; pkcs11:token
$ p11-kit generate-keypair &lsqb;--label=label&rsqb; --type=algorithm &lcub;--bits=n|--curve=name&rcub; pkcs11:token
</programlisting>

<para>Generate private-public key-pair of given type on specified PKCS#11 token.
Expand Down
3 changes: 3 additions & 0 deletions p11-kit/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ p11_kit_p11_kit_SOURCES = \
p11-kit/delete-profile.c \
p11-kit/export-object.c \
p11-kit/generate-keypair.c \
p11-kit/import-object.c \
p11-kit/list-objects.c \
p11-kit/list-profiles.c \
p11-kit/list-mechanisms.c \
Expand Down Expand Up @@ -431,6 +432,7 @@ sh_tests += \
if WITH_ASN1
sh_tests += \
p11-kit/test-export-public.sh \
p11-kit/test-import-public.sh \
p11-kit/test-profiles.sh \
$(NULL)
endif
Expand Down Expand Up @@ -632,6 +634,7 @@ EXTRA_DIST += \
p11-kit/test-server.sh \
p11-kit/test-list-tokens.sh \
p11-kit/test-export-public.sh \
p11-kit/test-import-public.sh \
p11-kit/test-list-mechanisms.sh \
p11-kit/test-generate-keypair.sh \
$(NULL)
Loading