mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-09-10 18:49:40 +00:00
signing.bbclass: add signing_extract_cert helpers
Add extract-cert wrapping helper functions, to easily extract certificates again that had been previously imported into the softhsm. Reviewed-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
parent
b6915f6399
commit
d1b6f528a5
@ -54,7 +54,7 @@
|
|||||||
SIGNING_PKCS11_URI ?= ""
|
SIGNING_PKCS11_URI ?= ""
|
||||||
SIGNING_PKCS11_MODULE ?= ""
|
SIGNING_PKCS11_MODULE ?= ""
|
||||||
|
|
||||||
DEPENDS += "softhsm-native libp11-native opensc-native openssl-native"
|
DEPENDS += "softhsm-native libp11-native opensc-native openssl-native extract-cert-native"
|
||||||
|
|
||||||
def signing_class_prepare(d):
|
def signing_class_prepare(d):
|
||||||
import os.path
|
import os.path
|
||||||
@ -453,6 +453,30 @@ signing_get_module() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# signing_extract_cert_der <role> <der>
|
||||||
|
#
|
||||||
|
# Export a certificate attached to a role into a DER file.
|
||||||
|
# To be used with SoftHSM.
|
||||||
|
signing_extract_cert_der() {
|
||||||
|
local role="${1}"
|
||||||
|
local output="${2}"
|
||||||
|
|
||||||
|
extract-cert "$(signing_get_uri $role)" "${output}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# signing_extract_cert_pem <role> <pem>
|
||||||
|
#
|
||||||
|
# Export a certificate attached to a role into a PEM file.
|
||||||
|
# To be used with SoftHSM.
|
||||||
|
signing_extract_cert_pem() {
|
||||||
|
local role="${1}"
|
||||||
|
local output="${2}"
|
||||||
|
|
||||||
|
extract-cert "$(signing_get_uri $role)" "${output}.tmp-der"
|
||||||
|
openssl x509 -inform der -in "${output}.tmp-der" -out "${output}"
|
||||||
|
rm "${output}.tmp-der"
|
||||||
|
}
|
||||||
|
|
||||||
python () {
|
python () {
|
||||||
signing_class_prepare(d)
|
signing_class_prepare(d)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user