aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/pnf-onboarding/src/main/scripts/generate-signature.sh
blob: f9950cfeb7158f9e5c91cb72de4d58b8b4903479 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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