[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 26/171: - add signature to cred
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 26/171: - add signature to cred |
Date: |
Thu, 04 Jan 2018 16:08:54 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 6d96eb580bec0831222811f3841174c39e437709
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Mon Dec 5 21:55:23 2016 +0100
- add signature to cred
---
src/credential/plugin_gnsrecord_credential.c | 31 ++++++++++++++++++++--------
src/credential/test_credential_issue.sh | 13 +++---------
2 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/src/credential/plugin_gnsrecord_credential.c
b/src/credential/plugin_gnsrecord_credential.c
index 721e19fdb..f6aec9bcc 100644
--- a/src/credential/plugin_gnsrecord_credential.c
+++ b/src/credential/plugin_gnsrecord_credential.c
@@ -77,6 +77,8 @@ credential_value_to_string (void *cls,
char *cred_str;
char *subject_pkey;
char *issuer_pkey;
+ char *signature;
+
if (data_size < sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData))
return NULL; /* malformed */
memcpy (&cred,
@@ -85,15 +87,18 @@ credential_value_to_string (void *cls,
cdata = data;
subject_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string
(&cred.subject_key);
issuer_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred.issuer_key);
-
+ GNUNET_STRINGS_base64_encode ((char*)&cred.sig,
+ sizeof (struct
GNUNET_CRYPTO_EcdsaSignature),
+ &signature);
GNUNET_asprintf (&cred_str,
- "%s %s %s",
- subject_pkey,
+ "%s.%s -> %s sig:%s",
issuer_pkey,
- &cdata[sizeof (cred)]);
+ &cdata[sizeof (cred)],
+ subject_pkey,
+ signature);
GNUNET_free (subject_pkey);
GNUNET_free (issuer_pkey);
-
+ GNUNET_free (signature);
return cred_str;
}
default:
@@ -135,12 +140,15 @@ credential_string_to_value (void *cls,
char subject_pkey[enclen + 1];
char issuer_pkey[enclen + 1];
char name[253 + 1];
+ char signature[128]; //TODO max payload size
+ struct GNUNET_CRYPTO_EcdsaSignature *sig;
- if (3 != SSCANF (s,
- "%52s %52s %253s",
- subject_pkey,
+ if (4 != SSCANF (s,
+ "%52s.%253s -> %52s sig:%s",
issuer_pkey,
- name))
+ name,
+ subject_pkey,
+ signature))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Unable to parse CRED record string `%s'\n"),
@@ -155,6 +163,11 @@ credential_string_to_value (void *cls,
GNUNET_CRYPTO_ecdsa_public_key_from_string (issuer_pkey,
strlen (issuer_pkey),
&cred->issuer_key);
+ GNUNET_STRINGS_base64_decode (signature,
+ strlen (signature),
+ (char**)&sig);
+ cred->sig = *sig;
+ GNUNET_free (sig);
GNUNET_memcpy (&cred[1],
name,
strlen (name));
diff --git a/src/credential/test_credential_issue.sh
b/src/credential/test_credential_issue.sh
index a78bde6ed..95eac2957 100755
--- a/src/credential/test_credential_issue.sh
+++ b/src/credential/test_credential_issue.sh
@@ -28,16 +28,9 @@ gnunet-identity -C testissuer -c test_credential_lookup.conf
gnunet-identity -C testsubject -c test_credential_lookup.conf
SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep
testsubject | awk '{print $3}')
ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep
testissuer | awk '{print $3}')
-EXPECTED="$SUBJECT_KEY $ISSUER_KEY $TEST_ATTR"
#TODO1 Get credential and store it with subject (3)
-CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer
--subject=$SUBJECT_KEY --attribute=$TEST_ATTR -c test_credential_lookup.conf`
+$DO_TIMEOUT gnunet-credential --issue --ego=testissuer --subject=$SUBJECT_KEY
--attribute=$TEST_ATTR -c test_credential_lookup.conf
+STATUS=$?
gnunet-arm -e -c test_credential_lookup.conf
-
-if [ "$EXPECTED" == "$CRED" ]
-then
- exit 0
-else
- echo "FAIL: Failed to issue credential, got $CRED."
- exit 1
-fi
+exit $STATUS
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] 27/171: - remove purpose from cred, (continued)
- [GNUnet-SVN] [gnunet] 27/171: - remove purpose from cred, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 25/171: -fix verifymessage, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 16/171: -update test, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 21/171: - add verify and issue to cli, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 03/171: - move towards verification, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 14/171: -cleanup cli tool, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 22/171: -add issue test, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 24/171: -add tests, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 29/171: Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 36/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 26/171: - add signature to cred,
gnunet <=
- [GNUnet-SVN] [gnunet] 28/171: - starting backward resolution, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 31/171: Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 41/171: - fix test, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 34/171: - minor fixes, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 33/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 32/171: -add expiration to cred, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 42/171: -add confs, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 35/171: Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 38/171: - add signature check, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 40/171: - add delegation resolution, gnunet, 2018/01/04