aboutsummaryrefslogtreecommitdiffstats
path: root/meta-agl-demo-control-panel/recipes-connectivity/kuksa-val/kuksa-certificates-agl/genCertsAGL.sh
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2024-07-04 14:44:46 +0000
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2024-07-24 09:14:03 +0000
commit94a19893064724d89893252735883cdb0415835f (patch)
tree4bff24f56fd4b235870307e7834d67576038a9e5 /meta-agl-demo-control-panel/recipes-connectivity/kuksa-val/kuksa-certificates-agl/genCertsAGL.sh
parentca836399d23e92f20d7ccc02122ab029e695cc6b (diff)
Move agl-demo-control-panel into own layer and feature during qt6 migration
This creates a temporary sublayer for the demo control panel until meta-agl-demo itself is migrated to qt6. Bug-AGL: SPEC-5195 Change-Id: I07f97385600fb695e182b11c528225d5510185d9 Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org> Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl-demo/+/30067
Diffstat (limited to 'meta-agl-demo-control-panel/recipes-connectivity/kuksa-val/kuksa-certificates-agl/genCertsAGL.sh')
-rwxr-xr-xmeta-agl-demo-control-panel/recipes-connectivity/kuksa-val/kuksa-certificates-agl/genCertsAGL.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/meta-agl-demo-control-panel/recipes-connectivity/kuksa-val/kuksa-certificates-agl/genCertsAGL.sh b/meta-agl-demo-control-panel/recipes-connectivity/kuksa-val/kuksa-certificates-agl/genCertsAGL.sh
new file mode 100755
index 000000000..b078fd1b2
--- /dev/null
+++ b/meta-agl-demo-control-panel/recipes-connectivity/kuksa-val/kuksa-certificates-agl/genCertsAGL.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+
+genCAKey() {
+ openssl genrsa -out CA.key 2048
+}
+
+
+genCACert() {
+ openssl req -key CA.key -new -out CA.csr -subj "/C=US/ST=San Francisco/L=California/O=automotivelinux.org/CN=localhost-ca/emailAddress=agl-dev-community@lists.automotivelinux.org"
+ openssl x509 -signkey CA.key -in CA.csr -req -days 3650 -out CA.pem
+}
+
+genKey() {
+ openssl genrsa -out $1.key 2048
+}
+
+genCert() {
+ openssl req -new -key $1.key -out $1.csr -passin pass:"temp" -subj "/C=US/ST=San Francisco/L=California/O=automotivelinux.org/CN=$1/emailAddress=agl-dev-community@lists.automotivelinux.org"
+ openssl x509 -req -in $1.csr -extfile <(printf "subjectAltName=DNS:$1,DNS:localhost,IP:127.0.0.1") -CA CA.pem -CAkey CA.key -CAcreateserial -days 1460 -out $1.pem
+ openssl verify -CAfile CA.pem $1.pem
+}
+
+set -e
+# Check if the CA is available, else make CA certificates
+if [ -f "CA.key" ]; then
+ echo "Existing CA.key will be used"
+else
+ echo "No CA.key found, will generate new key"
+ genCAKey
+ rm -f CA.pem
+ echo ""
+fi
+
+# Check if the CA.pem is available, else generate a new CA.pem
+if [ -f "CA.pem" ]; then
+ echo "CA.pem will not be regenerated"
+else
+ echo "No CA.pem found, will generate new CA.pem"
+ genCACert
+ echo ""
+fi
+
+
+for i in Server Client;
+do
+ if [ -f $i.key ]; then
+ echo "Existing $i.key will be used"
+ else
+ echo "No $i.key found, will generate new key"
+ genKey $i
+ fi
+ echo ""
+ echo "Generating $i.pem"
+ genCert $i
+ echo ""
+done
+