/* Cfour (C++ Common Console Classes) * Copyright (C) 2001 Jeffrey Bakker * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * Author: Jeffrey Bakker * Filename: security.h * File version: 1.1 * * =========================================================================== * * Created on: July 1st, 2001 * * * Modified on: July 6th, 2001 * * - Using a new class LogPass as a data member, rather than * using two data members, log, and pass. * * - Changed all methods that directly access the log and pass * so they access the LogPass methods. * * - These changes will help make the Security class to be * able to use multiple login and pass accounts. * * * =========================================================================== * * Remark: * * This is the definition of the Security class. The class porvides a system * to control access to certain methods in the program. It can also change * the access as well. The actual login and password are stored in a seperate * class, LogPass, as a private data member of the Security class. The only * methods that have access to retrieve the login and password are private. * Together with the LogPass class, this Security system uses very strong * encapsulation. * * Just so you don't get the wrong idea, the is _NO_ crypto stuff here, I am * no genius. This class provides an engine for retrieving the password from * the user, and verification methods. But it doesn't mean you can't use this * class and write your own encryption engine, or use an existing one along * with this class. * _______. .. */ #ifndef SECURITY_H #define SECURITY_H #include <iostream> #include <cstdlib> #include <string> #include "logpass.h" using namespace std; class Security { // methods ------------------------------------------------------------------- public: Security(); bool ask_login(); bool ask_pass(); bool verify_login(string L) const; bool verify_pass(string P) const; bool Login(); void set_mask(char mask, int rate); void reset_LP(); private: string getLogin() const; string getPass() const; // data members -------------------------------------------------------------- LogPass Account; char mask; unsigned int rate; }; #endif // SECURITY_H