Commit 229a8b4c authored by Jan Möbius's avatar Jan Möbius

Work on License Manager

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6650 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0d623de7
......@@ -227,24 +227,46 @@ bool LicenseManager::authenticate() {
std::cerr << "Core Hash : " << coreHash.toStdString() << std::endl;
std::cerr << "Plugin Hash : " << pluginHash.toStdString() << std::endl;
QString mac;
// Get all Network Interfaces
QList<QNetworkInterface> interfaces = QNetworkInterface::allInterfaces();
foreach ( QNetworkInterface interface, interfaces ) {
std::cerr << "Name : " << interface.name().toStdString() << std::endl;
std::cerr << "Found Interface : " << interface.hardwareAddress().toStdString() << std::endl;
mac = mac + interface.hardwareAddress().remove(":");
}
QString macHash = QCryptographicHash::hash ( mac.toAscii() , QCryptographicHash::Sha1 ).toHex();
std::cerr << "CPUID Supported : " << CpuIDSupported() << std::endl;
std::cerr << "GenuineIntel : " << GenuineIntel() << std::endl;
QString saltPre;
ADD_SALT_PRE(saltPre);
QString saltPost;
ADD_SALT_POST(saltPost);
QString key = coreHash + saltPre + pluginHash + saltPost + macHash;
std::cerr << "Key is: " << key.toStdString() << std::endl;
if ( authenticated_ )
std::cerr << "Authentication succcessfull" << std::endl;
else {
QMessageBox::warning ( 0, "Plugin License check failed", "License check for plugin has failed. Please get a valid License!" );
QString text = "License check for plugin has failed.\n";
text += "Please get a valid License!\n";
text += "Send the following Information to contact@openflipper.org:\n";
text += pluginFileName() +"\n";
text += coreHash +"\n";
text += pluginHash +"\n";
text += macHash +"\n";
QMessageBox::warning ( 0, "Plugin License check failed", text );
std::cerr << "Authentication failed" << std::endl;
authenticated_ = false;
}
// authenticated_ = true;
......
......@@ -44,7 +44,12 @@
#ifndef LICENSEMANAGER_HH
#define LICENSEMANAGER_HH
#include "OpenFlipper/BasePlugin/SecurityInterface.hh"
#include <OpenFlipper/BasePlugin/SecurityInterface.hh>
/** The salt file has to be provided for each plugin. It can be the same
for all plugins. See example for details on how this file has to be setup
*/
#include "salt.hh"
class LicenseManager : public QObject, SecurityInterface {
......@@ -58,21 +63,43 @@ Q_INTERFACES(SecurityInterface)
public :
/** This function is overloaded and will not allow to unblock signals
if the plugin is not authenticated
*/
void blockSignals( bool _state);
/** Return if the plugin has successfully passed the authentication
*/
bool authenticated();
virtual QString name() = 0;
public slots:
/** Call this function for plugin authentication. If it returns true,
the authentication has been successfull. Otherwise the core will
stop loading the plugin. Additionally the plugin will make itself
unusable by not allowing any signal slot connections.
*/
bool authenticate();
private:
bool authenticated_;
/** This is used to get the plugins Name from derived classes
The glugin name is the usual name of the glugin
*/
virtual QString name() = 0;
/** This function is special to the LicenseManager. It is used to
find the plugin when checking its hash value
*/
virtual QString pluginFileName();
/// This flag is true if authentication was successfull
bool authenticated_;
protected :
/** This function is overloaded in the security interface. If the
plugin is not authenticated, all connections will be automatically
removed again.
*/
void connectNotify ( const char * /*signal*/ );
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment