diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2016-12-02 14:20:08 +0100 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2016-12-02 14:20:08 +0100 |
commit | 113150fb91211dc0cc0901c2373f148b8486d9c9 (patch) | |
tree | e442fc40d3d7529d0d5220b328b9c720612b8726 /src/credential/plugin_gnsrecord_credential.c | |
parent | 45c17975732ef486a7ef4c64fb7161c89275bf05 (diff) | |
download | gnunet-113150fb91211dc0cc0901c2373f148b8486d9c9.tar.gz gnunet-113150fb91211dc0cc0901c2373f148b8486d9c9.zip |
- add signatures to creds, add converter
Diffstat (limited to 'src/credential/plugin_gnsrecord_credential.c')
-rw-r--r-- | src/credential/plugin_gnsrecord_credential.c | 20 |
1 files changed, 20 insertions, 0 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; |