added PgPID and sslid support in gxs components.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7120 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2014-02-15 16:12:29 +00:00
parent cf653b380f
commit 13a029f9ad
8 changed files with 176 additions and 170 deletions

View file

@ -233,11 +233,11 @@ bool GrpCircleVetting::expired()
{
return time(NULL) > (mTimeStamp + EXPIRY_PERIOD_OFFSET);
}
bool GrpCircleVetting::canSend(const RsPgpId& peerId, const RsGxsCircleId& circleId)
bool GrpCircleVetting::canSend(const SSLIdType& peerId, const RsGxsCircleId& circleId)
{
if(mCircles->isLoaded(circleId))
{
const RsPgpId& pgpId = rsPeers->getGPGId(peerId);
const PGPIdType& pgpId = rsPeers->getGPGId(peerId);
return mCircles->canSend(circleId, pgpId);
}
@ -247,7 +247,7 @@ bool GrpCircleVetting::canSend(const RsPgpId& peerId, const RsGxsCircleId& circl
}
GrpCircleIdRequestVetting::GrpCircleIdRequestVetting(
RsGcxs* const circles, std::vector<GrpIdCircleVet> grpCircleV, const std::string& peerId)
RsGcxs* const circles, std::vector<GrpIdCircleVet> grpCircleV, const RsPeerId& peerId)
: GrpCircleVetting(circles), mGrpCircleV(grpCircleV), mPeerId(peerId) {}
bool GrpCircleIdRequestVetting::cleared()
@ -287,7 +287,7 @@ MsgIdCircleVet::MsgIdCircleVet(const RsGxsMessageId& msgId,
MsgCircleIdsRequestVetting::MsgCircleIdsRequestVetting(RsGcxs* const circles,
std::vector<MsgIdCircleVet> msgs, const RsGxsGroupId& grpId,
const std::string& peerId, const RsGxsCircleId& circleId)
const RsPeerId& peerId, const RsGxsCircleId& circleId)
: GrpCircleVetting(circles), mMsgs(msgs), mGrpId(grpId), mPeerId(peerId), mCircleId(circleId) {}
bool MsgCircleIdsRequestVetting::cleared()

View file

@ -250,7 +250,7 @@ public:
virtual bool cleared() = 0;
protected:
bool canSend(const RsPgpId& peerId, const RsGxsCircleId& circleId);
bool canSend(const SSLIdType& peerId, const RsGxsCircleId& circleId);
private:

View file

@ -89,7 +89,7 @@ class RsGxsIdGroup
// Not Serialised - for GUI's benefit.
bool mPgpKnown;
std::string mPgpId;
RsPgpId mPgpId;
};
@ -214,7 +214,7 @@ class RsIdentityDetails
// PGP Stuff.
bool mPgpLinked;
bool mPgpKnown;
std::string mPgpId;
RsPgpId mPgpId;
// Recogn details.
std::list<RsRecognTag> mRecognTags;

View file

