fixed additional GPG->Pgp names

This commit is contained in:
csoler 2021-10-29 20:29:18 +02:00
parent 7672ffa0ec
commit 7821b29893
15 changed files with 35 additions and 35 deletions

View File

@ -1098,7 +1098,7 @@ void p3discovery2::recvPGPCertificate(const RsPeerId& fromId, RsDiscPgpKeyItem*
std::string cert_name; std::string cert_name;
std::list<RsPgpId> cert_signers; std::list<RsPgpId> cert_signers;
if(!AuthPGP::getGPGDetailsFromBinaryBlock( (unsigned char*)item->bin_data,item->bin_len, cert_pgp_id, cert_name, cert_signers )) if(!AuthPGP::getPgpDetailsFromBinaryBlock( (unsigned char*)item->bin_data,item->bin_len, cert_pgp_id, cert_name, cert_signers ))
{ {
std::cerr << "(EE) cannot parse own PGP key sent by " << fromId << std::endl; std::cerr << "(EE) cannot parse own PGP key sent by " << fromId << std::endl;
return; return;

View File

@ -4688,7 +4688,7 @@ bool RsGxsNetService::checkPermissionsForFriendGroup(const RsPeerId& sslId,const
if(!grpMeta.mInternalCircle.isNull()) if(!grpMeta.mInternalCircle.isNull())
{ {
RsGroupInfo ginfo ; RsGroupInfo ginfo ;
RsPgpId pgpId = mPgpUtils->getPGPId(sslId) ; RsPgpId pgpId = mPgpUtils->getPgpId(sslId) ;
#ifdef NXS_NET_DEBUG_4 #ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Group internal circle: " << grpMeta.mInternalCircle << ", We're owner. Sending to everyone in the group." << std::endl; GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Group internal circle: " << grpMeta.mInternalCircle << ", We're owner. Sending to everyone in the group." << std::endl;

View File

@ -223,7 +223,7 @@ bool GrpCircleVetting::canSend(
{ {
if(mCircles->isLoaded(circleId)) if(mCircles->isLoaded(circleId))
{ {
const RsPgpId& pgpId = mPgpUtils->getPGPId(peerId); const RsPgpId& pgpId = mPgpUtils->getPgpId(peerId);
return mCircles->canSend(circleId, pgpId,should_encrypt); return mCircles->canSend(circleId, pgpId,should_encrypt);
} }
@ -302,7 +302,7 @@ bool MsgCircleIdsRequestVetting::cleared()
if(filtered_out_msgs>0) if(filtered_out_msgs>0)
std::cerr << "(WW) " << filtered_out_msgs << " messages not sent because they are signed by author(s) not member of that circle " << mCircleId << std::endl; std::cerr << "(WW) " << filtered_out_msgs << " messages not sent because they are signed by author(s) not member of that circle " << mCircleId << std::endl;
RsPgpId pgpId = mPgpUtils->getPGPId(mPeerId); RsPgpId pgpId = mPgpUtils->getPgpId(mPeerId);
bool can_send_res = mCircles->canSend(mCircleId, pgpId,mShouldEncrypt); bool can_send_res = mCircles->canSend(mCircleId, pgpId,mShouldEncrypt);
if(mShouldEncrypt) // that means the circle is external if(mShouldEncrypt) // that means the circle is external

View File

@ -37,7 +37,7 @@ const RsPgpId& PgpAuxUtilsImpl::getPGPOwnId()
return AuthPGP::getPgpOwnId(); return AuthPGP::getPgpOwnId();
} }
RsPgpId PgpAuxUtilsImpl::getPGPId(const RsPeerId& sslid) RsPgpId PgpAuxUtilsImpl::getPgpId(const RsPeerId& sslid)
{ {
return rsPeers->getGPGId(sslid); return rsPeers->getGPGId(sslid);
} }
@ -57,7 +57,7 @@ bool PgpAuxUtilsImpl::VerifySignBin(const void *data,
return AuthPGP::VerifySignBin(data, len, sign, signlen, withfingerprint); return AuthPGP::VerifySignBin(data, len, sign, signlen, withfingerprint);
} }
bool PgpAuxUtilsImpl::getGPGAllList(std::list<RsPgpId> &ids) bool PgpAuxUtilsImpl::getPgpAllList(std::list<RsPgpId> &ids)
{ {
return AuthPGP::getPgpAllList(ids); return AuthPGP::getPgpAllList(ids);
} }

View File

@ -35,8 +35,8 @@ class PgpAuxUtils
virtual ~PgpAuxUtils(){} virtual ~PgpAuxUtils(){}
virtual const RsPgpId &getPGPOwnId() = 0; virtual const RsPgpId &getPGPOwnId() = 0;
virtual RsPgpId getPGPId(const RsPeerId& sslid) = 0; virtual RsPgpId getPgpId(const RsPeerId& sslid) = 0;
virtual bool getGPGAllList(std::list<RsPgpId> &ids) = 0; virtual bool getPgpAllList(std::list<RsPgpId> &ids) = 0;
virtual bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const = 0; virtual bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const = 0;
virtual bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const =0; virtual bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const =0;
@ -49,12 +49,12 @@ public:
PgpAuxUtilsImpl(); PgpAuxUtilsImpl();
virtual const RsPgpId &getPGPOwnId(); virtual const RsPgpId &getPGPOwnId();
virtual RsPgpId getPGPId(const RsPeerId& sslid); virtual RsPgpId getPgpId(const RsPeerId& sslid);
virtual bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const ; virtual bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const ;
virtual bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const; virtual bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const;
virtual bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint); virtual bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint);
virtual bool getGPGAllList(std::list<RsPgpId> &ids); virtual bool getPgpAllList(std::list<RsPgpId> &ids);
}; };

View File

@ -54,11 +54,11 @@ void cleanupZombies(int numkill); // function to cleanup zombies under OSX.
/* Function to sign X509_REQ via GPGme. */ /* Function to sign X509_REQ via GPGme. */
int AuthPGP::availableGPGCertificatesWithPrivateKeys(std::list<RsPgpId>& pgpIds) int AuthPGP::availablePgpCertificatesWithPrivateKeys(std::list<RsPgpId>& pgpIds)
{ {
return instance()->mPgpHandler->availableGPGCertificatesWithPrivateKeys(pgpIds); return instance()->mPgpHandler->availableGPGCertificatesWithPrivateKeys(pgpIds);
} }
bool AuthPGP::getGPGDetailsFromBinaryBlock(const unsigned char *mem,size_t mem_size,RsPgpId& key_id, std::string& name, std::list<RsPgpId>& signers) bool AuthPGP::getPgpDetailsFromBinaryBlock(const unsigned char *mem,size_t mem_size,RsPgpId& key_id, std::string& name, std::list<RsPgpId>& signers)
{ {
return instance()->mPgpHandler->getGPGDetailsFromBinaryBlock(mem,mem_size,key_id,name,signers); return instance()->mPgpHandler->getGPGDetailsFromBinaryBlock(mem,mem_size,key_id,name,signers);
} }
@ -178,7 +178,7 @@ AuthPGP::AuthPGP(const std::string& path_to_public_keyring,const std::string& pa
* This function must be called successfully (return == 1) * This function must be called successfully (return == 1)
* before anything else can be done. (except above fn). * before anything else can be done. (except above fn).
*/ */
int AuthPGP::GPGInit(const RsPgpId &ownId) int AuthPGP::PgpInit(const RsPgpId &ownId)
{ {
#ifdef DEBUG_AUTHGPG #ifdef DEBUG_AUTHGPG
std::cerr << "AuthGPG::GPGInit() called with own gpg id : " << ownId.toStdString() << std::endl; std::cerr << "AuthGPG::GPGInit() called with own gpg id : " << ownId.toStdString() << std::endl;
@ -365,7 +365,7 @@ bool AuthPGP::active()
return instance()->gpgKeySelected; return instance()->gpgKeySelected;
} }
bool AuthPGP::GeneratePGPCertificate(const std::string& name, const std::string& email, const std::string& passwd, RsPgpId& pgpId, const int keynumbits, std::string& errString) bool AuthPGP::GeneratePgpCertificate(const std::string& name, const std::string& email, const std::string& passwd, RsPgpId& pgpId, const int keynumbits, std::string& errString)
{ {
RsStackMutex stack(instance()->gpgMtxEngine); /******* LOCKED ******/ RsStackMutex stack(instance()->gpgMtxEngine); /******* LOCKED ******/

View File

@ -129,11 +129,11 @@ public:
/* Init by generating new Own PGP Cert, or selecting existing PGP Cert */ /* Init by generating new Own PGP Cert, or selecting existing PGP Cert */
static int GPGInit(const RsPgpId &ownId); static int PgpInit(const RsPgpId &ownId);
static bool GeneratePGPCertificate(const std::string& name, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString); static bool GeneratePgpCertificate(const std::string& name, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString);
static bool getGPGDetailsFromBinaryBlock(const unsigned char *mem,size_t mem_size,RsPgpId& key_id, std::string& name, std::list<RsPgpId>& signers) ; static bool getPgpDetailsFromBinaryBlock(const unsigned char *mem,size_t mem_size,RsPgpId& key_id, std::string& name, std::list<RsPgpId>& signers) ;
static int availableGPGCertificatesWithPrivateKeys(std::list<RsPgpId>& pgpIds); static int availablePgpCertificatesWithPrivateKeys(std::list<RsPgpId>& pgpIds);
/*********************************************************************************/ /*********************************************************************************/
/************************* STAGE 3 ***********************************************/ /************************* STAGE 3 ***********************************************/

View File

@ -1670,7 +1670,7 @@ bool p3Peers::loadDetailsFromStringCert( const std::string &certstr,
RsCertificate& cert = *certPtr; RsCertificate& cert = *certPtr;
if(!AuthPGP::getGPGDetailsFromBinaryBlock( cert.pgp_key(), cert.pgp_key_size(), pd.gpg_id, pd.name, pd.gpgSigners )) if(!AuthPGP::getPgpDetailsFromBinaryBlock( cert.pgp_key(), cert.pgp_key_size(), pd.gpg_id, pd.name, pd.gpgSigners ))
return false; return false;
Dbg4() << __PRETTY_FUNCTION__ << " Parsing cert for sslid, location, ext " Dbg4() << __PRETTY_FUNCTION__ << " Parsing cert for sslid, location, ext "

View File

@ -853,7 +853,7 @@ static bool checkAccount(const std::string &accountdir, AccountDetails &account,
/* Generating GPGme Account */ /* Generating GPGme Account */
int RsAccountsDetail::GetPGPLogins(std::list<RsPgpId>& pgpIds) int RsAccountsDetail::GetPGPLogins(std::list<RsPgpId>& pgpIds)
{ {
AuthPGP::availableGPGCertificatesWithPrivateKeys(pgpIds); AuthPGP::availablePgpCertificatesWithPrivateKeys(pgpIds);
return 1; return 1;
} }
@ -887,7 +887,7 @@ bool RsAccountsDetail::SelectPGPAccount(const RsPgpId& pgpId)
{ {
bool retVal = false; bool retVal = false;
if (0 < AuthPGP::GPGInit(pgpId)) if (0 < AuthPGP::PgpInit(pgpId))
{ {
retVal = true; retVal = true;
#ifdef DEBUG_ACCOUNTS #ifdef DEBUG_ACCOUNTS
@ -907,7 +907,7 @@ bool RsAccountsDetail::SelectPGPAccount(const RsPgpId& pgpId)
bool RsAccountsDetail::GeneratePGPCertificate(const std::string& name, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString) bool RsAccountsDetail::GeneratePGPCertificate(const std::string& name, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString)
{ {
return AuthPGP::GeneratePGPCertificate(name, email, passwd, pgpId, keynumbits, errString); return AuthPGP::GeneratePgpCertificate(name, email, passwd, pgpId, keynumbits, errString);
} }
// PGP Support Functions. // PGP Support Functions.

View File

@ -510,7 +510,7 @@ RsInit::LoadCertificateStatus RsInit::LockAndLoadCertificates(
if(!RsAccounts::GetAccountDetails(accountId, pgpId, pgpName, pgpEmail, location)) if(!RsAccounts::GetAccountDetails(accountId, pgpId, pgpName, pgpEmail, location))
throw RsInit::ERR_UNKNOWN; // invalid PreferredAccount; throw RsInit::ERR_UNKNOWN; // invalid PreferredAccount;
if(0 == AuthPGP::GPGInit(pgpId)) if(0 == AuthPGP::PgpInit(pgpId))
throw RsInit::ERR_UNKNOWN; // PGP Error. throw RsInit::ERR_UNKNOWN; // PGP Error.
LoadCertificateStatus retVal = LoadCertificateStatus retVal =

View File

@ -4096,7 +4096,7 @@ void p3IdService::getPgpIdList()
#endif // DEBUG_IDS #endif // DEBUG_IDS
std::list<RsPgpId> list; std::list<RsPgpId> list;
mPgpUtils->getGPGAllList(list); mPgpUtils->getPgpAllList(list);
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
@ -4593,7 +4593,7 @@ void p3IdService::generateDummy_FriendPGP()
// Now Generate for friends. // Now Generate for friends.
std::list<RsPgpId> gpgids; std::list<RsPgpId> gpgids;
std::list<RsPgpId>::const_iterator it; std::list<RsPgpId>::const_iterator it;
mPgpUtils->getGPGAllList(gpgids); mPgpUtils->getPgpAllList(gpgids);
RsGxsIdGroup id; RsGxsIdGroup id;

View File

@ -134,11 +134,11 @@ const RsPgpId& rs_nxs_test::RsDummyPgpUtils::getPGPOwnId() {
return mOwnId; return mOwnId;
} }
RsPgpId rs_nxs_test::RsDummyPgpUtils::getPGPId(const RsPeerId& /*sslid*/) { RsPgpId rs_nxs_test::RsDummyPgpUtils::getPgpId(const RsPeerId& /*sslid*/) {
return RsPgpId().random(); return RsPgpId().random();
} }
bool rs_nxs_test::RsDummyPgpUtils::getGPGAllList(std::list<RsPgpId>& /*ids*/) { bool rs_nxs_test::RsDummyPgpUtils::getPgpAllList(std::list<RsPgpId>& /*ids*/) {
return true; return true;
} }

View File

@ -164,8 +164,8 @@ namespace rs_nxs_test
virtual ~RsDummyPgpUtils(){} virtual ~RsDummyPgpUtils(){}
const RsPgpId &getPGPOwnId() ; const RsPgpId &getPGPOwnId() ;
RsPgpId getPGPId(const RsPeerId& sslid) ; RsPgpId getPgpId(const RsPeerId& sslid) ;
bool getGPGAllList(std::list<RsPgpId> &ids) ; bool getPgpAllList(std::list<RsPgpId> &ids) ;
bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const; bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const;
bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const; bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const;

View File

@ -24,7 +24,7 @@
FakePgpAuxUtils::FakePgpAuxUtils(const RsPeerId& ownId) FakePgpAuxUtils::FakePgpAuxUtils(const RsPeerId& ownId)
{ {
mOwnId = getPGPId(ownId); mOwnId = getPgpId(ownId);
addPeerIdToPgpList(ownId); addPeerIdToPgpList(ownId);
} }
@ -39,7 +39,7 @@ void FakePgpAuxUtils::addPeerListToPgpList(const std::list<RsPeerId> &ids)
void FakePgpAuxUtils::addPeerIdToPgpList(const RsPeerId &id) void FakePgpAuxUtils::addPeerIdToPgpList(const RsPeerId &id)
{ {
RsPgpId pgpId = getPGPId(id); RsPgpId pgpId = getPgpId(id);
if (mPgpList.end() == std::find(mPgpList.begin(), mPgpList.end(), pgpId)) if (mPgpList.end() == std::find(mPgpList.begin(), mPgpList.end(), pgpId))
{ {
mPgpList.push_back(pgpId); mPgpList.push_back(pgpId);
@ -51,7 +51,7 @@ const RsPgpId & FakePgpAuxUtils::getPGPOwnId()
return mOwnId; return mOwnId;
} }
RsPgpId FakePgpAuxUtils::getPGPId(const RsPeerId& sslid) RsPgpId FakePgpAuxUtils::getPgpId(const RsPeerId& sslid)
{ {
/* convert an sslId */ /* convert an sslId */
std::string idstring = sslid.toStdString(); std::string idstring = sslid.toStdString();
@ -95,7 +95,7 @@ bool FakePgpAuxUtils::VerifySignBin(const void* /*data*/, uint32_t /*len*/, unsi
return true; return true;
} }
bool FakePgpAuxUtils::getGPGAllList(std::list<RsPgpId> &ids) bool FakePgpAuxUtils::getPgpAllList(std::list<RsPgpId> &ids)
{ {
ids = mPgpList; ids = mPgpList;
return true; return true;

View File

@ -28,7 +28,7 @@ public:
FakePgpAuxUtils(const RsPeerId& ownId); FakePgpAuxUtils(const RsPeerId& ownId);
virtual const RsPgpId &getPGPOwnId(); virtual const RsPgpId &getPGPOwnId();
virtual RsPgpId getPGPId(const RsPeerId& sslid); virtual RsPgpId getPgpId(const RsPeerId& sslid);
virtual bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const; virtual bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const;
virtual bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const; virtual bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const;
@ -36,7 +36,7 @@ public:
virtual void addPeerListToPgpList(const std::list<RsPeerId> &ids); virtual void addPeerListToPgpList(const std::list<RsPeerId> &ids);
virtual void addPeerIdToPgpList(const RsPeerId &id); virtual void addPeerIdToPgpList(const RsPeerId &id);
virtual bool getGPGAllList(std::list<RsPgpId> &ids); virtual bool getPgpAllList(std::list<RsPgpId> &ids);
private: private:
RsPgpId mOwnId; RsPgpId mOwnId;
std::list<RsPgpId> mPgpList; std::list<RsPgpId> mPgpList;