-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.key | ||
*.crt | ||
*.pem | ||
*.csr | ||
*.srl | ||
*-truststore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash -e | ||
|
||
rm -f RootCA.crt RootCA.key RootCA.pem localhost-signed.key localhost-signed.csr localhost-signed.crt signed-truststore | ||
|
||
openssl req -x509 -nodes -new -sha256 -days 1024 -newkey rsa:2048 -keyout RootCA.key -out RootCA.pem -subj "/C=US/CN=Example-Root-CA" | ||
openssl x509 -outform pem -in RootCA.pem -out RootCA.crt | ||
|
||
openssl req -new -nodes -newkey rsa:2048 -keyout localhost-signed.key -out localhost-signed.csr -subj "/C=US/ST=YourState/L=YourCity/O=Example-Certificates/CN=localhost" | ||
openssl x509 -req -sha256 -days 1024 -in localhost-signed.csr -CA RootCA.pem -CAkey RootCA.key -CAcreateserial -extfile domains.ext -out localhost-signed.crt | ||
|
||
keytool -importcert -file localhost-signed.crt -keystore signed-truststore -noprompt --storepass password | ||
|
||
echo "" | ||
echo "Certificates created" | ||
echo "--------------------" | ||
echo "CA cert: " $(readlink -f RootCA.crt) | ||
echo "CA key: " $(readlink -f RootCA.key) | ||
echo "Public cert: " $(readlink -f localhost-unsigned.crt) | ||
echo "Private key: " $(readlink -f localhost-unsigned.key) | ||
echo "Truststore: " $(readlink -f signed-truststore) | ||
echo "Truststore password: password" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
rm -f localhost-unsigned.key localhost-unsigned.crt unsigned-truststore | ||
|
||
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes -keyout localhost-unsigned.key -out localhost-unsigned.crt -subj "/CN=localhost" -addext "subjectAltName=DNS:localhost,DNS:*.localdomain,IP:127.0.0.1" | ||
|
||
keytool -importcert -file localhost-unsigned.crt -keystore unsigned-truststore -noprompt --storepass password | ||
|
||
echo "" | ||
echo "Certificates created" | ||
echo "--------------------" | ||
echo "Public cert: " $(readlink -f localhost-unsigned.crt) | ||
echo "Private key: " $(readlink -f localhost-unsigned.key) | ||
echo "Truststore: " $(readlink -f unsigned-truststore) | ||
echo "Truststore password: password" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
authorityKeyIdentifier=keyid,issuer | ||
basicConstraints=CA:FALSE | ||
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment | ||
subjectAltName = @alt_names | ||
[alt_names] | ||
DNS.1 = localhost | ||
DNS.2 = localhost.localdomain |