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