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