diff options
-rw-r--r-- | src/credential/plugin_gnsrecord_credential.c | 20 | ||||
-rw-r--r-- | src/include/gnunet_credential_service.h | 22 | ||||
-rw-r--r-- | 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, | |||
51 | 51 | ||
52 | switch (type) | 52 | switch (type) |
53 | { | 53 | { |
54 | case GNUNET_GNSRECORD_TYPE_ATTRIBUTE: | ||
55 | { | ||
56 | struct GNUNET_CREDENTIAL_AttributeRecordData attr; | ||
57 | char *attr_str; | ||
58 | char *subject_pkey; | ||
59 | |||
60 | if (data_size < sizeof (struct GNUNET_CREDENTIAL_AttributeRecordData)) | ||
61 | return NULL; /* malformed */ | ||
62 | memcpy (&attr, | ||
63 | data, | ||
64 | sizeof (attr)); | ||
65 | cdata = data; | ||
66 | subject_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string (&attr.subject_key); | ||
67 | GNUNET_asprintf (&attr_str, | ||
68 | "%s.%s", | ||
69 | subject_pkey, | ||
70 | &cdata[sizeof (attr)]); | ||
71 | GNUNET_free (subject_pkey); | ||
72 | return attr_str; | ||
73 | } | ||
54 | case GNUNET_GNSRECORD_TYPE_CREDENTIAL: | 74 | case GNUNET_GNSRECORD_TYPE_CREDENTIAL: |
55 | { | 75 | { |
56 | struct GNUNET_CREDENTIAL_CredentialRecordData cred; | 76 | 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 | |||
79 | struct GNUNET_CREDENTIAL_CredentialRecordData { | 79 | struct GNUNET_CREDENTIAL_CredentialRecordData { |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Public key of the subject this credential was issued to | 82 | * The signature for this credential by the issuer |
83 | */ | 83 | */ |
84 | struct GNUNET_CRYPTO_EcdsaPublicKey subject_key; | 84 | struct GNUNET_CRYPTO_EcdsaSignature sig; |
85 | 85 | ||
86 | |||
86 | /** | 87 | /** |
87 | * Public key of the issuer | 88 | * Public key of the issuer |
88 | */ | 89 | */ |
89 | struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key; | 90 | struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key; |
91 | |||
92 | /** | ||
93 | * Signature purpose (data to sign, kind of signature) | ||
94 | */ | ||
95 | struct GNUNET_CRYPTO_EccSignaturePurpose purpose; | ||
90 | 96 | ||
91 | /** | 97 | /** |
98 | * Public key of the subject this credential was issued to | ||
99 | */ | ||
100 | struct GNUNET_CRYPTO_EcdsaPublicKey subject_key; | ||
101 | |||
102 | /** | ||
92 | * Flags for this credential | 103 | * Flags for this credential |
93 | */ | 104 | */ |
94 | uint32_t credential_flags GNUNET_PACKED; | 105 | uint32_t credential_flags GNUNET_PACKED; |
@@ -98,12 +109,7 @@ struct GNUNET_CREDENTIAL_CredentialRecordData { | |||
98 | */ | 109 | */ |
99 | uint64_t expiration GNUNET_PACKED; | 110 | uint64_t expiration GNUNET_PACKED; |
100 | 111 | ||
101 | /** | 112 | /** |
102 | * The signature for this credential by the issuer | ||
103 | */ | ||
104 | struct GNUNET_CRYPTO_EcdsaSignature sig; | ||
105 | |||
106 | /** | ||
107 | * Followed by the attribute string | 113 | * Followed by the attribute string |
108 | */ | 114 | */ |
109 | }; | 115 | }; |
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" | |||
190 | */ | 190 | */ |
191 | #define GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET 27 | 191 | #define GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET 27 |
192 | 192 | ||
193 | /** | ||
194 | * Signature for a GNUnet credential | ||
195 | */ | ||
196 | #define GNUNET_SIGNATURE_PURPOSE_CREDENTIAL 28 | ||
197 | |||
193 | #if 0 /* keep Emacsens' auto-indent happy */ | 198 | #if 0 /* keep Emacsens' auto-indent happy */ |
194 | { | 199 | { |
195 | #endif | 200 | #endif |