Using crypto rsa to sign protobuf message in the record.

This commit is contained in:
Jose Marcial Vieira Bisneto 2017-01-26 23:41:03 -03:00
parent d13a47d7d5
commit ee6049804a

View file

@ -48,12 +48,13 @@ int libp2p_record_make_put_record (char** record, size_t *rec_size, struct RsaPr
free (pkh); free (pkh);
len += l; len += l;
if (sign) { if (sign) {
//TODO: missing signature function at libp2p-crypto ? char sign_buf[2048];
//sign(sk, signature, p, len); if (!libp2p_crypto_rsa_sign (sk, (unsigned char*) p, len, (unsigned char*) sign_buf) ||
//proto encode signature. !protobuf_encode_string (4, WIRETYPE_LENGTH_DELIMITED, sign_buf, p+len, RECORD_BUFSIZE-len, &l)) {
free (pkh);
free (p); free (p);
return -1; // not implemented. return -1;
}
len += l;
} }
} }
*record = realloc(p, len); // Reduces memory used for just what is needed. *record = realloc(p, len); // Reduces memory used for just what is needed.