blob: 339d3e3c5b71f2eb21d63133f4d756722ead050c [file] [log] [blame]
Brad Bishop15ae2502019-06-18 21:44:24 -04001#!/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
17GENKEY=ima-local-ca.genkey
18
19cat << __EOF__ >$GENKEY
20[ req ]
Brad Bishop15ae2502019-06-18 21:44:24 -040021distinguished_name = req_distinguished_name
22prompt = no
23string_mask = utf8only
24x509_extensions = v3_ca
25
26[ req_distinguished_name ]
27O = example.com
28CN = meta-intel-iot-security example certificate signing key
29emailAddress = john.doe@example.com
30
31[ v3_ca ]
32basicConstraints=CA:TRUE
33subjectKeyIdentifier=hash
34authorityKeyIdentifier=keyid:always,issuer
Andrew Geisslerdc9d6142023-05-19 09:38:37 -050035keyUsage = cRLSign, keyCertSign
Brad Bishop15ae2502019-06-18 21:44:24 -040036__EOF__
37
Andrew Geisslerdc9d6142023-05-19 09:38:37 -050038openssl req -new -x509 -utf8 -sha256 -days 36500 -batch -config $GENKEY \
39 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 \
Brad Bishop15ae2502019-06-18 21:44:24 -040040 -outform DER -out ima-local-ca.x509 -keyout ima-local-ca.priv
41
42openssl x509 -inform DER -in ima-local-ca.x509 -out ima-local-ca.pem