Skip to content
Snippets Groups Projects
Commit d26a1030 authored by Alexis La Goutte's avatar Alexis La Goutte
Browse files

Add make gen-certificate for generate DEMO certificate

parent 2e6ce59d
No related merge requests found
......@@ -24,6 +24,13 @@ SUBDIRS = lib tests examples
ACLOCAL_AMFLAGS = -I m4
CERTIFICATE_PASS=QUIC
CERTIFICATE_INFO='/CN=localhost/O=QUIC./C=FR'
CERTIFICATE_KEY=cert/server.key
CERTIFICATE_TMP_KEY=$(CERTIFICATE_KEY).tmp
CERTIFICATE_CSR_FILE=cert/server.csr
CERTIFICATE_CRT_FILE=cert/server.crt
# Format source files using clang-format. Don't format source files
# under third-party directory since we are not responsible for thier
# coding style.
......@@ -32,3 +39,14 @@ clang-format:
test -z $${CLANGFORMAT} && CLANGFORMAT="clang-format"; \
$${CLANGFORMAT} -i lib/*.{c,h} lib/includes/ngtcp2/*.h \
examples/*.{cc,h}
#generate certificate (ONLY USE FOR DEMO !)
gen-certificate:
mkdir -p cert
openssl genrsa -aes256 -passout pass:$(CERTIFICATE_PASS) -out $(CERTIFICATE_KEY) 2048
openssl req -passin pass:$(CERTIFICATE_PASS) -new -key $(CERTIFICATE_KEY) -out $(CERTIFICATE_CSR_FILE) -subj $(CERTIFICATE_INFO)
cp $(CERTIFICATE_KEY) $(CERTIFICATE_TMP_KEY)
openssl rsa -passin pass:$(CERTIFICATE_PASS) -in $(CERTIFICATE_TMP_KEY) -out $(CERTIFICATE_KEY)
openssl x509 -req -days 30 -in $(CERTIFICATE_CSR_FILE) -signkey $(CERTIFICATE_KEY) -out $(CERTIFICATE_CRT_FILE)
rm $(CERTIFICATE_TMP_KEY)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment