aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/pnf-onboarding/src/main/scripts/generate-signature.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/mocks/pnf-onboarding/src/main/scripts/generate-signature.sh')
-rw-r--r--test/mocks/pnf-onboarding/src/main/scripts/generate-signature.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/mocks/pnf-onboarding/src/main/scripts/generate-signature.sh b/test/mocks/pnf-onboarding/src/main/scripts/generate-signature.sh
new file mode 100644
index 000000000..f9950cfeb
--- /dev/null
+++ b/test/mocks/pnf-onboarding/src/main/scripts/generate-signature.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+signingCertificate=$1
+signingCertPrivateKey=$2
+csarFile=$3
+signatureName=$4
+
+echo Creating signature file with following inputs
+printf "\t%s = %s\n" "signingCertificate" $signingCertificate
+printf "\t%s = %s\n" "signingCertPrivateKey" $signingCertPrivateKey
+printf "\t%s = %s\n" "csarFile" $csarFile
+
+openssl cms -sign -signer $signingCertificate -inkey $signingCertPrivateKey -outform pem -binary -nocerts < $csarFile > $signatureName
+
+retVal=$?
+if [ $retVal -eq 0 ]; then
+ echo Signature file $signatureName created successfully
+else
+ echo Failed to create Signature file $signatureName
+fi
+
+exit $retVal