@ -121,7 +121,10 @@ bool RsGxsCircleGroupItem::convertFrom(const RsGxsCircleGroup &group)
// Enforce the local rules.
if (meta.mCircleType == GXS_CIRCLE_TYPE_LOCAL)
{
pgpIdSet.ids = group.mLocalFriends;
std::list<RsPgpId>::const_iterator it = group.mLocalFriends.begin();
for(; it != group.mLocalFriends.end(); it++)
pgpIdSet.ids.push_back(it->toStdString());
}
else
{
@ -138,7 +141,9 @@ bool RsGxsCircleGroupItem::convertTo(RsGxsCircleGroup &group) const
// Enforce the local rules.
if (meta.mCircleType == GXS_CIRCLE_TYPE_LOCAL)
{
group.mLocalFriends = pgpIdSet.ids;
std::list<std::string>::const_iterator it = pgpIdSet.ids.begin();
for(; it != pgpIdSet.ids.end(); it++)
group.mLocalFriends.push_back(RsPgpId(*it));
group.mInvitedMembers.clear();
}
else

View file

@ -311,7 +311,7 @@ bool p3GxsCircles::loadCircle(const RsGxsCircleId &circleId)
return cache_request_load(circleId);
}
int p3GxsCircles::canSend(const RsGxsCircleId &circleId, const std::string &id)
int p3GxsCircles::canSend(const RsGxsCircleId &circleId, const RsPgpId &id)
{
RsStackMutex stack(mCircleMtx); /********** STACK LOCKED MTX ******/
if (mCircleCache.is_cached(circleId))

View file

@ -478,7 +478,7 @@ bool p3IdService::haveReputation(const RsGxsId &id)
return haveKey(id);
}
bool p3IdService::loadReputation(const RsGxsId &id, const std::list<std::string>& peers)
bool p3IdService::loadReputation(const RsGxsId &id, const std::list<PeerId>& peers)
{
if (haveKey(id))
return true;
@ -556,7 +556,7 @@ bool p3IdService::getGroupData(const uint32_t &token, std::vector<RsGxsIdGroup>
else
{
group.mPgpKnown = false;
group.mPgpId = "";
group.mPgpId.clear();
std::cerr << "p3IdService::getGroupData() Failed to decode ServiceString";
std::cerr << std::endl;
@ -699,7 +699,8 @@ bool SSGxsIdPgp::load(const std::string &input)
if (1 == sscanf(input.c_str(), "K:1 I:%[^)]", pgpline))
{
idKnown = true;
pgpId = pgpline;
std::string str_line = pgpline;
pgpId = RsPgpId(str_line);
}
else if (1 == sscanf(input.c_str(), "K:0 T:%d", &timestamp))
{
@ -719,7 +720,7 @@ std::string SSGxsIdPgp::save() const
if (idKnown)
{
output += "K:1 I:";
output += pgpId;
output += pgpId.toStdString();
}
else
{
@ -1039,7 +1040,7 @@ void RsGxsIdCache::updateServiceString(std::string serviceString)
}
else
{
details.mPgpId = "";
details.mPgpId.clear();
}
}
@ -1097,7 +1098,7 @@ void RsGxsIdCache::updateServiceString(std::string serviceString)
else
{
details.mPgpKnown = false;
details.mPgpId = "";
details.mPgpId.clear();
details.mOpinion = 0;
details.mReputation = 0;
@ -1329,7 +1330,7 @@ bool p3IdService::cache_store(const RsGxsIdGroupItem *item)
#define MIN_CYCLE_GAP 2
bool p3IdService::cache_request_load(const RsGxsId &id, const std::list<std::string>& peers)
bool p3IdService::cache_request_load(const RsGxsId &id, const std::list<PeerId>& peers)
{
#ifdef DEBUG_IDS
std::cerr << "p3IdService::cache_request_load(" << id << ")";
@ -1370,7 +1371,7 @@ bool p3IdService::cache_start_load()
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
/* now we process the modGroupList -> a map so we can use it easily later, and create id list too */
std::map<RsGxsId, std::list<std::string> >::iterator it;
std::map<RsGxsId, std::list<RsPeerId> >::iterator it;
for(it = mCacheLoad_ToCache.begin(); it != mCacheLoad_ToCache.end(); it++)
{
#ifdef DEBUG_IDS
@ -1471,8 +1472,8 @@ void p3IdService::requestIdsFromNet()
{
RsStackMutex stack(mIdMtx);
std::map<RsGxsId, std::list<std::string> >::const_iterator cit;
std::map<std::string, std::list<RsGxsId> > requests;
std::map<RsGxsId, std::list<RsPeerId> >::const_iterator cit;
std::map<RsPeerId, std::list<RsGxsId> > requests;
// transform to appropriate structure (<peer, std::list<RsGxsId> > map) to make request to nes
for(cit = mIdsNotPresent.begin(); cit != mIdsNotPresent.end(); cit++)
@ -1486,13 +1487,13 @@ void p3IdService::requestIdsFromNet()
}
const std::list<std::string>& peers = cit->second;
std::list<std::string>::const_iterator cit2;
const std::list<RsPeerId>& peers = cit->second;
std::list<RsPeerId>::const_iterator cit2;
for(cit2 = peers.begin(); cit2 != peers.end(); cit2++)
requests[*cit2].push_back(cit->first);
}
std::map<std::string, std::list<RsGxsId> >::const_iterator cit2;
std::map<RsPeerId, std::list<RsGxsId> >::const_iterator cit2;
for(cit2 = requests.begin(); cit2 != requests.end(); cit2++)
{
@ -2234,7 +2235,7 @@ bool p3IdService::pgphash_process()
/* update */
ssdata.pgp.idKnown = true;
ssdata.pgp.pgpId = pgpId.toStdString();
ssdata.pgp.pgpId = pgpId;
}
else
@ -2312,7 +2313,7 @@ bool p3IdService::checkId(const RsGxsIdGroup &grp, PGPIdType &pgpId)
/* check signature too */
if (AuthGPG::getAuthGPG()->VerifySignBin((void *) hash.toByteArray(), hash.SIZE_IN_BYTES,
(unsigned char *) grp.mPgpIdSign.c_str(), grp.mPgpIdSign.length(),
mit->second.toStdString()))
mit->second))
{
std::cerr << "p3IdService::checkId() Signature Okay too!";
std::cerr << std::endl;
@ -2372,14 +2373,14 @@ void p3IdService::getPgpIdList()
std::cerr << std::endl;
#endif // DEBUG_IDS
std::list<std::string> list;
std::list<PGPIdType> list;
AuthGPG::getAuthGPG()->getGPGFilteredList(list);
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
mPgpFingerprintMap.clear();
std::list<std::string>::iterator it;
std::list<PGPIdType>::iterator it;
for(it = list.begin(); it != list.end(); it++)
{
PGPIdType pgpId(*it);
@ -2840,7 +2841,7 @@ void p3IdService::generateDummy_OwnIds()
/* grab all the gpg ids... and make some ids */
std::string ownId = rsPeers->getGPGOwnId();
PGPIdType ownId = rsPeers->getGPGOwnId();
// generate some ownIds.
int genCount = 0;
@ -2854,15 +2855,15 @@ void p3IdService::generateDummy_OwnIds()
id.mMeta.mGroupFlags = RSGXSID_GROUPFLAG_REALID;
// HACK FOR DUMMY GENERATION.
id.mMeta.mAuthorId = ownId;
if (rsPeers->getPeerDetails(ownId, details))
{
std::ostringstream out;
out << details.name << "_" << i + 1;
id.mMeta.mGroupName = out.str();
}
// // HACK FOR DUMMY GENERATION.
// id.mMeta.mAuthorId = ownId.toStdString();
// if (rsPeers->getPeerDetails(ownId, details))
// {
// std::ostringstream out;
// out << details.name << "_" << i + 1;
//
// id.mMeta.mGroupName = out.str();
// }
uint32_t dummyToken = 0;
createGroup(dummyToken, id);
@ -2875,8 +2876,8 @@ void p3IdService::generateDummy_FriendPGP()
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
// Now Generate for friends.
std::list<std::string> gpgids;
std::list<std::string>::iterator it;
std::list<PGPIdType> gpgids;
std::list<PGPIdType>::const_iterator it;
rsPeers->getGPGAllList(gpgids);
RsGxsIdGroup id;
@ -2888,10 +2889,10 @@ void p3IdService::generateDummy_FriendPGP()
for(int j = 0; j < idx; j++, it++) ;
// HACK FOR DUMMY GENERATION.
id.mMeta.mAuthorId = *it;
id.mMeta.mAuthorId = it->toStdString();
RsPeerDetails details;
if (rsPeers->getPeerDetails(*it, details))
if (/*rsPeers->getPeerDetails(*it, details)*/false)
{
std::ostringstream out;
out << details.name << "_" << RSRandom::random_u32() % 1000;

View file

@ -73,7 +73,7 @@ virtual std::string save() const;
bool idKnown;
time_t lastCheckTs;
uint32_t checkAttempts;
std::string pgpId;
RsPgpId pgpId;
};
class SSGxsIdRecognTags: public SSBit
@ -290,7 +290,7 @@ virtual void handle_event(uint32_t event_type, const std::string &elabel);
*/
int cache_tick();
bool cache_request_load(const RsGxsId &id, const std::list<std::string>& peers = std::list<std::string>());
bool cache_request_load(const RsGxsId &id, const std::list<PeerId>& peers = std::list<PeerId>());
bool cache_start_load();
bool cache_load_for_token(uint32_t token);
@ -303,7 +303,7 @@ virtual void handle_event(uint32_t event_type, const std::string &elabel);
// Mutex protected.
//std::list<RsGxsId> mCacheLoad_ToCache;
std::map<RsGxsId, std::list<std::string> > mCacheLoad_ToCache, mPendingCache;
std::map<RsGxsId, std::list<RsPeerId> > mCacheLoad_ToCache, mPendingCache;
// Switching to RsMemCache for Key Caching.
RsMemCache<RsGxsId, RsGxsIdCache> mPublicKeyCache;
@ -434,7 +434,7 @@ std::string genRandomId(int len = 20);
std::map<uint32_t, std::set<RsGxsGroupId> > mIdsPendingCache;
std::map<uint32_t, std::list<RsGxsGroupId> > mGroupNotPresent;
std::map<RsGxsId, std::list<std::string> > mIdsNotPresent;
std::map<RsGxsId, std::list<RsPeerId> > mIdsNotPresent;
RsNetworkExchangeService* mNes;
};

View file

@ -27,130 +27,130 @@
//
#pragma once
#include <stdexcept>
#include <string>
#include <string.h>
#include <stdint.h>
#include <util/rsrandom.h>
template<uint32_t ID_SIZE_IN_BYTES,uint32_t UNIQUE_IDENTIFIER> class t_RsGenericIdType
{
public:
t_RsGenericIdType()
{
memset(bytes,0,ID_SIZE_IN_BYTES) ; // by default, ids are set to null()
}
virtual ~t_RsGenericIdType() {}
// Explicit constructor from a hexadecimal string
//
explicit t_RsGenericIdType(const std::string& hex_string) ;
// Explicit constructor from a byte array. The array should have size at least ID_SIZE_IN_BYTES
//
explicit t_RsGenericIdType(const unsigned char bytes[]) ;
// Random initialization. Can be useful for testing.
//
static t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER> random()
{
t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER> id ;
for(uint32_t i=0;i<ID_SIZE_IN_BYTES;++i)
id.bytes[i] = RSRandom::random_u32() & 0xff ;
return id ;
}
// Converts to a std::string using cached value.
//
std::string toStdString(bool upper_case = true) const ;
const unsigned char *toByteArray() const { return &bytes[0] ; }
static const uint32_t SIZE_IN_BYTES = ID_SIZE_IN_BYTES ;
inline bool operator==(const t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER>& fp) const { return !memcmp(bytes,fp.bytes,ID_SIZE_IN_BYTES) ; }
inline bool operator!=(const t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER>& fp) const { return !!memcmp(bytes,fp.bytes,ID_SIZE_IN_BYTES); }
inline bool operator< (const t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER>& fp) const { return (memcmp(bytes,fp.bytes,ID_SIZE_IN_BYTES) < 0) ; }
inline bool isNull() const
{
for(int i=0;i<SIZE_IN_BYTES;++i)
if(bytes[i] != 0)
return false ;
return true ;
}
private:
unsigned char bytes[ID_SIZE_IN_BYTES] ;
};
template<uint32_t ID_SIZE_IN_BYTES,uint32_t UNIQUE_IDENTIFIER> std::string t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER>::toStdString(bool upper_case) const
{
static const char outh[16] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' } ;
static const char outl[16] = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' } ;
std::string res(ID_SIZE_IN_BYTES*2,' ') ;
for(uint32_t j = 0; j < ID_SIZE_IN_BYTES; j++)
if(upper_case)
{
res[2*j ] = outh[ (bytes[j]>>4) ] ;
res[2*j+1] = outh[ bytes[j] & 0xf ] ;
}
else
{
res[2*j ] = outl[ (bytes[j]>>4) ] ;
res[2*j+1] = outl[ bytes[j] & 0xf ] ;
}
return res ;
}
template<uint32_t ID_SIZE_IN_BYTES,uint32_t UNIQUE_IDENTIFIER> t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER>::t_RsGenericIdType(const std::string& s)
{
int n=0;
if(s.length() != ID_SIZE_IN_BYTES*2)
throw std::runtime_error("t_RsGenericIdType<>::t_RsGenericIdType(std::string&): supplied string in constructor has wrong size.") ;
for(uint32_t i = 0; i < ID_SIZE_IN_BYTES; ++i)
{
bytes[i] = 0 ;
for(int k=0;k<2;++k)
{
char b = s[n++] ;
if(b >= 'A' && b <= 'F')
bytes[i] += (b-'A'+10) << 4*(1-k) ;
else if(b >= 'a' && b <= 'f')
bytes[i] += (b-'a'+10) << 4*(1-k) ;
else if(b >= '0' && b <= '9')
bytes[i] += (b-'0') << 4*(1-k) ;
else
throw std::runtime_error("t_RsGenericIdType<>::t_RsGenericIdType(std::string&): supplied string is not purely hexadecimal") ;
}
}
}
template<uint32_t ID_SIZE_IN_BYTES,uint32_t UNIQUE_IDENTIFIER> t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER>::t_RsGenericIdType(const unsigned char *mem)
{
memcpy(bytes,mem,ID_SIZE_IN_BYTES) ;
}
static const int SSL_ID_SIZE = 16 ;
static const int PGP_KEY_ID_SIZE = 8 ;
static const int PGP_KEY_FINGERPRINT_SIZE = 20 ;
static const int SHA1_SIZE = 20 ;
// These constants are random, but should be different, in order to make the various IDs incompatible with each other.
//
static const uint32_t RS_GENERIC_ID_SSL_ID_TYPE = 0x038439ff ;
static const uint32_t RS_GENERIC_ID_PGP_ID_TYPE = 0x80339f4f ;
static const uint32_t RS_GENERIC_ID_SHA1_ID_TYPE = 0x9540284e ;
static const uint32_t RS_GENERIC_ID_PGP_FINGERPRINT_TYPE = 0x102943e3 ;
typedef t_RsGenericIdType< SSL_ID_SIZE , RS_GENERIC_ID_SSL_ID_TYPE> SSLIdType ;
typedef t_RsGenericIdType< PGP_KEY_ID_SIZE , RS_GENERIC_ID_PGP_ID_TYPE> PGPIdType;
typedef t_RsGenericIdType< SHA1_SIZE , RS_GENERIC_ID_SHA1_ID_TYPE> Sha1CheckSum ;
typedef t_RsGenericIdType< PGP_KEY_FINGERPRINT_SIZE, RS_GENERIC_ID_PGP_FINGERPRINT_TYPE> PGPFingerprintType ;
//#include <stdexcept>
//#include <string>
//#include <string.h>
//#include <stdint.h>
//#include <util/rsrandom.h>
//
//template<uint32_t ID_SIZE_IN_BYTES,uint32_t UNIQUE_IDENTIFIER> class t_RsGenericIdType
//{
// public:
// t_RsGenericIdType()
// {
// memset(bytes,0,ID_SIZE_IN_BYTES) ; // by default, ids are set to null()
// }
// virtual ~t_RsGenericIdType() {}
//
// // Explicit constructor from a hexadecimal string
// //
// explicit t_RsGenericIdType(const std::string& hex_string) ;
//
// // Explicit constructor from a byte array. The array should have size at least ID_SIZE_IN_BYTES
// //
// explicit t_RsGenericIdType(const unsigned char bytes[]) ;
//
// // Random initialization. Can be useful for testing.
// //
// static t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER> random()
// {
// t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER> id ;
//
// for(uint32_t i=0;i<ID_SIZE_IN_BYTES;++i)
// id.bytes[i] = RSRandom::random_u32() & 0xff ;
//
// return id ;
// }
//
// // Converts to a std::string using cached value.
// //
// std::string toStdString(bool upper_case = true) const ;
// const unsigned char *toByteArray() const { return &bytes[0] ; }
// static const uint32_t SIZE_IN_BYTES = ID_SIZE_IN_BYTES ;
//
// inline bool operator==(const t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER>& fp) const { return !memcmp(bytes,fp.bytes,ID_SIZE_IN_BYTES) ; }
// inline bool operator!=(const t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER>& fp) const { return !!memcmp(bytes,fp.bytes,ID_SIZE_IN_BYTES); }
// inline bool operator< (const t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER>& fp) const { return (memcmp(bytes,fp.bytes,ID_SIZE_IN_BYTES) < 0) ; }
//
// inline bool isNull() const
// {
// for(int i=0;i<SIZE_IN_BYTES;++i)
// if(bytes[i] != 0)
// return false ;
// return true ;
// }
// private:
// unsigned char bytes[ID_SIZE_IN_BYTES] ;
//};
//
//template<uint32_t ID_SIZE_IN_BYTES,uint32_t UNIQUE_IDENTIFIER> std::string t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER>::toStdString(bool upper_case) const
//{
// static const char outh[16] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' } ;
// static const char outl[16] = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' } ;
//
// std::string res(ID_SIZE_IN_BYTES*2,' ') ;
//
// for(uint32_t j = 0; j < ID_SIZE_IN_BYTES; j++)
// if(upper_case)
// {
// res[2*j ] = outh[ (bytes[j]>>4) ] ;
// res[2*j+1] = outh[ bytes[j] & 0xf ] ;
// }
// else
// {
// res[2*j ] = outl[ (bytes[j]>>4) ] ;
// res[2*j+1] = outl[ bytes[j] & 0xf ] ;
// }
//
// return res ;
//}
//
//template<uint32_t ID_SIZE_IN_BYTES,uint32_t UNIQUE_IDENTIFIER> t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER>::t_RsGenericIdType(const std::string& s)
//{
// int n=0;
// if(s.length() != ID_SIZE_IN_BYTES*2)
// throw std::runtime_error("t_RsGenericIdType<>::t_RsGenericIdType(std::string&): supplied string in constructor has wrong size.") ;
//
// for(uint32_t i = 0; i < ID_SIZE_IN_BYTES; ++i)
// {
// bytes[i] = 0 ;
//
// for(int k=0;k<2;++k)
// {
// char b = s[n++] ;
//
// if(b >= 'A' && b <= 'F')
// bytes[i] += (b-'A'+10) << 4*(1-k) ;
// else if(b >= 'a' && b <= 'f')
// bytes[i] += (b-'a'+10) << 4*(1-k) ;
// else if(b >= '0' && b <= '9')
// bytes[i] += (b-'0') << 4*(1-k) ;
// else
// throw std::runtime_error("t_RsGenericIdType<>::t_RsGenericIdType(std::string&): supplied string is not purely hexadecimal") ;
// }
// }
//}
//
//template<uint32_t ID_SIZE_IN_BYTES,uint32_t UNIQUE_IDENTIFIER> t_RsGenericIdType<ID_SIZE_IN_BYTES,UNIQUE_IDENTIFIER>::t_RsGenericIdType(const unsigned char *mem)
//{
// memcpy(bytes,mem,ID_SIZE_IN_BYTES) ;
//}
//
//static const int SSL_ID_SIZE = 16 ;
//static const int PGP_KEY_ID_SIZE = 8 ;
//static const int PGP_KEY_FINGERPRINT_SIZE = 20 ;
//static const int SHA1_SIZE = 20 ;
//
//// These constants are random, but should be different, in order to make the various IDs incompatible with each other.
////
//static const uint32_t RS_GENERIC_ID_SSL_ID_TYPE = 0x038439ff ;
//static const uint32_t RS_GENERIC_ID_PGP_ID_TYPE = 0x80339f4f ;
//static const uint32_t RS_GENERIC_ID_SHA1_ID_TYPE = 0x9540284e ;
//static const uint32_t RS_GENERIC_ID_PGP_FINGERPRINT_TYPE = 0x102943e3 ;
//
//typedef t_RsGenericIdType< SSL_ID_SIZE , RS_GENERIC_ID_SSL_ID_TYPE> SSLIdType ;
//typedef t_RsGenericIdType< PGP_KEY_ID_SIZE , RS_GENERIC_ID_PGP_ID_TYPE> PGPIdType;
//typedef t_RsGenericIdType< SHA1_SIZE , RS_GENERIC_ID_SHA1_ID_TYPE> Sha1CheckSum ;
//typedef t_RsGenericIdType< PGP_KEY_FINGERPRINT_SIZE, RS_GENERIC_ID_PGP_FINGERPRINT_TYPE> PGPFingerprintType ;