mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-24 14:23:36 -05:00
first working version !
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5123 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
afc23f39c8
commit
42687f32aa
@ -691,10 +691,7 @@ bool PGPHandler::VerifySignBin(const void *literal_data, uint32_t literal_data_l
|
||||
return false ;
|
||||
}
|
||||
|
||||
std::cerr << "Verifying signature from fingerprint " << key_fingerprint.toStdString() << std::endl;
|
||||
|
||||
std::cerr << "Verifying signature of length " << std::dec << sign_len << ", literal_length = " << literal_data_length << std::endl;
|
||||
std::cerr << "Data: " << (char *)sign << std::endl;
|
||||
std::cerr << "Verifying signature from fingerprint " << key_fingerprint.toStdString() << ", length " << std::dec << sign_len << ", literal data length = " << literal_data_length << std::endl;
|
||||
|
||||
return ops_validate_detached_signature(literal_data,literal_data_length,sign,sign_len,key) ;
|
||||
}
|
||||
@ -735,6 +732,6 @@ bool PGPHandler::isGPGSigned(const std::string &id)
|
||||
bool PGPHandler::isGPGAccepted(const std::string &id)
|
||||
{
|
||||
std::map<std::string,PGPCertificateInfo>::const_iterator res = _public_keyring_map.find(id) ;
|
||||
return (res != _public_keyring_map.end()) && (res->second._flags & PGPCertificateInfo::PGP_CERTIFICATE_FLAG_HAS_OWN_SIGNATURE) ;
|
||||
return (res != _public_keyring_map.end()) && (res->second._flags & PGPCertificateInfo::PGP_CERTIFICATE_FLAG_ACCEPT_CONNEXION) ;
|
||||
}
|
||||
|
||||
|
@ -585,6 +585,12 @@ bool AuthGPG::DoOwnSignature(const void *data, unsigned int datalen, void *buf_s
|
||||
/* import to GnuPG and other Certificates */
|
||||
bool AuthGPG::VerifySignature(const void *data, int datalen, const void *sig, unsigned int siglen, const std::string &withfingerprint)
|
||||
{
|
||||
if(withfingerprint.length() != 40)
|
||||
{
|
||||
std::cerr << "WARNING: Still need to implement signature verification from complete keyring." << std::endl;
|
||||
return false ;
|
||||
}
|
||||
|
||||
return PGPHandler::VerifySignBin((unsigned char*)data,datalen,(unsigned char*)sig,siglen,PGPFingerprintType::fromFingerprint_hex(withfingerprint)) ;
|
||||
}
|
||||
|
||||
@ -614,6 +620,11 @@ bool AuthGPG::GeneratePGPCertificate(const std::string& name,
|
||||
/**** These Two are common */
|
||||
std::string AuthGPG::getGPGName(const std::string &id)
|
||||
{
|
||||
if(id.length() != 16)
|
||||
{
|
||||
std::cerr << "Wrong string passed to getGPGDetails: \"" << id << "\"" << std::endl;
|
||||
return std::string() ;
|
||||
}
|
||||
RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
|
||||
|
||||
const PGPCertificateInfo *info = PGPHandler::getCertificateInfo(PGPIdType::fromUserId_hex(id)) ;
|
||||
@ -646,7 +657,6 @@ std::string AuthGPG::getGPGOwnId()
|
||||
|
||||
std::string AuthGPG::getGPGOwnName()
|
||||
{
|
||||
RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
|
||||
return getGPGName(mOwnGpgId.toStdString()) ;
|
||||
}
|
||||
|
||||
@ -707,6 +717,12 @@ bool AuthGPG::getGPGDetails(const std::string& id, RsPeerDetails &d)
|
||||
{
|
||||
RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
|
||||
|
||||
if(id.length() != 16)
|
||||
{
|
||||
std::cerr << "Wrong string passed to getGPGDetails: \"" << id << "\"" << std::endl;
|
||||
return false ;
|
||||
}
|
||||
|
||||
const PGPCertificateInfo *pc = PGPHandler::getCertificateInfo(PGPIdType::fromUserId_hex(id)) ;
|
||||
|
||||
if(pc == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user