crd->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL);
GNUNET_CRYPTO_ecdsa_key_get_public (issuer,
&crd->issuer_key);
-
+ crd->subject_key = *subject;
GNUNET_memcpy (&crd[1],
attribute,
strlen (attribute));
{
const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
struct GNUNET_CREDENTIAL_CredentialRecordData *crd;
+ char *res;
el = NULL;
if (NULL == ego)
privkey,
&subject_pkey,
issuer_attr);
- printf ("Success.\n");
- printf (GNUNET_GNSRECORD_value_to_string (GNUNET_GNSRECORD_TYPE_CREDENTIAL,
- crd,
- sizeof (crd) + strlen (issuer_attr) + 1));
+ res = GNUNET_GNSRECORD_value_to_string (GNUNET_GNSRECORD_TYPE_CREDENTIAL,
+ crd,
+ sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData) + strlen (issuer_attr) + 1);
+ printf ("%s\n", res);
+ GNUNET_SCHEDULER_shutdown ();
}
{
cfg = c;
- credential = GNUNET_CREDENTIAL_connect (cfg);
-
- if (NULL == credential)
- {
- fprintf (stderr,
- _("Failed to connect to CREDENTIAL\n"));
- return;
- }
-
tt = GNUNET_SCHEDULER_add_delayed (timeout,
issuer_key);
GNUNET_SCHEDULER_shutdown ();
}
+ credential = GNUNET_CREDENTIAL_connect (cfg);
+
+ if (NULL == credential)
+ {
+ fprintf (stderr,
+ _("Failed to connect to CREDENTIAL\n"));
+ return;
+ }
+
verify_request = GNUNET_CREDENTIAL_verify(credential,
&issuer_pkey,
}
case GNUNET_GNSRECORD_TYPE_CREDENTIAL:
{
- struct GNUNET_CREDENTIAL_CredentialRecordData cred;
- char *cred_str;
- char *subject_pkey;
- char *issuer_pkey;
- if (data_size < sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData))
- return NULL; /* malformed */
- memcpy (&cred,
- data,
- sizeof (cred));
- 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);
+ struct GNUNET_CREDENTIAL_CredentialRecordData cred;
+ char *cred_str;
+ char *subject_pkey;
+ char *issuer_pkey;
+ if (data_size < sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData))
+ return NULL; /* malformed */
+ memcpy (&cred,
+ data,
+ sizeof (cred));
+ 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_asprintf (&cred_str,
- "%s %s %s",
- subject_pkey,
- issuer_pkey,
- &cdata[sizeof (cred)]);
- GNUNET_free (subject_pkey);
- GNUNET_free (issuer_pkey);
-
-
-
- return cred_str;
- }
- default:
- return NULL;
+ "%s %s %s",
+ subject_pkey,
+ issuer_pkey,
+ &cdata[sizeof (cred)]);
+ GNUNET_free (subject_pkey);
+ GNUNET_free (issuer_pkey);
+
+ return cred_str;
+ }
+ default:
+ return NULL;
}
}
*/
static int
credential_string_to_value (void *cls,
- uint32_t type,
- const char *s,
- void **data,
- size_t *data_size)
+ uint32_t type,
+ const char *s,
+ void **data,
+ size_t *data_size)
{
if (NULL == s)
return GNUNET_SYSERR;