gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] 13/171: - add signatures to creds, add converter


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 13/171: - add signatures to creds, add converter
Date: Thu, 04 Jan 2018 16:08:41 +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 113150fb91211dc0cc0901c2373f148b8486d9c9
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Fri Dec 2 14:20:08 2016 +0100

    - add signatures to creds, add converter
---
 src/credential/plugin_gnsrecord_credential.c | 20 ++++++++++++++++++++
 src/include/gnunet_credential_service.h      | 22 ++++++++++++++--------
 src/include/gnunet_signatures.h              |  5 +++++
 3 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/src/credential/plugin_gnsrecord_credential.c 
b/src/credential/plugin_gnsrecord_credential.c
index 480dc4c62..d321a43a4 100644
--- a/src/credential/plugin_gnsrecord_credential.c
+++ b/src/credential/plugin_gnsrecord_credential.c
@@ -51,6 +51,26 @@ credential_value_to_string (void *cls,
 
   switch (type)
   {
+   case GNUNET_GNSRECORD_TYPE_ATTRIBUTE:
+   {
+    struct GNUNET_CREDENTIAL_AttributeRecordData attr;
+    char *attr_str;
+    char *subject_pkey;
+    
+    if (data_size < sizeof (struct GNUNET_CREDENTIAL_AttributeRecordData))
+      return NULL; /* malformed */
+    memcpy (&attr,
+            data,
+            sizeof (attr));
+    cdata = data;
+    subject_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string 
(&attr.subject_key);
+    GNUNET_asprintf (&attr_str,
+                     "%s.%s",
+                     subject_pkey,
+                     &cdata[sizeof (attr)]);
+    GNUNET_free (subject_pkey);
+    return attr_str;
+   }
    case GNUNET_GNSRECORD_TYPE_CREDENTIAL:
    {
     struct GNUNET_CREDENTIAL_CredentialRecordData cred;
diff --git a/src/include/gnunet_credential_service.h 
b/src/include/gnunet_credential_service.h
index 5675cd990..b996b77db 100644
--- a/src/include/gnunet_credential_service.h
+++ b/src/include/gnunet_credential_service.h
@@ -79,16 +79,27 @@ GNUNET_NETWORK_STRUCT_BEGIN
 struct GNUNET_CREDENTIAL_CredentialRecordData {
   
   /**
-   * Public key of the subject this credential was issued to
+   * The signature for this credential by the issuer
    */
-  struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
+  struct GNUNET_CRYPTO_EcdsaSignature sig;
   
+
   /**
    * Public key of the issuer
    */
   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
+  
+  /**
+   * Signature purpose (data to sign, kind of signature)
+   */
+  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
 
   /**
+   * Public key of the subject this credential was issued to
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
+  
+    /**
    * Flags for this credential
    */
   uint32_t credential_flags GNUNET_PACKED;
@@ -98,12 +109,7 @@ struct GNUNET_CREDENTIAL_CredentialRecordData {
    */
   uint64_t expiration GNUNET_PACKED;
   
-  /**
-   * The signature for this credential by the issuer
-   */
-  struct GNUNET_CRYPTO_EcdsaSignature sig;
-  
-  /**
+    /**
    * Followed by the attribute string
    */
 };
diff --git a/src/include/gnunet_signatures.h b/src/include/gnunet_signatures.h
index 1e372bbea..353287cbf 100644
--- a/src/include/gnunet_signatures.h
+++ b/src/include/gnunet_signatures.h
@@ -190,6 +190,11 @@ extern "C"
  */
 #define GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET 27
 
+/**
+ * Signature for a GNUnet credential
+ */
+#define GNUNET_SIGNATURE_PURPOSE_CREDENTIAL 28
+
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]