Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 1b55877

Browse files
authored
Merge pull request #35 from orbitdb/experiment/keygen
Experiment: Keygen
2 parents c046af1 + 029e94e commit 1b55877

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ typings/
6363
# ignore certificates
6464
*.crt
6565
*.key
66+
certs/
6667

6768
# ignore local db repository
6869
orbitdb/

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root-cert:
2+
mkdir -p certs
3+
openssl genrsa -des3 -out certs/orbit-db-http-api.key 2048
4+
openssl req -x509 \
5+
-new -nodes \
6+
-key certs/orbit-db-http-api.key \
7+
-sha256 \
8+
-days 1024 \
9+
-out certs/orbit-db-http-api.pem
10+
mkdir -p /usr/local/share/ca-certificates/extra
11+
cp certs/orbit-db-http-api.pem /usr/local/share/ca-certificates/extra/orbit-db-http-api.crt
12+
update-ca-certificates
13+
14+
uninstall-root-cert:
15+
rm -rf /usr/local/share/ca-certificates/extra/orbit-db-http-api.crt
16+
rmdir --ignore-fail-on-non-empty /usr/local/share/ca-certificates/extra
17+
update-ca-certificates

keygen.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#! /bin/bash
2+
3+
openssl req \
4+
-new -sha256 -nodes \
5+
-out ./certs/localhost.csr \
6+
-newkey rsa:2048 -keyout ./certs/localhost.key \
7+
-subj "/C=AU/ST=WA/L=City/O=Organization/OU=OrganizationUnit/CN=localhost/emailAddress=demo@example.com"
8+
9+
openssl x509 \
10+
-req \
11+
-in ./certs/localhost.csr \
12+
-CA ./certs/orbit-db-http-api.pem -CAkey ./certs/orbit-db-http-api.key -CAcreateserial \
13+
-out ./certs/localhost.crt \
14+
-days 500 \
15+
-sha256 \
16+
-extfile <(echo " \
17+
[ v3_ca ]\n \
18+
authorityKeyIdentifier=keyid,issuer\n \
19+
basicConstraints=CA:FALSE\n \
20+
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment\n \
21+
subjectAltName=DNS:localhost \
22+
")

0 commit comments

Comments
 (0)