Skip to content

Commit

Permalink
Update Sign-And-Upload Script
Browse files Browse the repository at this point in the history
  • Loading branch information
f11h committed Jun 28, 2021
1 parent fc149d9 commit 7480695
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions scripts/sign-and-upload.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ SET TLS_CERT="auth.pem"

REM DO NOT CHANGE ANYTHING BELOW THIS!

echo Purging temporary directory

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

for /f "usebackq delims=|" %%f in (`dir /s/b rule.json`) do (
@echo off
echo Processing JSON file %%f
dgc signing sign-string -c %SIGNING_CERT% -k %SIGNING_KEY% -i %%f -o tmp.cms
curl -w -s --request POST "%DGCG_ENDPOINT%" --header "Content-Type: application/cms-text" --header "Accept: application/json" --data-binary @tmp.cms --cert %TLS_CERT% --key %TLS_KEY% -o curl.log
)
for /f "usebackq delims=|" %%f in (`dir /s/b rule.json`) do (call :upload %%f)

echo deleting temporary file
rm -f tmp.cms
del -f tmp.cms

goto :eof

:upload
echo Processing JSON file %1
call dgc signing sign-string -c %SIGNING_CERT% -k %SIGNING_KEY% -i "%1" -o tmp.cms
call 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.
echo.

0 comments on commit 7480695

Please sign in to comment.