improved testing code for PGP handler, and added RSA/DSA flags to certificates.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5371 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-08-02 12:14:50 +00:00
parent fe95818384
commit afe62dad28
3 changed files with 219 additions and 84 deletions

View file

@ -188,13 +188,22 @@ void PGPHandler::initCertificateInfo(PGPCertificateInfo& cert,const ops_keydata_
cert._key_index = index ;
cert._flags = 0 ;
switch(keydata->key.pkey.algorithm)
{
case OPS_PKA_RSA: cert._type = PGPCertificateInfo::PGP_CERTIFICATE_TYPE_RSA ;
break ;
case OPS_PKA_DSA: cert._type = PGPCertificateInfo::PGP_CERTIFICATE_TYPE_DSA ;
cert._flags |= PGPCertificateInfo::PGP_CERTIFICATE_FLAG_UNSUPPORTED_ALGORITHM ;
break ;
default: cert._type = PGPCertificateInfo::PGP_CERTIFICATE_TYPE_UNKNOWN ;
cert._flags |= PGPCertificateInfo::PGP_CERTIFICATE_FLAG_UNSUPPORTED_ALGORITHM ;
break ;
}
ops_fingerprint_t f ;
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 ;
}
bool PGPHandler::validateAndUpdateSignatures(PGPCertificateInfo& cert,const ops_keydata_t *keydata)

View file

@ -38,6 +38,7 @@ class PGPCertificateInfo
uint32_t _trustLvl;
uint32_t _validLvl;
uint32_t _flags ;
uint32_t _type ;
PGPFingerprintType _fpr; /* fingerprint */
PGPIdType _key_id ;
@ -54,6 +55,10 @@ class PGPCertificateInfo
static const uint8_t PGP_CERTIFICATE_TRUST_MARGINALLY = 0x03 ;
static const uint8_t PGP_CERTIFICATE_TRUST_FULLY = 0x04 ;
static const uint8_t PGP_CERTIFICATE_TRUST_ULTIMATE = 0x05 ;
static const uint8_t PGP_CERTIFICATE_TYPE_UNKNOWN = 0x00 ;
static const uint8_t PGP_CERTIFICATE_TYPE_DSA = 0x01 ;
static const uint8_t PGP_CERTIFICATE_TYPE_RSA = 0x02 ;
};
class PGPHandler