mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-24 14:23:36 -05:00
fixed signature verification
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5122 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0587216350
commit
afc23f39c8
@ -215,21 +215,24 @@ void PGPHandler::initCertificateInfo(PGPCertificateInfo& cert,const ops_keydata_
|
||||
while(i < namestring.length() && namestring[i] != ')' && namestring[i] != '>') { next += namestring[i] ; ++i ;}
|
||||
|
||||
while(i < namestring.length() && namestring[i] != '(' && namestring[i] != '<') { next += namestring[i] ; ++i ;}
|
||||
std::string& next2 = (namestring[i] == '(')?cert._comment:cert._email ;
|
||||
++i ;
|
||||
next2 = "" ;
|
||||
while(i < namestring.length() && namestring[i] != ')' && namestring[i] != '>') { next2 += namestring[i] ; ++i ;}
|
||||
|
||||
if(i< namestring.length())
|
||||
{
|
||||
std::string& next2 = (namestring[i] == '(')?cert._comment:cert._email ;
|
||||
++i ;
|
||||
next2 = "" ;
|
||||
while(i < namestring.length() && namestring[i] != ')' && namestring[i] != '>') { next2 += namestring[i] ; ++i ;}
|
||||
}
|
||||
}
|
||||
|
||||
cert._trustLvl = 1 ; // to be setup accordingly
|
||||
cert._key_index = index ;
|
||||
cert._flags = 0 ;
|
||||
|
||||
ops_fingerprint_t f ;
|
||||
ops_fingerprint(&f,&keydata->key.pkey) ;
|
||||
|
||||
cert._fpr = PGPFingerprintType(f.fingerprint) ;
|
||||
|
||||
std::cerr << __PRETTY_FUNCTION__ << ": unfinished!!" << std::endl;
|
||||
}
|
||||
|
||||
PGPHandler::~PGPHandler()
|
||||
@ -666,7 +669,7 @@ bool PGPHandler::getKeyFingerprint(const PGPIdType& id,PGPFingerprintType& fp) c
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool PGPHandler::VerifySignBin(const void *data, uint32_t data_len, unsigned char *sign, unsigned int sign_len, const PGPFingerprintType& key_fingerprint)
|
||||
bool PGPHandler::VerifySignBin(const void *literal_data, uint32_t literal_data_length, unsigned char *sign, unsigned int sign_len, const PGPFingerprintType& key_fingerprint)
|
||||
{
|
||||
PGPIdType id = PGPIdType::fromFingerprint_hex(key_fingerprint.toStdString()) ;
|
||||
const ops_keydata_t *key = getPublicKey(id) ;
|
||||
@ -689,14 +692,11 @@ bool PGPHandler::VerifySignBin(const void *data, uint32_t data_len, unsigned cha
|
||||
}
|
||||
|
||||
std::cerr << "Verifying signature from fingerprint " << key_fingerprint.toStdString() << std::endl;
|
||||
std::cerr << "Warning: signature code still unfinished!" << key_fingerprint.toStdString() << std::endl;
|
||||
|
||||
ops_signature_t signature ;
|
||||
// ops_signature_add_data(&signature,sign,sign_len) ;
|
||||
std::cerr << "Verifying signature of length " << std::dec << sign_len << ", literal_length = " << literal_data_length << std::endl;
|
||||
std::cerr << "Data: " << (char *)sign << std::endl;
|
||||
|
||||
// ops_boolean_t valid=check_binary_signature(data_len,data,signature,pkey) ;
|
||||
|
||||
return false ;
|
||||
return ops_validate_detached_signature(literal_data,literal_data_length,sign,sign_len,key) ;
|
||||
}
|
||||
|
||||
void PGPHandler::setAcceptConnexion(const PGPIdType& id,bool b)
|
||||
|
@ -98,5 +98,7 @@ ops_validate_key_cb(const ops_parser_content_t *content_,ops_parse_cb_info_t *cb
|
||||
|
||||
ops_boolean_t ops_validate_file(ops_validate_result_t* result, const char* filename, const int armoured, const ops_keyring_t* keyring);
|
||||
ops_boolean_t ops_validate_mem(ops_validate_result_t *result, ops_memory_t* mem, const int armoured, const ops_keyring_t* keyring);
|
||||
ops_boolean_t ops_validate_detached_signature(const void *literal_data, unsigned int literal_data_length, const unsigned char *signature_packet, unsigned int signature_packet_length,const ops_keydata_t *signers_key) ;
|
||||
|
||||
|
||||
// EOF
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user