Commit f85cc83c authored by Jan Möbius's avatar Jan Möbius

Security interface/License Manager Documentation

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11140 383ad7c9-94d9-4d36-a494-682f7c89f535
parent aab2a7b7
......@@ -46,6 +46,22 @@
#include <QtGui>
#include <OpenFlipper/common/Types.hh>
/** \file SecurityInterface.hh
*
* This interface is used to add copy protection to plugins. \ref securityInterfacePage
* Usually you don't include this file but OpenFlipper/LicenseManager/LicenseManager.hh
*/
/** \brief Interface class for adding copy protection and license management to a plugin.
\n
\ref securityInterfacePage "Detailed description"
\n
This interface is used to add copy protection to plugins.
*/
class SecurityInterface {
public:
......@@ -65,6 +81,75 @@ class SecurityInterface {
};
/** \page securityInterfacePage Security/License Interface
\image html SecurityInterface.png
\n
\section Functionality
The security Interface can be used to add a license management to your plugin. When it is used,
plugins will only start, if a valid license is available. The license is bound to a machine
(Processor,network,...) and expires after a specified date.
\section Usage
To use this interface do the following steps:
\subsection license_includes Includes
Add the LicenseManager include to your plugin header file.
\code
#include <OpenFlipper/LicenseManager/LicenseManager.hh>
\endcode
\subsection license_licensemanager_integration QObject Replacement
Don't derive your Plugin from QObject anymore but from LicenseManager
which has to be the first one in your class definition.
\code
// Before:
class ExamplePlugin : public QObject, BaseInterface, MenuInterface, ScriptInterface, ToolbarInterface, StatusbarInterface
// After:
class ExamplePlugin : public LicenseManager, BaseInterface, MenuInterface, ScriptInterface, ToolbarInterface, StatusbarInterface
\endcode
\subsection cmake_license_changes Cmake Change
Additionally add the option LICENSEMANAGER to your CMakeLists generator e.g.:
\code
openflipper_plugin (LICENSEMANAGER ) )
\endcode
\subsection salt_file_setup Salt File
Copy the example sat file from OpenFlipper/LicenseManager/salt.hh.example to your plugin directory and rename it
to salt.hh ( e.g. Plugin-Example/salt.hh ). Modify the contents of your salt file to match your plugin:
The contact line will be presented to the user when a license has to be retrieved. The user gets the option
to start the mail program with this destination address and the license request.
\code
#define CONTACTMAIL QString("contact@openflipper.org")
\endcode
Afterwards modify the ADD_SALT_PRE and ADD_SALT_POST macros. Set the characters to some numbers you want.
These salts will basically define a password that will be added to the hashes. It has to be kept !!secret!! as
everybody who knows these salts, can generate licenses for your plugin. So don't give away your salt file. It is
only used when compiling your plugin and the corresponding license manager.
The last thing to change is the ADD_PLUGIN_FILENAME macro. Specify the filename of your plugin here, omitting the ending
as this will be added platform dependent by OpenFlipper.
\section license_genration License generation
When the plugin is now build, an additional LicenseManager is generated which shows
a widget on execution. It will be in your build directory in the subdirectory LicenseManagement.
To generate a license, copy the license request you received into the widget. Remove all text lines.
The manager will split the request into its separate strings. Enter a date, until the license should be valid
and generate it.
The generated license has to be copied into OpenFlippers License subdirectory.
*/
Q_DECLARE_INTERFACE(SecurityInterface,"OpenFlipper.SecurityInterface/0.1")
#endif // SECURITYINTERFACE_HH
......@@ -60,7 +60,6 @@ IniInterface
LoadSaveInterface
PickingInterface
ProcessInterface
SecurityInterface
TextureInterface
ViewInterface
......@@ -206,6 +205,15 @@ For plugins which provide scriptable functions ( \ref scriptInterfacePage )
Enables the developer to connect signals and slots across plugins. ( \ref pluginConnectionInterfacePage )
\n
\subpage securityInterfacePage
\n
\image html SecurityInterface.png
\n
The security Interface can be used to add a license management to your plugin. When it is used,
plugins will only start, if a valid license is available. The license is bound to a machine
(Processor,network,...) and expires after a specified date. ( \ref securityInterfacePage )
\n
*/
......
......@@ -40,28 +40,31 @@
* *
\*===========================================================================*/
//
// C++ Interface: SecurityInterface
//
// Description:
//
//
// Author: Jan Moebius <jan_moebius@web.de>, (C) 2007
//
#ifndef LICENSEMANAGER_HH
#define LICENSEMANAGER_HH
#include <OpenFlipper/BasePlugin/SecurityInterface.hh>
/** The salt file has to be provided for each plugin. It can be the same
/* 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"
/** \file LicenseManager.hh
*
* This interface is used to add copy protection to plugins. \ref securityInterfacePage
*
*/
/** \brief License management base class
*
* See \ref securityInterfacePage for Details on how to use it.
*
* The class is used by plugins to integrate license management. It will check the license,
* generate license requests and prevent the plugin from loading if an invalid license or no license
* is found.
*/
class LicenseManager : public QObject, SecurityInterface {
Q_OBJECT
......@@ -75,40 +78,40 @@ Q_INTERFACES(SecurityInterface)
public :
/** This function is overloaded and will not allow to unblock signals
if the plugin is not authenticated
if the plugin is not authenticated.
*/
void blockSignals( bool _state);
/** Return if the plugin has successfully passed the authentication
/** Return if the plugin has successfully passed the authentication.
*/
bool authenticated();
public slots:
/** Call this function for plugin authentication. If it returns true,
the authentication has been successfull. Otherwise the core will
the authentication has been successful. Otherwise the core will
stop loading the plugin. Additionally the plugin will make itself
unusable by not allowing any signal slot connections.
@param _authstring String returned, containing hashed license request, if something went wrong or no valid license available.
*/
bool authenticate();
/** if authenticate returns false, this string will containe the license information
/** if authenticate returns false, this string will contain the license information required
* to generate a license request and the error that caused the failure.
*/
QString licenseError();
private:
/** This is used to get the plugins Name from derived classes
The glugin name is the usual name of the glugin
The plugin name is the usual name of the plugin
*/
virtual QString name() = 0;
/** This function is special to the LicenseManager. It is used to
find the plugin when checking its hash value
find the plugin when checking its hash value.
*/
virtual QString pluginFileName();
/// This flag is true if authentication was successfull
/// This flag is true if authentication was successful
bool authenticated_;
/// License information string
......@@ -120,8 +123,8 @@ Q_INTERFACES(SecurityInterface)
plugin is not authenticated, all connections will be automatically
removed again.
*/
void connectNotify ( const char * /*signal*/ );
void connectNotify ( const char * signal );
};
#endif // LICENSEMANAGER_HH
\ No newline at end of file
#endif // LICENSEMANAGER_HH
......@@ -43,45 +43,16 @@
/* Salt file for security interface
*/
/** This Macro creates a salt (basicallz a key) for your plugin which is added to the
/** This Macro creates a salt (basically a key) for your plugin which is added to the
license files. You have to keep this salt file
!!!SECRET!!!,
otherwise everybody can create licenses for your Plugin. The special
!!!SECRET!!!, otherwise everybody can create licenses for your Plugin. The special
form of this macro makes the salt string invisible inside the binary
of the plugin so that it is not easy to recover from it.
Modify the Salts below to create your own plugin keys. Then
copy this file to your plugin directory and name it "salt.hh".
Add the following include to your plugin file:
\code
#include <OpenFlipper/LicenseManager/LicenseManager.hh>
\endcode
Additionally don't derive your Plugin from QObject but from LicenseManager
which has to be the first one in your class definition.
\code
// Before:
class ExamplePlugin : public QObject, BaseInterface, MenuInterface, ScriptInterface, ToolbarInterface, StatusbarInterface
// After:
class ExamplePlugin : public LicenseManager, BaseInterface, MenuInterface, ScriptInterface, ToolbarInterface, StatusbarInterface
\endcode
Additionally add the option
LICENSEMANAGER
to your CMakeLists generator (e.g. openflipper_plugin (LICENSEMANAGER ) )
When the plugin is now build, an additional LicenseManager is generated which shows
a widget on execution. Enter the information which is given by OpenFlipper when
plugin loading fails due to a license issue and execute it. It will create the required
license file to run the plugin.
Details on how to use license management can be found here on the \ref securityInterfacePage .
*/
/// Specify your contact mail address
......
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