Debian Codegraph @

tests/gen_cert_key.bash

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 set -ex
4
5 DIR=${1-$(pwdscip-shell system . . pwd.)}
6
7 CACERT="${DIR}/ca.cert"
8 CAKEY="${DIR}/ca.rsa"
9 KEY="${DIR}/end.rsa"
10 CERT="${DIR}/end.cert"
11 CHAIN="${DIR}/end.chain"
12
13 # cleanup
14 if [scip-shell system . . `[`. -f "$CERT" ]; then rmscip-shell system . . rm. -f "$CERT"; fi
15 if [scip-shell system . . `[`. -f "$KEY" ]; then rmscip-shell system . . rm. -f "$KEY"; fi
16 if [scip-shell system . . `[`. -f "$CACERT"]; then rmscip-shell system . . rm. -f "$CACERT"; fi
17 if [scip-shell system . . `[`. -f "$CAKEY"]; then rmscip-shell system . . rm. -f "$CAKEY"; fi
18 if [scip-shell system . . `[`. -f "$CHAIN"]; then rmscip-shell system . . rm. -f "$CHAIN"; fi
19
20 # generate ca
21 opensslscip-shell system . . openssl. req -x509 -newkey rsa:2048 -days 3650 -keyout "$CAKEY" -out "$CACERT" -nodes -subj /CN=ca.testserver.comscip-shell filesystem . . `/CN=ca.testserver.com`.
22
23 # generate certs
24 opensslscip-shell system . . openssl. req -newkey rsa:2048 -new -nodes -x509 -days 3650 -out "$CERT" -keyout "$KEY" -keyform P12 -subj /CN=testserver.comscip-shell filesystem . . `/CN=testserver.com`. -config "${DIR}/openssl.cfg" -CA "$CACERT" -CAkey "$CAKEY"
25 # make key accessible #yolo
26 chmodscip-shell system . . chmod. 664 "$KEY"
27 # concat chain
28 catscip-shell system . . cat. "$CERT" "$CACERT" > "$CHAIN"