2010-08-30 08:32:05 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Author: Valient Gough <vgough@pobox.com>
|
|
|
|
*
|
|
|
|
*****************************************************************************
|
|
|
|
* Copyright (c) 2010 Valient Gough
|
|
|
|
*
|
2012-10-03 07:12:17 +02:00
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
2010-08-30 08:32:05 +02:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
2012-10-03 07:12:17 +02:00
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
|
|
* for more details.
|
2010-08-30 08:32:05 +02:00
|
|
|
*
|
2012-10-03 07:12:17 +02:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-08-30 08:32:05 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _FSConfig_incl_
|
|
|
|
#define _FSConfig_incl_
|
|
|
|
|
2013-01-29 04:07:54 +01:00
|
|
|
#include "base/Interface.h"
|
|
|
|
#include "base/shared_ptr.h"
|
|
|
|
#include "cipher/CipherKey.h"
|
|
|
|
#include "fs/encfs.h"
|
2013-03-05 07:29:58 +01:00
|
|
|
#include "fs/fsconfig.pb.h"
|
2010-08-30 08:32:05 +02:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2013-03-05 07:29:58 +01:00
|
|
|
namespace encfs {
|
|
|
|
|
2010-08-30 08:32:05 +02:00
|
|
|
enum ConfigType
|
|
|
|
{
|
|
|
|
Config_None = 0,
|
|
|
|
Config_Prehistoric,
|
2012-04-26 04:34:15 +02:00
|
|
|
Config_V3 = 3,
|
|
|
|
Config_V4 = 4,
|
|
|
|
Config_V5 = 5,
|
|
|
|
Config_V6 = 6,
|
|
|
|
Config_V7 = 7
|
2010-08-30 08:32:05 +02:00
|
|
|
};
|
|
|
|
|
2013-01-29 04:07:54 +01:00
|
|
|
struct EncFS_Opts;
|
2013-03-05 07:36:32 +01:00
|
|
|
class CipherV1;
|
2010-08-30 08:32:05 +02:00
|
|
|
class NameIO;
|
|
|
|
|
2012-04-26 04:34:15 +02:00
|
|
|
CipherKey getUserKey(const EncfsConfig &config, bool useStdin);
|
|
|
|
CipherKey getUserKey(const EncfsConfig &config,
|
|
|
|
const std::string &passwordProgram,
|
|
|
|
const std::string &rootDir);
|
2010-08-30 08:32:05 +02:00
|
|
|
|
2012-04-26 04:34:15 +02:00
|
|
|
CipherKey getNewUserKey(EncfsConfig &config, bool useStdin,
|
|
|
|
const std::string &program, const std::string &rootDir);
|
2010-08-30 08:32:05 +02:00
|
|
|
|
2013-03-05 07:36:32 +01:00
|
|
|
shared_ptr<CipherV1> getCipher(const EncfsConfig &cfg);
|
|
|
|
shared_ptr<CipherV1> getCipher(const Interface &iface, int keySize);
|
2010-08-30 08:32:05 +02:00
|
|
|
|
|
|
|
// helpers for serializing to/from a stream
|
2012-04-26 04:34:15 +02:00
|
|
|
std::ostream &operator << (std::ostream &os, const EncfsConfig &cfg);
|
|
|
|
std::istream &operator >> (std::istream &os, EncfsConfig &cfg);
|
2010-08-30 08:32:05 +02:00
|
|
|
|
2012-04-26 04:34:15 +02:00
|
|
|
// Filesystem state
|
2010-08-30 08:32:05 +02:00
|
|
|
struct FSConfig
|
|
|
|
{
|
2012-08-22 06:46:36 +02:00
|
|
|
shared_ptr<EncfsConfig> config;
|
|
|
|
shared_ptr<EncFS_Opts> opts;
|
2010-08-30 08:32:05 +02:00
|
|
|
|
2013-03-05 07:36:32 +01:00
|
|
|
shared_ptr<CipherV1> cipher;
|
2010-08-30 08:32:05 +02:00
|
|
|
CipherKey key;
|
2012-08-22 06:46:36 +02:00
|
|
|
shared_ptr<NameIO> nameCoding;
|
2010-08-30 08:32:05 +02:00
|
|
|
|
|
|
|
bool forceDecode; // force decode on MAC block failures
|
|
|
|
bool reverseEncryption; // reverse encryption operation
|
|
|
|
|
|
|
|
bool idleTracking; // turn on idle monitoring of filesystem
|
2013-03-05 07:39:51 +01:00
|
|
|
|
|
|
|
FSConfig()
|
|
|
|
: forceDecode(false),
|
|
|
|
reverseEncryption(false),
|
|
|
|
idleTracking(false) { }
|
2010-08-30 08:32:05 +02:00
|
|
|
};
|
|
|
|
|
2012-08-22 06:46:36 +02:00
|
|
|
typedef shared_ptr<FSConfig> FSConfigPtr;
|
2010-08-30 08:32:05 +02:00
|
|
|
|
2013-03-05 07:29:58 +01:00
|
|
|
} // namespace encfs
|
|
|
|
|
2010-08-30 08:32:05 +02:00
|
|
|
#endif
|
|
|
|
|