bug fixing

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5053 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-03-27 21:45:43 +00:00
parent 765b6b9486
commit 51fa97ac59

View File

@ -8,7 +8,9 @@
extern "C" {
#include <openpgpsdk/util.h>
#include <openpgpsdk/crypto.h>
#include <openpgpsdk/armour.h>
#include <openpgpsdk/keyring.h>
#include <openpgpsdk/readerwriter.h>
}
#include "pgphandler.h"
@ -156,7 +158,7 @@ bool PGPHandler::GeneratePGPCertificate(const std::string& name, const std::stri
static const int KEY_NUMBITS = 2048 ;
ops_user_id_t uid ;
const char *s = (name + " " + email).c_str() ;
const char *s = strdup((name + " " + email + " (Generated by RetroShare)").c_str()) ;
uid.user_id = (unsigned char *)s ;
unsigned long int e = 44497 ; // some prime number
@ -167,6 +169,26 @@ bool PGPHandler::GeneratePGPCertificate(const std::string& name, const std::stri
pgpId = PGPIdType(key->key_id) ;
// Now output the pubkey to a string.
//
ops_boolean_t armoured=ops_true;
ops_boolean_t overwrite=ops_true;
ops_create_info_t* cinfo;
ops_memory_t *buf = NULL ;//(ops_memory_t*)ops_mallocz(1000) ;
ops_setup_memory_write(&cinfo, &buf, 0);
ops_writer_push_armoured(cinfo,OPS_PGP_PUBLIC_KEY_BLOCK) ;
//ops_writer_push_armoured(cinfo,OPS_PGP_SIGNATURE) ;
ops_write_transferable_public_key(key,armoured,cinfo);
//ops_writer_close(cinfo) ;
std::cerr << "Memory written: size = " << ops_memory_get_length(buf) << std::endl;
std::cerr << "String of key: " << std::endl;
std::cerr << std::string((char *)ops_memory_get_data(buf),ops_memory_get_length(buf)) << std::endl;
//ops_teardown_memory_write(cinfo,buf);
ops_keydata_free(key) ;
return true ;
}