summaryrefslogtreecommitdiffhomepage
path: root/client/testsign.sh
blob: 45c9bc3ff88619a613db50e35bed6d8bbae89b1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#!/bin/sh

sendint() { echo "$*;"; }
sendstring() { echo "${#1};$1"; }

SignCommand() { sendint 2; }


{

#### Send sign command ####
SignCommand

# Send common data
sendstring 'MTIzNDU2Nzg5' # nonce
sendint 0                 # server time (optional)
sendstring ''             # policies (optional)
sendstring ''             # subject filter (optional)

sendstring 'https://example.com/'  # URL
sendstring 'example.com'           # Hostname
sendstring '198.51.100.200'        # IP of example.com

# Send data to be signed
sendstring 'aGkK' # visible message
sendstring ''     # hidden data (optional)

# Prevent EOF
echo 'hack'


#} | valgrind --leak-check=no -q ./sign --internal--ipc=8 | tr ';' '\n' | {
} | ./sign --internal--ipc=8 | tr ';' '\n' | {

#### Parse response ####
read error
read sigLength
read signature
sha="`echo $signature | sha1sum | head -c 5`"

echo "error=$error,   length=$requestLength,   sha1=$sha"
echo "$signature" | base64 -d > test/signature.xml

}