diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-05-13 07:54:28 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-05-13 08:57:51 +0300 |
commit | d32125b1bfcd360d70b68a2db5942848ac6c6dcf (patch) | |
tree | 678dbdbcf46d2203efef0701bccf7de78c067165 | |
parent | 3ef0cf4ebff0b2598fd82112c9c6e09ffff9bfa6 (diff) | |
download | ewww-d32125b1bfcd360d70b68a2db5942848ac6c6dcf.tar.gz |
test: create a self-signed certificate for testing
-rwxr-xr-x | check | 2 | ||||
-rwxr-xr-x | mktestcert | 13 |
2 files changed, 15 insertions, 0 deletions
@@ -40,6 +40,8 @@ then fi $hideok cargo test $quiet +$hideok ./mktestcert test.key test.pem hunter2 + for md in [^R]*.md do $hideok echo "$md =====================================" diff --git a/mktestcert b/mktestcert new file mode 100755 index 0000000..bb092d7 --- /dev/null +++ b/mktestcert @@ -0,0 +1,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" |