added check for DSA/RSA key algorithm. Disabled make friend, login and cert creation, with unsupported keys

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5221 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-06-14 20:13:31 +00:00
parent 36bec260b9
commit dba66cdd7a
9 changed files with 65 additions and 30 deletions

View file

@ -183,6 +183,9 @@ void PGPHandler::initCertificateInfo(PGPCertificateInfo& cert,const ops_keydata_
ops_fingerprint(&f,&keydata->key.pkey) ;
cert._fpr = PGPFingerprintType(f.fingerprint) ;
if(keydata->key.pkey.algorithm != OPS_PKA_RSA)
cert._flags |= PGPCertificateInfo::PGP_CERTIFICATE_FLAG_UNSUPPORTED_ALGORITHM ;
}
void PGPHandler::validateAndUpdateSignatures(PGPCertificateInfo& cert,const ops_keydata_t *keydata)
@ -224,7 +227,7 @@ bool PGPHandler::printKeys() const
std::cerr << "\tName : " << it->second._name << std::endl;
std::cerr << "\tEmail : " << it->second._email << std::endl;
std::cerr << "\tOwnSign : " << (it->second._flags & PGPCertificateInfo::PGP_CERTIFICATE_FLAG_HAS_OWN_SIGNATURE) << std::endl;
std::cerr << "\tAccept Connect: " << (it->second._flags & PGPCertificateInfo::PGP_CERTIFICATE_FLAG_HAS_OWN_SIGNATURE) << std::endl;
std::cerr << "\tAccept Connect: " << (it->second._flags & PGPCertificateInfo::PGP_CERTIFICATE_FLAG_ACCEPT_CONNEXION) << std::endl;
std::cerr << "\ttrustLvl : " << it->second._trustLvl << std::endl;
std::cerr << "\tvalidLvl : " << it->second._validLvl << std::endl;
std::cerr << "\tfingerprint : " << it->second._fpr.toStdString() << std::endl;
@ -271,7 +274,10 @@ bool PGPHandler::availableGPGCertificatesWithPrivateKeys(std::list<PGPIdType>& i
// check that the key is in the pubring as well
if(ops_keyring_find_key_by_id(_pubring,keydata->key_id) != NULL)
ids.push_back(PGPIdType(keydata->key_id)) ;
if(keydata->key.pkey.algorithm == OPS_PKA_RSA)
ids.push_back(PGPIdType(keydata->key_id)) ;
else
std::cerr << "Skipping keypair " << PGPIdType(keydata->key_id).toStdString() << ", unsupported algorithm: " << keydata->key.pkey.algorithm << std::endl;
}
return true ;

View file

@ -44,9 +44,10 @@ class PGPCertificateInfo
uint32_t _key_index ; // index to array of keys in the public keyring
static const uint32_t PGP_CERTIFICATE_FLAG_ACCEPT_CONNEXION = 0x0001 ;
static const uint32_t PGP_CERTIFICATE_FLAG_HAS_OWN_SIGNATURE = 0x0002 ;
static const uint32_t PGP_CERTIFICATE_FLAG_HAS_SIGNED_ME = 0x0004 ;
static const uint32_t PGP_CERTIFICATE_FLAG_ACCEPT_CONNEXION = 0x0001 ;
static const uint32_t PGP_CERTIFICATE_FLAG_HAS_OWN_SIGNATURE = 0x0002 ;
static const uint32_t PGP_CERTIFICATE_FLAG_HAS_SIGNED_ME = 0x0004 ;
static const uint32_t PGP_CERTIFICATE_FLAG_UNSUPPORTED_ALGORITHM = 0x0008 ; // set when the key is not RSA, so that RS avoids to use it.
};
class PGPHandler
@ -78,6 +79,8 @@ class PGPHandler
bool getKeyFingerprint(const PGPIdType& id,PGPFingerprintType& fp) const ;
void setAcceptConnexion(const PGPIdType&,bool) ;
bool isKeySupported(const PGPIdType& id) const ;
// Write keyring
bool publicKeyringChanged() const { return _pubring_changed ; }
bool secretKeyringChanged() const { return _secring_changed ; }