github.com/hyperledger/aries-framework-go@v0.3.2/scripts/generate_test_keys.sh (about) 1 #!/bin/sh 2 # 3 # Copyright SecureKey Technologies Inc. All Rights Reserved. 4 # 5 # SPDX-License-Identifier: Apache-2.0 6 # 7 8 set -e 9 10 echo "Generating Aries-Framework-Go Test PKI" 11 cd /opt/go/src/github.com/hyperledger/aries-framework-go 12 mkdir -p test/bdd/fixtures/keys/tls 13 tmp=$(mktemp) 14 echo "subjectKeyIdentifier=hash 15 authorityKeyIdentifier = keyid,issuer 16 extendedKeyUsage = serverAuth 17 keyUsage = Digital Signature, Key Encipherment 18 subjectAltName = @alt_names 19 [alt_names] 20 DNS.1 = localhost 21 DNS.2 = carl.router.aries.example.com 22 DNS.3 = dave.router.aries.example.com 23 DNS.4 = alice.aries.example.com 24 DNS.5 = bob.aries.example.com 25 DNS.6 = bob.agent.example.com 26 DNS.7 = erin.aries.example.com 27 DNS.8 = kms.example.com 28 DNS.9 = file-server.example.com" >> "$tmp" 29 30 #create CA 31 openssl ecparam -name prime256v1 -genkey -noout -out test/bdd/fixtures/keys/tls/ec-cakey.pem 32 openssl req -new -x509 -key test/bdd/fixtures/keys/tls/ec-cakey.pem -subj "/C=CA/ST=ON/O=Example Internet CA Inc.:CA Sec/OU=CA Sec" -out test/bdd/fixtures/keys/tls/ec-cacert.pem 33 34 #create TLS creds 35 openssl ecparam -name prime256v1 -genkey -noout -out test/bdd/fixtures/keys/tls/ec-key.pem 36 openssl req -new -key test/bdd/fixtures/keys/tls/ec-key.pem -subj "/C=CA/ST=ON/O=Example Inc.:Aries-Framework-Go/OU=Aries-Framework-Go/CN=*.example.com" -out test/bdd/fixtures/keys/tls/ec-key.csr 37 openssl x509 -req -in test/bdd/fixtures/keys/tls/ec-key.csr -CA test/bdd/fixtures/keys/tls/ec-cacert.pem -CAkey test/bdd/fixtures/keys/tls/ec-cakey.pem -CAcreateserial -extfile "$tmp" -out test/bdd/fixtures/keys/tls/ec-pubCert.pem -days 365 38 39 #create master key for secret lock 40 openssl rand 32 | base64 | sed 's/+/-/g; s/\//_/g' > test/bdd/fixtures/keys/tls/secret-lock.key 41 42 echo "done generating Aries-Framework-Go PKI"