mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed signature code
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5278 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
444602e8e6
commit
93f08ae730
@ -738,7 +738,7 @@ bool PGPHandler::privateSignCertificate(const PGPIdType& ownId,const PGPIdType&
|
||||
|
||||
// 2 - then do the signature.
|
||||
|
||||
bool ret = ops_sign_key(key_to_sign,&pkey->uids[0],pkey->key_id,secret_key) ;
|
||||
bool ret = ops_sign_key(key_to_sign,pkey->key_id,secret_key) ;
|
||||
|
||||
// 3 - free memory
|
||||
//
|
||||
|
@ -611,7 +611,7 @@ ops_boolean_t ops_add_selfsigned_userid_to_keydata(ops_keydata_t* keydata, ops_u
|
||||
\brief Add signature to given key
|
||||
\return ops_true if OK; else ops_false
|
||||
*/
|
||||
ops_boolean_t ops_sign_key(ops_keydata_t* keydata, ops_user_id_t* userid,const unsigned char *signers_key_id,ops_secret_key_t *signers_key)
|
||||
ops_boolean_t ops_sign_key(ops_keydata_t* keydata, const unsigned char *signers_key_id,ops_secret_key_t *signers_key)
|
||||
{
|
||||
/* ops_memory_t* mem_userid=NULL; */
|
||||
ops_create_info_t* cinfo_userid=NULL;
|
||||
@ -625,17 +625,12 @@ ops_boolean_t ops_sign_key(ops_keydata_t* keydata, ops_user_id_t* userid,const u
|
||||
* create signature packet for this userid
|
||||
*/
|
||||
|
||||
// create userid pkt
|
||||
/* ops_setup_memory_write(&cinfo_userid, &mem_userid, 128); */
|
||||
/* ops_write_struct_user_id(userid, cinfo_userid); */
|
||||
|
||||
// create sig for this pkt
|
||||
|
||||
sig=ops_create_signature_new();
|
||||
ops_signature_start_key_signature(sig, &keydata->key.skey.public_key, userid, OPS_CERT_POSITIVE);
|
||||
ops_signature_start_key_signature(sig, &keydata->key.skey.public_key, &keydata->uids[0], OPS_CERT_GENERIC);
|
||||
ops_signature_add_creation_time(sig,time(NULL));
|
||||
ops_signature_add_issuer_key_id(sig,signers_key_id);
|
||||
/* ops_signature_add_primary_user_id(sig, ops_true); */
|
||||
ops_signature_hashed_subpackets_end(sig);
|
||||
|
||||
ops_setup_memory_write(&cinfo_sig, &mem_sig, 128);
|
||||
@ -648,13 +643,11 @@ ops_boolean_t ops_sign_key(ops_keydata_t* keydata, ops_user_id_t* userid,const u
|
||||
sigpacket.raw=ops_memory_get_data(mem_sig);
|
||||
|
||||
// add userid to keydata
|
||||
ops_add_signed_userid_to_keydata(keydata, userid, &sigpacket);
|
||||
ops_add_packet_to_keydata(keydata, &sigpacket);
|
||||
|
||||
// cleanup
|
||||
ops_create_signature_delete(sig);
|
||||
/* ops_create_info_delete(cinfo_userid); */
|
||||
ops_create_info_delete(cinfo_sig);
|
||||
/* ops_memory_free(mem_userid);*/
|
||||
ops_memory_free(mem_sig);
|
||||
|
||||
return ops_true;
|
||||
|
@ -83,7 +83,7 @@ ops_packet_t* ops_add_packet_to_keydata(ops_keydata_t* keydata, const ops_packet
|
||||
void ops_add_signed_userid_to_keydata(ops_keydata_t* keydata, const ops_user_id_t* userid, const ops_packet_t* packet);
|
||||
|
||||
ops_boolean_t ops_add_selfsigned_userid_to_keydata(ops_keydata_t* keydata, ops_user_id_t* userid);
|
||||
ops_boolean_t ops_sign_key(ops_keydata_t* keydata_to_sign, ops_user_id_t* userid,const unsigned char *signers_key_id,ops_secret_key_t *signers_key);
|
||||
ops_boolean_t ops_sign_key(ops_keydata_t* keydata_to_sign, const unsigned char *signers_key_id,ops_secret_key_t *signers_decrypted_private_key);
|
||||
|
||||
ops_keydata_t *ops_keydata_new(void);
|
||||
void ops_keydata_init(ops_keydata_t* keydata, const ops_content_tag_t type);
|
||||
|
@ -236,11 +236,14 @@ ops_validate_key_cb(const ops_parser_content_t *content_,ops_parse_cb_info_t *cb
|
||||
|
||||
case OPS_PTAG_CT_SIGNATURE: // V3 sigs
|
||||
case OPS_PTAG_CT_SIGNATURE_FOOTER: // V4 sigs
|
||||
/*
|
||||
printf(" type=%02x signer_id=",content->signature.type);
|
||||
hexdump(content->signature.signer_id,
|
||||
sizeof content->signature.signer_id);
|
||||
*/
|
||||
|
||||
if(debug)
|
||||
{
|
||||
printf(" type=%02x signer_id=",content->signature.info.type);
|
||||
hexdump(content->signature.info.signer_id,
|
||||
sizeof content->signature.info.signer_id);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
signer=ops_keyring_find_key_by_id(arg->keyring,
|
||||
content->signature.info.signer_id);
|
||||
|
Loading…
Reference in New Issue
Block a user