1 /*
2  * Copyright (C) 2018 Rafael Ostertag
3  *
4  * This file is part of YAPET.
5  *
6  * YAPET is free software: you can redistribute it and/or modify it under the
7  * terms of the GNU General Public License as published by the Free Software
8  * Foundation, either version 3 of the License, or (at your option) any later
9  * version.
10  *
11  * YAPET is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * YAPET.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Additional permission under GNU GPL version 3 section 7
20  *
21  * If you modify this program, or any covered work, by linking or combining it
22  * with the OpenSSL project's OpenSSL library (or a modified version of that
23  * library), containing parts covered by the terms of the OpenSSL or SSLeay
24  * licenses, Rafael Ostertag grants you additional permission to convey the
25  * resulting work.  Corresponding Source for a non-source form of such a
26  * combination shall include the source code for the parts of OpenSSL used as
27  * well as that of the covered work.
28  */
29 
30 /**
31  * @file
32  *
33  * Header file for constant values.
34  */
35 
36 #ifndef _CONSTS_H
37 #define _CONSTS_H 1
38 
39 #include <string>
40 // Used for the character pools
41 #include "characterpool.hh"
42 #include "rng.hh"
43 
44 namespace YAPET {
45 class Consts {
46    public:
47     static const std::string ARGON2_TIME_COST_KEY;
48     static const std::string ARGON2_MEMORY_COST_KEY;
49     static const std::string ARGON2_PARALLELISM_KEY;
50     static const std::string ARGON2_SALT1_KEY;
51     static const std::string ARGON2_SALT2_KEY;
52     static const std::string ARGON2_SALT3_KEY;
53     static const std::string ARGON2_SALT4_KEY;
54     //! Holds the default suffix for yapet files
55     static const std::string DEFAULT_FILE_SUFFIX;
56     //! The default file name of the config file
57     static const std::string DEFAULT_RC_FILENAME;
58     //! Default for checking file security
59     static constexpr bool DEFAULT_FILE_SECURITY{true};
60     static constexpr bool DEFAULT_ALLOW_LOCK_QUIT{true};
61 
62     //! Maximum password length
63     static constexpr auto MAX_PASSWORD_LENGTH{256};
64     //! Minimum password length
65     static constexpr auto MIN_PASSWORD_LENGTH{2};
66     //! The minimum lock timeout
67     static constexpr auto MIN_LOCK_TIMEOUT{10};
68     static constexpr auto MAX_CONFIG_LINE_LENGTH{1024};
69     //! The default lock timeout
70     static constexpr auto DEFAULT_LOCK_TIMEOUT{600};
71     //! Default password length for Password Generator
72     static constexpr auto DEFAULT_PASSWORD_LENGTH{15};
73     static constexpr auto DEFAULT_PASSWORD_INPUT_TIMEOUT{60};
74     static constexpr auto DEFAULT_CHARACTER_POOLS{
75         yapet::pwgen::LETTERS | yapet::pwgen::DIGITS | yapet::pwgen::PUNCT |
76         yapet::pwgen::SPECIAL};
77 
78     // Argon2 options
79 
80     // in kibi
81     static constexpr int DEFAULT_ARGON2_MEMORY{262144};
82     static constexpr int MIN_ARGON2_MEMORY{65536};
83     // threads
84     static constexpr int DEFAULT_ARGON2_PARALLELISM{16};
85     static constexpr int MIN_ARGON2_PARALLELISM{1};
86     // iterations
87     static constexpr int DEFAULT_ARGON2_TIME_COST{5};
88     static constexpr int MIN_ARGON2_TIME_COSTS{2};
89 
90     static constexpr auto EXCEPTION_MESSAGE_BUFFER_SIZE{512};
91 };
92 }  // namespace YAPET
93 #endif  // _CONSTS_H
94