Major bugfixes to get PGP authentication finished.

* p3disc now exchanges "Issuer" (pgp) certificates as well.
 * additional types for rsdiscitems.h
 * Bug Fix for NULL packet in p3service.cc
 * allow unauthed SSL certificates to be added in AuthSSL - otherwise cant add new friends!
 * only save authed SSL certificates.
 * fixed ref/unref of PGP keys in AuthGPG
 * added Mutex protection to AuthGPG
 * added PGP reloading when key is imported, or signed.
 * Fixed PGP key signing.
 * added Additional field validLvl to RsPeerDetails.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1270 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2009-05-25 11:38:47 +00:00
parent aeb07b4ce5
commit d4b52a59e5
15 changed files with 566 additions and 95 deletions

View file

@ -30,6 +30,8 @@
#include "serialiser/rsbaseserial.h"
#include "util/rsnet.h"
#include <iostream>
/* UInt16 get/set */
bool getRawUInt16(void *data, uint32_t size, uint32_t *offset, uint16_t *out)
@ -152,3 +154,55 @@ bool setRawUInt64(void *data, uint32_t size, uint32_t *offset, uint64_t in)
bool getRawString(void *data, uint32_t size, uint32_t *offset, std::string &outStr)
{
uint32_t len = 0;
if (!getRawUInt32(data, size, offset, &len))
{
std::cerr << "getRawString() get size failed" << std::endl;
return false;
}
/* check there is space for string */
if (size < *offset + len)
{
std::cerr << "getRawString() not enough size" << std::endl;
return false;
}
uint8_t *buf = &(((uint8_t *) data)[*offset]);
for (int i = 0; i < len; i++)
{
outStr += buf[i];
}
(*offset) += len;
return true;
}
bool setRawString(void *data, uint32_t size, uint32_t *offset, std::string &inStr)
{
uint32_t len = inStr.length();
/* first check there is space */
if (size < *offset + 4 + len)
{
//#ifdef RSSERIAL_DEBUG
std::cerr << "setRawString() Not enough size" << std::endl;
//#endif
return false;
}
if (!setRawUInt32(data, size, offset, len))
{
std::cerr << "setRawString() set size failed" << std::endl;
return false;
}
void *buf = (void *) &(((uint8_t *) data)[*offset]);
/* pack it in */
memcpy(buf, inStr.c_str(), len);
(*offset) += len;
return true;
}