mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
changed prototype of Radix encoding to take unsigned char* instead of char*
This commit is contained in:
parent
9a86989060
commit
2591e3ff25
@ -121,13 +121,13 @@ std::string PGPKeyParser::extractRadixPartFromArmouredKey(const std::string& pgp
|
|||||||
std::string PGPKeyManagement::makeArmouredKey(const unsigned char *keydata,size_t key_size,const std::string& version_string)
|
std::string PGPKeyManagement::makeArmouredKey(const unsigned char *keydata,size_t key_size,const std::string& version_string)
|
||||||
{
|
{
|
||||||
std::string outstring ;
|
std::string outstring ;
|
||||||
Radix64::encode((const char *)keydata,key_size,outstring) ;
|
Radix64::encode(keydata,key_size,outstring) ;
|
||||||
|
|
||||||
uint32_t crc = compute24bitsCRC((unsigned char *)keydata,key_size) ;
|
uint32_t crc = compute24bitsCRC((unsigned char *)keydata,key_size) ;
|
||||||
|
|
||||||
unsigned char tmp[3] = { uint8_t((crc >> 16) & 0xff), uint8_t((crc >> 8) & 0xff), uint8_t(crc & 0xff) } ;
|
unsigned char tmp[3] = { uint8_t((crc >> 16) & 0xff), uint8_t((crc >> 8) & 0xff), uint8_t(crc & 0xff) } ;
|
||||||
std::string crc_string ;
|
std::string crc_string ;
|
||||||
Radix64::encode((const char *)tmp,3,crc_string) ;
|
Radix64::encode(tmp,3,crc_string) ;
|
||||||
|
|
||||||
#ifdef DEBUG_PGPUTIL
|
#ifdef DEBUG_PGPUTIL
|
||||||
std::cerr << "After signature pruning: " << std::endl;
|
std::cerr << "After signature pruning: " << std::endl;
|
||||||
|
@ -109,7 +109,7 @@ std::string RsCertificate::toStdString() const
|
|||||||
|
|
||||||
std::string out_string ;
|
std::string out_string ;
|
||||||
|
|
||||||
Radix64::encode((char *)buf, p, out_string) ;
|
Radix64::encode(buf, p, out_string) ;
|
||||||
|
|
||||||
// Now slice up to 64 chars.
|
// Now slice up to 64 chars.
|
||||||
//
|
//
|
||||||
|
@ -1083,12 +1083,12 @@ bool p3Peers::GetPGPBase64StringAndCheckSum( const RsPgpId& gpg_id,
|
|||||||
if(!AuthGPG::getAuthGPG()->exportPublicKey(gpg_id,mem_block,mem_block_size,false,false))
|
if(!AuthGPG::getAuthGPG()->exportPublicKey(gpg_id,mem_block,mem_block_size,false,false))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
Radix64::encode((const char *)mem_block,mem_block_size,gpg_base64_string) ;
|
Radix64::encode(mem_block,mem_block_size,gpg_base64_string) ;
|
||||||
|
|
||||||
uint32_t crc = PGPKeyManagement::compute24bitsCRC((unsigned char *)mem_block,mem_block_size) ;
|
uint32_t crc = PGPKeyManagement::compute24bitsCRC((unsigned char *)mem_block,mem_block_size) ;
|
||||||
|
|
||||||
unsigned char tmp[3] = { uint8_t((crc >> 16) & 0xff), uint8_t((crc >> 8) & 0xff), uint8_t(crc & 0xff) } ;
|
unsigned char tmp[3] = { uint8_t((crc >> 16) & 0xff), uint8_t((crc >> 8) & 0xff), uint8_t(crc & 0xff) } ;
|
||||||
Radix64::encode((const char *)tmp,3,gpg_base64_checksum) ;
|
Radix64::encode(tmp,3,gpg_base64_checksum) ;
|
||||||
|
|
||||||
delete[] mem_block ;
|
delete[] mem_block ;
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ again:
|
|||||||
/****************
|
/****************
|
||||||
* create a radix64 encoded string.
|
* create a radix64 encoded string.
|
||||||
*/
|
*/
|
||||||
static void encode(const char *data,int len,std::string& out_string)
|
static void encode(const unsigned char *data,int len,std::string& out_string)
|
||||||
{
|
{
|
||||||
char *buffer, *p;
|
char *buffer, *p;
|
||||||
|
|
||||||
|
@ -486,7 +486,9 @@ bool RsRecogn::itemToRadix64(RsItem *item, std::string &radstr)
|
|||||||
|
|
||||||
/* write out the item for signing */
|
/* write out the item for signing */
|
||||||
uint32_t len = serialiser.size(item);
|
uint32_t len = serialiser.size(item);
|
||||||
char *buf = new char[len];
|
|
||||||
|
RsTemporaryMemory buf(len) ;
|
||||||
|
|
||||||
if (!serialiser.serialise(item, buf, &len))
|
if (!serialiser.serialise(item, buf, &len))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -609,7 +611,7 @@ bool RsRecogn::createTagRequest(const RsTlvSecurityKey &key, const RsGxsId &id,
|
|||||||
/* write out the item for signing */
|
/* write out the item for signing */
|
||||||
RsGxsRecognSerialiser serialiser;
|
RsGxsRecognSerialiser serialiser;
|
||||||
uint32_t len = serialiser.size(item);
|
uint32_t len = serialiser.size(item);
|
||||||
char *buf = new char[len];
|
RsTemporaryMemory buf(len) ;
|
||||||
bool serOk = serialiser.serialise(item, buf, &len);
|
bool serOk = serialiser.serialise(item, buf, &len);
|
||||||
|
|
||||||
if (serOk)
|
if (serOk)
|
||||||
@ -617,8 +619,6 @@ bool RsRecogn::createTagRequest(const RsTlvSecurityKey &key, const RsGxsId &id,
|
|||||||
Radix64::encode(buf, len, tag);
|
Radix64::encode(buf, len, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete []buf;
|
|
||||||
|
|
||||||
if (!serOk)
|
if (!serOk)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_RECOGN
|
#ifdef DEBUG_RECOGN
|
||||||
|
Loading…
Reference in New Issue
Block a user