Skip to content

Commit

Permalink
Create sign-and-upload.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
nemetht1 authored Jul 28, 2021
1 parent 784cb7e commit a7a6507
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions scripts/sign-and-upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# Change this values according to your needs
DGCG_ENDPOINT="https://example.org/rules"
SIGNING_KEY="upload_key.pem"
SIGNING_CERT="upload.pem"
TLS_KEY="auth_key.pem"
TLS_CERT="auth.pem"

# DO NOT CHANGE ANYTHING BELOW THIS!
function upload()
{
echo " "
echo "Processing JSON file $1"
java -jar ./dgc-cli.jar signing sign-string -c $SIGNING_CERT -k $SIGNING_KEY -i $1 -o ./tmp.cms
curl --no-progress-bar --request POST "$DGCG_ENDPOINT" --header "Content-Type: application/cms-text" --header "Accept: application/json" --data-binary @tmp.cms --cert "$TLS_CERT" --key "$TLS_KEY"
}

echo "Search rule files and sign with Upload Certificate and Upload to DGCG"


for RULEFILES in `find "./" -type f -name "rule.json"`
do
upload $RULEFILES
done

echo ""
echo "deleting temporary file"
rm tmp.cms

exit 1

0 comments on commit a7a6507

Please sign in to comment.