You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libsxmp/scripts/create-x509-example.sh

29 lines
718 B
Bash

#!/bin/sh
#
# Libsxmp i.e. Secure X (for 10) Message Passing library
#
# This script generates CA primary certificates, mostly used
# by examples and fun.
#
OPENSSL=/usr/bin/openssl
$OPENSSL genrsa -out rootCA.key 2048
$OPENSSL req -x509 -new -nodes -key rootCA.key -days 8096 -out rootCA.pem
# make a compound
cat rootCA.key > rootCA.crt
cat rootCA.pem >> rootCA.crt
# create a key for the certificate authority daemon
$OPENSSL genrsa -out cadaemon.key 2048
$OPENSSL req -new -key cadaemon.key -out cadaemon.csr
$OPENSSL x509 -req -in cadaemon.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out cadaemon.pem -days 8096
# make a compound
cat cadaemon.key > cadaemon.crt
cat cadaemon.pem >> cadaemon.crt