signing.bbclass: make it work with eliptic curve keys

"openssl rsa" works with RSA keys only. Use "openssl pkey" instead which
is a frontend that picks the right operation automatically and works
with RSA keys, eliptic curve keys and also DSA keys.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Sascha Hauer 2024-02-13 10:18:12 +01:00 committed by Khem Raj
parent 399531aa09
commit c9ddb71d35
No known key found for this signature in database
GPG Key ID: BB053355919D3314

View File

@ -161,11 +161,11 @@ signing_import_pubkey_from_pem() {
local pem="${2}"
if [ -n "${IMPORT_PASS_FILE}" ]; then
openssl rsa \
openssl pkey \
-passin "file:${IMPORT_PASS_FILE}" \
-in "${pem}" -inform pem -pubout -outform der
else
openssl rsa \
openssl pkey \
-in "${pem}" -inform pem -pubout -outform der
fi |
signing_pkcs11_tool --type pubkey --write-object /proc/self/fd/0 --label "${role}"
@ -189,11 +189,11 @@ signing_import_privkey_from_pem() {
local pem="${2}"
if [ -n "${IMPORT_PASS_FILE}" ]; then
openssl rsa \
openssl pkey \
-passin "file:${IMPORT_PASS_FILE}" \
-in "${pem}" -inform pem -outform der
else
openssl rsa \
openssl pkey \
-in "${pem}" -inform pem -outform der
fi |
signing_pkcs11_tool --type privkey --write-object /proc/self/fd/0 --label "${role}"