Mercurial > trustbridge
annotate ui/tests/append-sig.sh @ 1395:a2574a029322
Fix Base 64 signature size calculation.
If the signature byte size is not equally dividable
by three the base 64 encoding needs three additional bytes.
The value is now fixed to avoid such errors in the future.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 26 Jan 2015 13:17:32 +0100 |
parents | 289cb3554c55 |
children |
rev | line source |
---|---|
768
3f290ea49d45
Add helper script for signature creation to avoid cmake escaping hell
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
1 #!/bin/bash |
1370
289cb3554c55
Fix append-sig.sh to use a temporary file to insert the signature time
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1366
diff
changeset
|
2 TMPFILE=$(mktemp) |
289cb3554c55
Fix append-sig.sh to use a temporary file to insert the signature time
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1366
diff
changeset
|
3 cp "$2" "$TMPFILE" |
1366
8c829345ecfa
(issue179) Write signature date in linux installer and add to test script
Andre Heinecke <andre.heinecke@intevation.de>
parents:
774
diff
changeset
|
4 CUR_DT=$(date +%s) |
1370
289cb3554c55
Fix append-sig.sh to use a temporary file to insert the signature time
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1366
diff
changeset
|
5 sed -i "s/###SIGNATURE_DATE###/${CUR_DT}/" "$TMPFILE" |
289cb3554c55
Fix append-sig.sh to use a temporary file to insert the signature time
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1366
diff
changeset
|
6 echo -e \\r\\nS_DT:$CUR_DT >> "$TMPFILE" |
289cb3554c55
Fix append-sig.sh to use a temporary file to insert the signature time
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1366
diff
changeset
|
7 cp "$TMPFILE" "$3" |
289cb3554c55
Fix append-sig.sh to use a temporary file to insert the signature time
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1366
diff
changeset
|
8 echo -e \\r\\nS:$(openssl dgst -sha256 -sign "$1" < "$TMPFILE" | base64 -w0) >> "$3" |
289cb3554c55
Fix append-sig.sh to use a temporary file to insert the signature time
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1366
diff
changeset
|
9 rm "$TMPFILE" |