blob: b6007614ab719f941d2f7bad5d6e5a7c4f4c1d60 [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 ]
21default_bits = 2048
22distinguished_name = req_distinguished_name
23prompt = no
24string_mask = utf8only
25x509_extensions = v3_ca
26
27[ req_distinguished_name ]
28O = example.com
29CN = meta-intel-iot-security example certificate signing key
30emailAddress = john.doe@example.com
31
32[ v3_ca ]
33basicConstraints=CA:TRUE
34subjectKeyIdentifier=hash
35authorityKeyIdentifier=keyid:always,issuer
36# keyUsage = cRLSign, keyCertSign
37__EOF__
38
39openssl req -new -x509 -utf8 -sha1 -days 3650 -batch -config $GENKEY \
40 -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