diff --git a/libretroshare/src/pgp/pgpkeyutil.cc b/libretroshare/src/pgp/pgpkeyutil.cc index 50fca0482..b4e2161c2 100644 --- a/libretroshare/src/pgp/pgpkeyutil.cc +++ b/libretroshare/src/pgp/pgpkeyutil.cc @@ -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 outstring ; - Radix64::encode((const char *)keydata,key_size,outstring) ; + Radix64::encode(keydata,key_size,outstring) ; 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) } ; std::string crc_string ; - Radix64::encode((const char *)tmp,3,crc_string) ; + Radix64::encode(tmp,3,crc_string) ; #ifdef DEBUG_PGPUTIL std::cerr << "After signature pruning: " << std::endl; diff --git a/libretroshare/src/pgp/rscertificate.cc b/libretroshare/src/pgp/rscertificate.cc index 21eaeee0e..9f78a78de 100644 --- a/libretroshare/src/pgp/rscertificate.cc +++ b/libretroshare/src/pgp/rscertificate.cc @@ -109,7 +109,7 @@ std::string RsCertificate::toStdString() const std::string out_string ; - Radix64::encode((char *)buf, p, out_string) ; + Radix64::encode(buf, p, out_string) ; // Now slice up to 64 chars. // diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc index d5d55c53e..48ea46a7c 100644 --- a/libretroshare/src/rsserver/p3peers.cc +++ b/libretroshare/src/rsserver/p3peers.cc @@ -1083,12 +1083,12 @@ bool p3Peers::GetPGPBase64StringAndCheckSum( const RsPgpId& gpg_id, if(!AuthGPG::getAuthGPG()->exportPublicKey(gpg_id,mem_block,mem_block_size,false,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) ; 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 ; diff --git a/libretroshare/src/util/radix64.h b/libretroshare/src/util/radix64.h index 0125fa5d7..dc7f8528c 100644 --- a/libretroshare/src/util/radix64.h +++ b/libretroshare/src/util/radix64.h @@ -101,7 +101,7 @@ again: /**************** * 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; diff --git a/libretroshare/src/util/rsrecogn.cc b/libretroshare/src/util/rsrecogn.cc index 0f5fc0504..4ce5f5ef9 100644 --- a/libretroshare/src/util/rsrecogn.cc +++ b/libretroshare/src/util/rsrecogn.cc @@ -486,7 +486,9 @@ bool RsRecogn::itemToRadix64(RsItem *item, std::string &radstr) /* write out the item for signing */ uint32_t len = serialiser.size(item); - char *buf = new char[len]; + + RsTemporaryMemory buf(len) ; + if (!serialiser.serialise(item, buf, &len)) { return false; @@ -609,7 +611,7 @@ bool RsRecogn::createTagRequest(const RsTlvSecurityKey &key, const RsGxsId &id, /* write out the item for signing */ RsGxsRecognSerialiser serialiser; uint32_t len = serialiser.size(item); - char *buf = new char[len]; + RsTemporaryMemory buf(len) ; bool serOk = serialiser.serialise(item, buf, &len); if (serOk) @@ -617,8 +619,6 @@ bool RsRecogn::createTagRequest(const RsTlvSecurityKey &key, const RsGxsId &id, Radix64::encode(buf, len, tag); } - delete []buf; - if (!serOk) { #ifdef DEBUG_RECOGN