mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] ptxd_lib_code_signing: only import public key in cs_import_pubkey_from_pem
@ 2026-06-23 14:12 Sven Püschel
  2026-06-25 19:23 ` [ptxdist] [APPLIED] " Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Püschel @ 2026-06-23 14:12 UTC (permalink / raw)
  To: ptxdist; +Cc: Martin Domig, Sven Püschel

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-25 19:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-23 14:12 [ptxdist] [PATCH] ptxd_lib_code_signing: only import public key in cs_import_pubkey_from_pem Sven Püschel
2026-06-25 19:23 ` [ptxdist] [APPLIED] " Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox