From: "Sven Püschel" <s.pueschel@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: "Martin Domig" <martin.domig@wolfvision.net>,
"Sven Püschel" <s.pueschel@pengutronix.de>
Subject: [ptxdist] [PATCH] ptxd_lib_code_signing: only import public key in cs_import_pubkey_from_pem
Date: Tue, 23 Jun 2026 16:12:31 +0200 [thread overview]
Message-ID: <20260623141303.1126598-1-s.pueschel@pengutronix.de> (raw)
From: Martin Domig <martin.domig@wolfvision.net>
Only import the public key in cs_import_pubkey_from_pem, as without
the -pubin flag the 'openssl pkey' command tries to import
a private key. This is a problem, when only the public key is available
in the PEM file (e.g. production key instead of a development key).
This results in the following error:
Could not find private key of key from pubkey.pem
40238C2FB57F0000:error:1608010C:STORE routines:ossl_store_handle_load_result:unsupported:crypto/store/store_result.c:160:provider=default
>From the man page of `openssl pkey` the -pubin flag also works with a
private key input. In this case openssl will only read the public part.
Signed-off-by: Martin Domig <martin.domig@wolfvision.net>
Co-developed-by: Sven Püschel <s.pueschel@pengutronix.de>
Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
---
scripts/lib/ptxd_lib_code_signing.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/lib/ptxd_lib_code_signing.sh b/scripts/lib/ptxd_lib_code_signing.sh
index c7bcfc257..aa4ef9984 100644
--- a/scripts/lib/ptxd_lib_code_signing.sh
+++ b/scripts/lib/ptxd_lib_code_signing.sh
@@ -237,7 +237,7 @@ cs_import_pubkey_from_pem() {
openssl pkey \
"${openssl_keyopt[@]}" \
- -in "${pem}" -inform pem -pubout -outform der -out "/proc/self/fd/${tmpfd}"
+ -pubin -in "${pem}" -inform pem -pubout -outform der -out "/proc/self/fd/${tmpfd}"
softhsm_pkcs11_tool --type pubkey --write-object "/proc/self/fd/${tmpfd}" --label "${role}"
check_pipe_status
}
--
2.47.3
next reply other threads:[~2026-06-23 14:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 14:12 Sven Püschel [this message]
2026-06-25 19:23 ` [ptxdist] [APPLIED] " Michael Olbrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260623141303.1126598-1-s.pueschel@pengutronix.de \
--to=s.pueschel@pengutronix.de \
--cc=martin.domig@wolfvision.net \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox