summaryrefslogtreecommitdiff
path: root/src/credential/test_credential_verify_simple.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/credential/test_credential_verify_simple.sh')
-rwxr-xr-xsrc/credential/test_credential_verify_simple.sh30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/credential/test_credential_verify_simple.sh b/src/credential/test_credential_verify_simple.sh
index 41afb47b0..d7657c55f 100755
--- a/src/credential/test_credential_verify_simple.sh
+++ b/src/credential/test_credential_verify_simple.sh
@@ -15,7 +15,7 @@ fi
15 15
16rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` 16rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f`
17 17
18# (3) Isser.user -> Subject 18# (1) Issuer.user -> Subject
19 19
20 20
21which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" 21which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
@@ -26,27 +26,29 @@ gnunet-identity -C testsubject -c test_credential_lookup.conf
26TEST_ATTR="user" 26TEST_ATTR="user"
27SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}') 27SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}')
28ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}') 28ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}')
29CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer --subject=$SUBJECT_KEY --attribute=$TEST_ATTR --ttl=5m -c test_credential_lookup.conf`
30 29
31TEST_CREDENTIAL="t1" 30# Create delegate (1)
32gnunet-namestore -p -z testsubject -a -n $TEST_CREDENTIAL -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf 31SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=testissuer --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf`
32gnunet-credential --createSubjectSide --ego=testsubject --import "$SIGNED" --private
33gnunet-namestore -D -z testsubject
33 34
34CREDS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --ego=testsubject -c test_credential_lookup.conf | paste -d, -s` 35# Starting to resolve
36echo "+++ Starting to Resolve +++"
35 37
38DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --ego=testsubject -c test_credential_lookup.conf | paste -d, -s`
39echo $DELS
40gnunet-credential --verify --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --delegate="$DELS" -c test_credential_lookup.conf
36 41
37#TODO2 Add -z swich like in gnunet-gns 42RES=$?
38#RES_CRED=`$DO_TIMEOUT gnunet-credential --verify --issuer=$ISSUER_KEY --attribute="$TEST_ATTR" --subject=$SUBJECT_KEY --credential=$TEST_CREDENTIAL -c test_credential_lookup.conf`
39RES_CRED=`gnunet-credential --verify --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --credential="$CREDS" -c test_credential_lookup.conf`
40 43
41#TODO cleanup properly 44# Cleanup properly
42gnunet-namestore -z testsubject -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf 45gnunet-namestore -z testsubject -d -n "@" -t DEL -c test_credential_lookup.conf
43gnunet-identity -D testsubject -c test_credential_lookup.conf
44gnunet-arm -e -c test_credential_lookup.conf 46gnunet-arm -e -c test_credential_lookup.conf
45#TODO3 proper test 47
46if [ "$RES_CRED" != "Failed." ] 48if [ "$RES" == 0 ]
47then 49then
48 exit 0 50 exit 0
49else 51else
50 echo "FAIL: Failed to verify credential." 52 echo "FAIL: Failed to verify credential."
51 exit 1 53 exit 1
52fi 54fi \ No newline at end of file