summaryrefslogtreecommitdiff
path: root/src/credential/credential_api.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2016-12-18 16:52:59 +0100
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2016-12-18 16:52:59 +0100
commit33e847bf4edc06be68589467d0f6a31c07d911ac (patch)
treed635352dbea2aa448395d52703351ec8c7242fe4 /src/credential/credential_api.c
parent9c5ecc381458c941fdb70f1f4a47e76daac4eda5 (diff)
downloadgnunet-33e847bf4edc06be68589467d0f6a31c07d911ac.tar.gz
gnunet-33e847bf4edc06be68589467d0f6a31c07d911ac.zip
-fixes
Diffstat (limited to 'src/credential/credential_api.c')
-rw-r--r--src/credential/credential_api.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/credential/credential_api.c b/src/credential/credential_api.c
index d9e01c1d3..e991b4153 100644
--- a/src/credential/credential_api.c
+++ b/src/credential/credential_api.c
@@ -430,52 +430,4 @@ GNUNET_CREDENTIAL_verify (struct GNUNET_CREDENTIAL_Handle *handle,
430 return vr; 430 return vr;
431} 431}
432 432
433/**
434 * Issue an attribute to a subject
435 *
436 * @param handle handle to the Credential service
437 * @param issuer the ego that should be used to issue the attribute
438 * @param subject the subject of the attribute
439 * @param attribute the name of the attribute
440 * @return handle to the queued request
441 */
442struct GNUNET_CREDENTIAL_CredentialRecordData *
443GNUNET_CREDENTIAL_issue (struct GNUNET_CREDENTIAL_Handle *handle,
444 const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
445 struct GNUNET_CRYPTO_EcdsaPublicKey *subject,
446 const char *attribute,
447 struct GNUNET_TIME_Absolute *expiration)
448{
449 struct GNUNET_CREDENTIAL_CredentialRecordData *crd;
450
451 crd = GNUNET_malloc (sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData) + strlen (attribute) + 1);
452
453 crd->purpose.size = htonl (strlen (attribute) + 1 +
454 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) +
455 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
456 sizeof (uint64_t));
457
458 crd->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL);
459 GNUNET_CRYPTO_ecdsa_key_get_public (issuer,
460 &crd->issuer_key);
461 crd->subject_key = *subject;
462 crd->expiration = GNUNET_htonll (expiration->abs_value_us);
463 GNUNET_memcpy (&crd[1],
464 attribute,
465 strlen (attribute));
466 if (GNUNET_OK !=
467 GNUNET_CRYPTO_ecdsa_sign (issuer,
468 &crd->purpose,
469 &crd->signature))
470 {
471 GNUNET_break (0);
472 GNUNET_free (crd);
473 return NULL;
474 }
475 return crd;
476}
477
478
479
480
481/* end of credential_api.c */ 433/* end of credential_api.c */