/** * @file PswGen/Generator/module.h * @brief Implementation of the iGenerator interface * @author Enar Vaikene * * Copyright (c) 2011-2019 Enar Vaikene * * This file is part of the eVaf C++ cross-platform application development framework. * * This file can be used under the terms of the GNU General Public License * version 3.0 as published by the Free Software Foundation and appearing in * the file LICENSE included in the packaging of this file. Please review the * the following information to ensure the GNU General Public License version * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. * * Alternatively, this file may be used in accordance with the Commercial License * Agreement provided with the Software. */ #ifndef __PSWGEN_GENERATOR_MODULE_H # define __PSWGEN_GENERATOR_MODULE_H #include "igenerator.h" #include "version.h" #include #include #include namespace eVaf { namespace PswGen { /// Module that generates strong passwords using cryptographic methods namespace Generator { /// Internal implementation of the Generator module namespace Internal { class GeneratorImpl; } // namespace eVaf::PswGen::Generator::Internal /** * Module implementing the iGenerator interface. */ class Module : public Plugins::iPlugin { Q_OBJECT Q_INTERFACES(eVaf::Plugins::iPlugin) Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR) public: Module(); virtual ~Module(); virtual bool init(QString const & args); virtual void done(); virtual bool isReady() const { return true; } private: // Members /// iGenerator interface instance Internal::GeneratorImpl * mGenerator; }; namespace Internal { /** * iGenerator interface implementation. * * Implements the iGenerator interface using MD5 cryptographic hashes. */ class GeneratorImpl : public QObject, public iGenerator { Q_OBJECT Q_INTERFACES(eVaf::PswGen::iGenerator) public: GeneratorImpl(); virtual ~GeneratorImpl(); virtual QString generatePassword(QString const & name, QString const & masterPassword, int length, uint flags = 0) const; virtual int maxLength() const { return 24; } }; } // namespace eVaf::PswGen::Generator::Internal } // namespace eVaf::PswGen::Generator } // namespace eVaf::PswGen } // namespace eVaf #endif // module.h