Skip to content
Snippets Groups Projects
Commit d4ef85b8 authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee
Browse files

[ #37142 ] Add some security framework widgets

parent 2837c50a
Branches
Tags
No related merge requests found
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include "account.h" #include "account.h"
#include "visitors/pixmapmanipulationvisitor.h" #include "visitors/pixmapmanipulationvisitor.h"
#include <QtAlgorithms>
const QString SecurityValidationModel::messages[static_cast<const int>(SecurityFlaw::COUNT)] = { const QString SecurityValidationModel::messages[static_cast<const int>(SecurityFlaw::COUNT)] = {
QObject::tr("Your communication negotation is secured, but not the media stream, please enable ZRTP or SDES"), QObject::tr("Your communication negotation is secured, but not the media stream, please enable ZRTP or SDES"),
QObject::tr("TLS is disabled, the negotiation wont be encrypted. Your communication will be vulnerable to " QObject::tr("TLS is disabled, the negotiation wont be encrypted. Your communication will be vulnerable to "
...@@ -45,17 +47,17 @@ SecurityValidationModel::maximumSecurityLevel = {{ ...@@ -45,17 +47,17 @@ SecurityValidationModel::maximumSecurityLevel = {{
/* TLS_DISABLED */ SecurityLevel::WEAK , /* TLS_DISABLED */ SecurityLevel::WEAK ,
/* CERTIFICATE_EXPIRED */ SecurityLevel::MEDIUM , /* CERTIFICATE_EXPIRED */ SecurityLevel::MEDIUM ,
/* CERTIFICATE_SELF_SIGNED */ SecurityLevel::MEDIUM , /* CERTIFICATE_SELF_SIGNED */ SecurityLevel::MEDIUM ,
/* CA_CERTIFICATE_MISSING */ SecurityLevel::PARTIAL , /* CA_CERTIFICATE_MISSING */ SecurityLevel::MEDIUM ,
/* END_CERTIFICATE_MISSING */ SecurityLevel::PARTIAL , /* END_CERTIFICATE_MISSING */ SecurityLevel::MEDIUM ,
/* PRIVATE_KEY_MISSING */ SecurityLevel::PARTIAL , /* PRIVATE_KEY_MISSING */ SecurityLevel::MEDIUM ,
/* CERTIFICATE_MISMATCH */ SecurityLevel::NONE , /* CERTIFICATE_MISMATCH */ SecurityLevel::NONE ,
/* CERTIFICATE_STORAGE_PERMISSION */ SecurityLevel::ACCEPTABLE , /* CERTIFICATE_STORAGE_PERMISSION */ SecurityLevel::ACCEPTABLE ,
/* CERTIFICATE_STORAGE_FOLDER */ SecurityLevel::ACCEPTABLE , /* CERTIFICATE_STORAGE_FOLDER */ SecurityLevel::ACCEPTABLE ,
/* CERTIFICATE_STORAGE_LOCATION */ SecurityLevel::ACCEPTABLE , /* CERTIFICATE_STORAGE_LOCATION */ SecurityLevel::ACCEPTABLE ,
/* OUTGOING_SERVER_MISMATCH */ SecurityLevel::ACCEPTABLE , /* OUTGOING_SERVER_MISMATCH */ SecurityLevel::ACCEPTABLE ,
/* VERIFY_INCOMING_DISABLED */ SecurityLevel::PARTIAL , /* VERIFY_INCOMING_DISABLED */ SecurityLevel::MEDIUM ,
/* VERIFY_ANSWER_DISABLED */ SecurityLevel::PARTIAL , /* VERIFY_ANSWER_DISABLED */ SecurityLevel::MEDIUM ,
/* REQUIRE_CERTIFICATE_DISABLED */ SecurityLevel::PARTIAL , /* REQUIRE_CERTIFICATE_DISABLED */ SecurityLevel::MEDIUM ,
/* MISSING_CERTIFICATE */ SecurityLevel::NONE , /* MISSING_CERTIFICATE */ SecurityLevel::NONE ,
/* MISSING_AUTHORITY */ SecurityLevel::WEAK , /* MISSING_AUTHORITY */ SecurityLevel::WEAK ,
}}; }};
...@@ -181,8 +183,14 @@ void SecurityValidationModel::update() ...@@ -181,8 +183,14 @@ void SecurityValidationModel::update()
m_lCurrentFlaws << Flaw(SecurityFlaw::CERTIFICATE_STORAGE_LOCATION,cert->type()); m_lCurrentFlaws << Flaw(SecurityFlaw::CERTIFICATE_STORAGE_LOCATION,cert->type());
} }
} }
qSort(m_lCurrentFlaws);
emit layoutChanged(); emit layoutChanged();
} }
QList<SecurityValidationModel::Flaw> SecurityValidationModel::currentFlaws()
{
return m_lCurrentFlaws;
}
/**************************************************************************** /****************************************************************************
* Copyright (C) 2013-2014 by Savoir-Faire Linux *** * Copyright (C) 2013-2014 by Savoir-Faire Linux *
* Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> * * Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
...@@ -54,11 +54,10 @@ public: ...@@ -54,11 +54,10 @@ public:
enum class SecurityLevel { enum class SecurityLevel {
NONE = 0, /* Security is not functional or severely defective */ NONE = 0, /* Security is not functional or severely defective */
WEAK = 1, /* There is some security, but way too many flaws */ WEAK = 1, /* There is some security, but way too many flaws */
PARTIAL = 2, /* There is some security, but there is too many flaws */ MEDIUM = 2, /* The security is probably good enough, but there is issues */
MEDIUM = 3, /* The security is probably good enough, but there is issues */ ACCEPTABLE = 3, /* The security is most probably good enough, only minor issues */
ACCEPTABLE = 4, /* The security is most probably good enough, only minor issues */ STRONG = 4, /* All the non-information items are correct */
STRONG = 5, /* All the non-information items are correct */ COMPLETE = 5, /* Everything, even the recommendations, are correct */
VERY_STRONG = 6, /* Everything, even the recommendations, are correct */
}; };
///The severity of a given flaw ///The severity of a given flaw
...@@ -110,6 +109,12 @@ public: ...@@ -110,6 +109,12 @@ public:
SecurityFlaw flaw; SecurityFlaw flaw;
Severity severity; Severity severity;
Certificate::Type certType; Certificate::Type certType;
bool operator < ( const Flaw &r ) const{
return ( (int)severity > (int)r.severity );
}
bool operator > ( const Flaw &r ) const{
return ( (int)severity < (int)r.severity );
}
}; };
//Constructor //Constructor
...@@ -123,6 +128,9 @@ public: ...@@ -123,6 +128,9 @@ public:
Qt::ItemFlags flags ( const QModelIndex& index ) const; Qt::ItemFlags flags ( const QModelIndex& index ) const;
virtual bool setData ( const QModelIndex& index, const QVariant &value, int role) ; virtual bool setData ( const QModelIndex& index, const QVariant &value, int role) ;
//Getter
QList<Flaw> currentFlaws();
//Mutator //Mutator
void update(); void update();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment