Merge pull request #1342 from sehraf/pr_add-TLSv1.3

simplify TLS cipher display
This commit is contained in:
csoler 2018-09-15 14:42:17 +02:00 committed by GitHub
commit 0917dc2538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 3 additions and 43 deletions

View File

@ -1195,14 +1195,7 @@ void PeersHandler::handleGetNodeOptions(Request& req, Response& resp)
std::string encryption;
RsPeerCryptoParams cdet;
if(RsControl::instance()->getPeerCryptoDetails(detail.id, cdet) && cdet.connexion_state != 0)
{
encryption = cdet.cipher_version;
encryption += ": ";
encryption += cdet.cipher_name;
if(cdet.cipher_version != "TLSv1.2")
encryption += cdet.cipher_bits_1;
}
encryption = cdet.cipher_name;
else
encryption = "Not connected";

View File

@ -604,9 +604,6 @@ bool pqiperson::getCryptoParams(RsPeerCryptoParams & params)
{
params.connexion_state = 0;
params.cipher_name.clear();
params.cipher_bits_1 = 0;
params.cipher_bits_2 = 0;
params.cipher_version.clear();
return false ;
}
@ -625,9 +622,6 @@ bool pqiconnect::getCryptoParams(RsPeerCryptoParams & params)
{
params.connexion_state = 0 ;
params.cipher_name.clear() ;
params.cipher_bits_1 = 0 ;
params.cipher_bits_2 = 0 ;
params.cipher_version.clear() ;
return false ;
}
}

View File

@ -304,30 +304,15 @@ void pqissl::getCryptoParams(RsPeerCryptoParams& params)
if(active)
{
params.connexion_state = 1 ;
params.cipher_name = std::string( SSL_get_cipher(ssl_connection));
int alg ;
int al2 = SSL_get_cipher_bits(ssl_connection,&alg);
params.cipher_bits_1 = alg ;
params.cipher_bits_2 = al2 ;
char *desc = SSL_CIPHER_description(SSL_get_current_cipher(ssl_connection), NULL, 0);
params.cipher_version =
std::string(desc).find("TLSv1.3") != std::string::npos ?
std::string("TLSv1.3") :
std::string(desc).find("TLSv1.2") != std::string::npos ?
std::string("TLSv1.2") :
std::string("TLSv1");
params.cipher_name = std::string(desc);
OPENSSL_free(desc);
}
else
{
params.connexion_state = 0 ;
params.cipher_name.clear() ;
params.cipher_bits_1 = 0 ;
params.cipher_bits_2 = 0 ;
params.cipher_version.clear() ;
}
}

View File

@ -333,9 +333,6 @@ struct RsPeerCryptoParams
{
int connexion_state;
std::string cipher_name;
int cipher_bits_1;
int cipher_bits_2;
std::string cipher_version;
};
struct RsGroupInfo : RsSerializable

View File

@ -165,16 +165,7 @@ void ConfCertDialog::load()
RsPeerCryptoParams cdet ;
if(RsControl::instance()->getPeerCryptoDetails(detail.id,cdet) && cdet.connexion_state!=0)
{
QString ct ;
ct += QString::fromStdString(cdet.cipher_version) + ": ";
ct += QString::fromStdString(cdet.cipher_name);
if(cdet.cipher_version != "TLSv1.2" && cdet.cipher_version != "TLSv1.3")
ct += QString::number(cdet.cipher_bits_1);
ui.crypto_info->setText(ct) ;
}
ui.crypto_info->setText(QString::fromStdString(cdet.cipher_name));
else
ui.crypto_info->setText(tr("Not connected")) ;