blob: 5ee876c0522534581dcba3239831bd1ad8145724 [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.genkey
18
19cat << __EOF__ >$GENKEY
20[ req ]
21default_bits = 1024
22distinguished_name = req_distinguished_name
23prompt = no
24string_mask = utf8only
25x509_extensions = myexts
26
27[ req_distinguished_name ]
28O = example.com
29CN = meta-intel-iot-security example signing key
30emailAddress = john.doe@example.com
31
32[ myexts ]
33basicConstraints=critical,CA:FALSE
34keyUsage=digitalSignature
35subjectKeyIdentifier=hash
36authorityKeyIdentifier=keyid
37__EOF__
38
39openssl req -new -nodes -utf8 -sha1 -days 36500 -batch \
40 -x509 -config $GENKEY \
41 -outform DER -out x509_ima.der -keyout privkey_ima.pem