File: create-client-cert.sh

package info (click to toggle)
libwebsockets 4.3.5-3
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 31,404 kB
  • sloc: ansic: 194,409; javascript: 1,550; sh: 1,387; cpp: 505; java: 461; perl: 405; xml: 118; makefile: 76; awk: 5
file content (22 lines) | stat: -rwxr-xr-x 458 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

if [ -z "$1" ] ; then
	echo "Usage $0 <name>"
	exit 1
fi

mkdir -p certs
openssl genrsa -out $1.key 4096 && \
printf "\\n\\n\\n\\n\\n$1\\n\\n1234\\n\\n" | \
 openssl req -config tmp.cnf -new -key $1.key -out $1.csr && \
openssl ca -config tmp.cnf \
 	-keyfile ca.key \
	-cert ca.pem \
	-extensions usr_cert \
	-days 375 \
	-notext \
	-md sha256 \
       	-in $1.csr \
	-out $1.pem && \
openssl pkcs12 -export -in $1.pem -inkey $1.key -out $1.p12