|
|
|
@ -27,7 +27,7 @@ struct rdf_enum types = {
|
|
|
|
|
.filter = type_filter,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct rdf_serialize_field ap_object_rdf[];
|
|
|
|
|
extern struct rdf_serialize_field ap_object_rdf[];
|
|
|
|
|
|
|
|
|
|
static struct rdf_serialize_field activity_ref_types[] = {
|
|
|
|
|
{
|
|
|
|
@ -41,7 +41,7 @@ static struct rdf_serialize_field activity_ref_types[] = {
|
|
|
|
|
.type = &rdf_object_field,
|
|
|
|
|
.subtype = &ap_object_rdf
|
|
|
|
|
},
|
|
|
|
|
{ NULL },
|
|
|
|
|
{ .predicate = {0} },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define OBJ_TYPE struct ap_object
|
|
|
|
@ -172,7 +172,7 @@ static char* serialize_normalized_object( struct rdf_serialize_field* layout, vo
|
|
|
|
|
return outbuf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool calculate_hash_for_object( struct rdf_serialize_field* layout, void* object, char* hash )
|
|
|
|
|
static bool calculate_hash_for_object( struct rdf_serialize_field* layout, void* object, unsigned char* hash )
|
|
|
|
|
{
|
|
|
|
|
size_t size = 0;
|
|
|
|
|
|
|
|
|
@ -201,14 +201,13 @@ static bool calculate_hash_for_object( struct rdf_serialize_field* layout, void*
|
|
|
|
|
|
|
|
|
|
bool ap_activity_create_rsa_signature_2017( struct ap_object* act, struct crypto_keys* keys )
|
|
|
|
|
{
|
|
|
|
|
char* signature_buf = NULL;
|
|
|
|
|
printf( "ap_activity_create_rsa_signature_2017\n" );
|
|
|
|
|
//printf( "ap_activity_create_rsa_signature_2017\n" );
|
|
|
|
|
|
|
|
|
|
// Setup signature
|
|
|
|
|
asprintf( &act->signature.creator, "%s#main-key", act->actor );
|
|
|
|
|
act->signature.created = time(NULL);
|
|
|
|
|
|
|
|
|
|
char raw_hash[64];
|
|
|
|
|
unsigned char raw_hash[64];
|
|
|
|
|
if( !calculate_hash_for_object( ap_object_rdf, act, &raw_hash[0] ) ) { return NULL; }
|
|
|
|
|
if( !calculate_hash_for_object( ap_signature_rdf, &act->signature, &raw_hash[32] ) ) { return NULL; }
|
|
|
|
|
|
|
|
|
|