github.com/ryanbennettvoid/go-swagger@v0.18.1-0.20190104015444-3854bbbe2392/hack/gen-self-signed-certs.sh (about)

     1  #!/bin/sh
     2  
     3  # generate CA
     4  openssl genrsa -out myCA.key 4096
     5  openssl req -x509 -new -key myCA.key -out myCA.crt -days 730 -subj /CN="Go Swagger"
     6  
     7  # generate server cert and key
     8  openssl genrsa -out mycert1.key 4096
     9  openssl req -new -out mycert1.req -key mycert1.key -subj /CN="goswagger.local"
    10  openssl x509 -req -in mycert1.req -out mycert1.crt -CAkey myCA.key -CA myCA.crt -days 365 -CAcreateserial -CAserial serial
    11  
    12  # generate client cert, key and bundle
    13  openssl genrsa -out myclient.key 4096
    14  openssl req -new -key myclient.key -out myclient.csr
    15  openssl x509 -req -days 730 -in myclient.csr -out myclient.crt -CAkey myCA.key -CA myCA.crt -days 365 -CAcreateserial -CAserial serial
    16  openssl pkcs12 -export -clcerts -in myclient.crt -inkey myclient.key -out myclient.p12