summaryrefslogtreecommitdiff
path: root/mktestcert
blob: bb092d7071a15818329f0543532b51b009cfa60a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

set -eu

key="$1"
cert="$2"
csr="$(mktemp)"

openssl genrsa -out "$key" 2048
openssl rsa -in "$key" -out "$key"
openssl req -sha256 -new -key "$key" -out "$csr" -subj '/CN=localhost'
openssl x509 -req -sha256 -days 365 -in "$csr" -signkey "$key" -out "$cert"
rm -f "$csr"