/** * @file PswGen/Generator/igenerator.h * @brief Interface for password generator modules * @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_IGENERATOR_H # define __PSWGEN_GENERATOR_IGENERATOR_H #include #include namespace eVaf { namespace PswGen { /** * Password generator interface. * * This interface is used to generate strong passwords. */ struct iGenerator { /** * Flags for the password generator. */ enum { ALPHANUMERIC = 0x01 ///< Generated password contains only alphanumeric characters }; /** * Empty virtual destructor */ virtual ~iGenerator() {} /** * Generates a strong password * @param name Name of the password * @param masterPassword Master password * @param length Length of the password (if zero, then uses the max length) * @param flags Flags for the generator * @return Generated password * * This function generates a strong password using the name and the master password string * as inputs. Calling this function with the same input always returns the same generated * password. * * The length of the password is specified with the length argument. However, the generated password * is never longer than possible with the particular cryptographic method. * * Optional flags can be used to fine-tune the generator. */ virtual QString generatePassword(QString const & name, QString const & masterPassword, int length, uint flags = 0) const = 0; /** * Returns the maximum length of generated passwords * @return Maximum length * * This function returns the maximum length of generated passwords that is possible with the cryptographic method * used by the module implementing this interface. */ virtual int maxLength() const = 0; }; } // namespace eVaf::PswGen } // namespace eVaf Q_DECLARE_INTERFACE(eVaf::PswGen::iGenerator, "eVaf.PswGen.iGenerator/1.0") #endif // igenerator.h