Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copied from ima-evm-utils. |
| 4 | # |
| 5 | # This program is free software; you can redistribute it and/or |
| 6 | # modify it under the terms of the GNU General Public License |
| 7 | # version 2 as published by the Free Software Foundation. |
| 8 | # |
| 9 | # This program is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | # GNU General Public License for more details. |
| 13 | # |
| 14 | # You should have received a copy of the GNU General Public License |
| 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | |
| 17 | GENKEY=ima-local-ca.genkey |
| 18 | |
| 19 | cat << __EOF__ >$GENKEY |
| 20 | [ req ] |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 21 | distinguished_name = req_distinguished_name |
| 22 | prompt = no |
| 23 | string_mask = utf8only |
| 24 | x509_extensions = v3_ca |
| 25 | |
| 26 | [ req_distinguished_name ] |
| 27 | O = example.com |
| 28 | CN = meta-intel-iot-security example certificate signing key |
| 29 | emailAddress = john.doe@example.com |
| 30 | |
| 31 | [ v3_ca ] |
| 32 | basicConstraints=CA:TRUE |
| 33 | subjectKeyIdentifier=hash |
| 34 | authorityKeyIdentifier=keyid:always,issuer |
Andrew Geissler | dc9d614 | 2023-05-19 09:38:37 -0500 | [diff] [blame] | 35 | keyUsage = cRLSign, keyCertSign |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 36 | __EOF__ |
| 37 | |
Andrew Geissler | dc9d614 | 2023-05-19 09:38:37 -0500 | [diff] [blame] | 38 | openssl req -new -x509 -utf8 -sha256 -days 36500 -batch -config $GENKEY \ |
| 39 | -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 \ |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 40 | -outform DER -out ima-local-ca.x509 -keyout ima-local-ca.priv |
| 41 | |
| 42 | openssl x509 -inform DER -in ima-local-ca.x509 -out ima-local-ca.pem |