diff options
| author | Johannes Schneider <johannes.schneider@leica-geosystems.com> | 2025-06-27 14:18:19 +0200 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2025-06-28 11:04:24 -0700 |
| commit | f642526db57a0cd22879f23c046471ff7c1effb1 (patch) | |
| tree | 91a2c32b6524308970490a8d57b56b03cb8d4a61 | |
| parent | 5b315e2fc4884d9644b13474934ae006b530720e (diff) | |
| download | meta-openembedded-f642526db57a0cd22879f23c046471ff7c1effb1.tar.gz | |
signing.bbclass: add get_root_cert
Add a helper method to retrieve the root CA certificate for a given
role, by walking the chain that has been setup with
signing_import_set_ca up to the last element - which is the root.
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>
| -rw-r--r-- | meta-oe/classes/signing.bbclass | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/meta-oe/classes/signing.bbclass b/meta-oe/classes/signing.bbclass index 04bd92bc03..2a94f5f5b3 100644 --- a/meta-oe/classes/signing.bbclass +++ b/meta-oe/classes/signing.bbclass | |||
| @@ -194,6 +194,22 @@ signing_has_ca() { | |||
| 194 | return $? | 194 | return $? |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | # signing_get_root_cert <cert_name> | ||
| 198 | # | ||
| 199 | # return the role/name of the CA root certificate for a given | ||
| 200 | # <cert_name>, by walking the chain setup with signing_import_set_ca | ||
| 201 | # all the way to the last in line that doesn't have a CA set - which | ||
| 202 | # would be the root. | ||
| 203 | # | ||
| 204 | # To be used with SoftHSM. | ||
| 205 | signing_get_root_cert() { | ||
| 206 | local cert_name="${1}" | ||
| 207 | while signing_has_ca "${cert_name}"; do | ||
| 208 | cert_name="$(signing_get_ca ${cert_name})" | ||
| 209 | done | ||
| 210 | echo "${cert_name}" | ||
| 211 | } | ||
| 212 | |||
| 197 | # signing_import_cert_chain_from_pem <role> <pem> | 213 | # signing_import_cert_chain_from_pem <role> <pem> |
| 198 | # | 214 | # |
| 199 | # Import a certificate *chain* from a PEM file to a role. | 215 | # Import a certificate *chain* from a PEM file to a role. |
