Example #1
0
static void send_pubkey_user(CcnetProcessor *processor, 
                             char *code, char *code_msg,
                             char *content, int clen)
{
    GString *str;
    
    str = public_key_to_gstring(processor->session->user_pubkey);
    ccnet_processor_send_response (processor, code, "", str->str, str->len+1);
}
Example #2
0
char *
id_from_pubkey (RSA *pubkey)
{
    GString *buf;
    unsigned char sha1[20];
    char *id = (char *)g_malloc(41);

    buf = public_key_to_gstring (pubkey);
    calculate_sha1 (sha1, buf->str);
    sha1_to_hex (sha1, id);
    g_string_free (buf, TRUE);

    return id;
}
Example #3
0
GString*
ccnet_peer_to_string (CcnetPeer *peer)
{
    GString *buf = g_string_new (NULL);
    g_string_append (buf, "peer/");
    g_string_append (buf, peer->id);
    g_string_append (buf, "\n");

    append_string_property (buf, "name", peer->name);
    append_string_property (buf, "service-url", peer->service_url);

    if (peer->pubkey) {
        GString *str = public_key_to_gstring(peer->pubkey);
        g_string_append_printf (buf, "%s %s\n", "pubkey", str->str);
        g_string_free(str, TRUE);
    }

    return buf;
}