Merge branch 'develop' of github.com:cryfs/cryfs into develop
This commit is contained in:
commit
ddf6b00b64
@ -1,6 +1,6 @@
|
|||||||
# cryfs [![Build Status](https://travis-ci.org/cryfs/cryfs.svg?branch=master)](https://travis-ci.org/cryfs/cryfs)
|
# cryfs [![Build Status](https://travis-ci.org/cryfs/cryfs.svg?branch=master)](https://travis-ci.org/cryfs/cryfs)
|
||||||
CryFS encrypts your files, so you can safely store them anywhere. It works well together with cloud services like Dropbox, iCloud, OneDrive and others.
|
CryFS encrypts your files, so you can safely store them anywhere. It works well together with cloud services like Dropbox, iCloud, OneDrive and others.
|
||||||
See https://www.cryfs.org
|
See [https://www.cryfs.org](https://www.cryfs.org).
|
||||||
|
|
||||||
This repository contains the filesystem implementation. There are submodules in the following repositores:
|
This repository contains the filesystem implementation. There are submodules in the following repositores:
|
||||||
|
|
||||||
@ -48,12 +48,14 @@ Building from source
|
|||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
- [biicode](https://www.biicode.com/downloads)
|
- [biicode](http://www.biicode.com/downloads)
|
||||||
|
|
||||||
# After installing, call
|
# After installing, call
|
||||||
$ bii setup:cpp
|
$ bii setup:cpp
|
||||||
|
|
||||||
- GCC version >= 4.8 or Clang (TODO which minimal version?)
|
- GCC version >= 4.8 or Clang (TODO which minimal version?)
|
||||||
|
- CMake version >= 3.3
|
||||||
|
- libcurl4 (including development headers)
|
||||||
- libFUSE >= 2.8.6 (including development headers)
|
- libFUSE >= 2.8.6 (including development headers)
|
||||||
|
|
||||||
# Ubuntu
|
# Ubuntu
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
messmer/cmake: 3
|
messmer/cmake: 3
|
||||||
messmer/cpp-utils: 9
|
messmer/cpp-utils: 9
|
||||||
messmer/fspp: 7
|
messmer/fspp: 7
|
||||||
messmer/gitversion: 6
|
messmer/gitversion: 7
|
||||||
messmer/parallelaccessstore: 6
|
messmer/parallelaccessstore: 6
|
||||||
|
|
||||||
[parent]
|
[parent]
|
||||||
messmer/cryfs: 11
|
messmer/cryfs: 13
|
||||||
[paths]
|
[paths]
|
||||||
# Local directories to look for headers (within block)
|
# Local directories to look for headers (within block)
|
||||||
# /
|
# /
|
||||||
|
@ -48,6 +48,7 @@ using cpputils::RandomGenerator;
|
|||||||
using cpputils::unique_ref;
|
using cpputils::unique_ref;
|
||||||
using cpputils::SCryptSettings;
|
using cpputils::SCryptSettings;
|
||||||
using cpputils::Console;
|
using cpputils::Console;
|
||||||
|
using cpputils::HttpClient;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@ -72,8 +73,8 @@ using boost::chrono::milliseconds;
|
|||||||
|
|
||||||
namespace cryfs {
|
namespace cryfs {
|
||||||
|
|
||||||
Cli::Cli(RandomGenerator &keyGenerator, const SCryptSettings &scryptSettings, shared_ptr<Console> console):
|
Cli::Cli(RandomGenerator &keyGenerator, const SCryptSettings &scryptSettings, shared_ptr<Console> console, shared_ptr<HttpClient> httpClient):
|
||||||
_keyGenerator(keyGenerator), _scryptSettings(scryptSettings), _console(console) {}
|
_keyGenerator(keyGenerator), _scryptSettings(scryptSettings), _console(console), _httpClient(httpClient) {}
|
||||||
|
|
||||||
void Cli::_showVersion() {
|
void Cli::_showVersion() {
|
||||||
cout << "CryFS Version " << version::VERSION_STRING << endl;
|
cout << "CryFS Version " << version::VERSION_STRING << endl;
|
||||||
@ -89,7 +90,7 @@ namespace cryfs {
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
cout << "WARNING! This is a debug build. Performance might be slow." << endl;
|
cout << "WARNING! This is a debug build. Performance might be slow." << endl;
|
||||||
#endif
|
#endif
|
||||||
VersionChecker versionChecker;
|
VersionChecker versionChecker(_httpClient);
|
||||||
optional<string> newestVersion = versionChecker.newestVersion();
|
optional<string> newestVersion = versionChecker.newestVersion();
|
||||||
if (newestVersion == none) {
|
if (newestVersion == none) {
|
||||||
cout << "Could not connect to cryfs.org to check for updates." << endl;
|
cout << "Could not connect to cryfs.org to check for updates." << endl;
|
||||||
|
@ -8,12 +8,13 @@
|
|||||||
#include <messmer/cpp-utils/tempfile/TempFile.h>
|
#include <messmer/cpp-utils/tempfile/TempFile.h>
|
||||||
#include <messmer/cpp-utils/io/Console.h>
|
#include <messmer/cpp-utils/io/Console.h>
|
||||||
#include <messmer/cpp-utils/random/RandomGenerator.h>
|
#include <messmer/cpp-utils/random/RandomGenerator.h>
|
||||||
|
#include <messmer/cpp-utils/network/HttpClient.h>
|
||||||
#include "CallAfterTimeout.h"
|
#include "CallAfterTimeout.h"
|
||||||
|
|
||||||
namespace cryfs {
|
namespace cryfs {
|
||||||
class Cli final {
|
class Cli final {
|
||||||
public:
|
public:
|
||||||
Cli(cpputils::RandomGenerator &keyGenerator, const cpputils::SCryptSettings &scryptSettings, std::shared_ptr<cpputils::Console> console);
|
Cli(cpputils::RandomGenerator &keyGenerator, const cpputils::SCryptSettings &scryptSettings, std::shared_ptr<cpputils::Console> console, std::shared_ptr<cpputils::HttpClient> httpClient);
|
||||||
int main(int argc, char *argv[]);
|
int main(int argc, char *argv[]);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -38,6 +39,7 @@ namespace cryfs {
|
|||||||
cpputils::RandomGenerator &_keyGenerator;
|
cpputils::RandomGenerator &_keyGenerator;
|
||||||
cpputils::SCryptSettings _scryptSettings;
|
cpputils::SCryptSettings _scryptSettings;
|
||||||
std::shared_ptr<cpputils::Console> _console;
|
std::shared_ptr<cpputils::Console> _console;
|
||||||
|
std::shared_ptr<cpputils::HttpClient> _httpClient;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(Cli);
|
DISALLOW_COPY_AND_ASSIGN(Cli);
|
||||||
};
|
};
|
||||||
|
@ -18,10 +18,6 @@ using namespace cpputils::logging;
|
|||||||
|
|
||||||
namespace cryfs {
|
namespace cryfs {
|
||||||
|
|
||||||
VersionChecker::VersionChecker()
|
|
||||||
:VersionChecker(make_shared<CurlHttpClient>()) {
|
|
||||||
}
|
|
||||||
|
|
||||||
VersionChecker::VersionChecker(shared_ptr<HttpClient> httpClient)
|
VersionChecker::VersionChecker(shared_ptr<HttpClient> httpClient)
|
||||||
: _versionInfo(_getVersionInfo(std::move(httpClient))) {
|
: _versionInfo(_getVersionInfo(std::move(httpClient))) {
|
||||||
}
|
}
|
||||||
@ -55,7 +51,7 @@ namespace cryfs {
|
|||||||
|
|
||||||
optional<ptree> VersionChecker::_getVersionInfo(shared_ptr<HttpClient> httpClient) {
|
optional<ptree> VersionChecker::_getVersionInfo(shared_ptr<HttpClient> httpClient) {
|
||||||
long timeoutMsec = 2000;
|
long timeoutMsec = 2000;
|
||||||
optional<string> response = httpClient->get("http://www.cryfs.org/version_info.json", timeoutMsec);
|
optional<string> response = httpClient->get("https://www.cryfs.org/version_info.json", timeoutMsec);
|
||||||
if (response == none) {
|
if (response == none) {
|
||||||
return none;
|
return none;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
namespace cryfs {
|
namespace cryfs {
|
||||||
class VersionChecker final {
|
class VersionChecker final {
|
||||||
public:
|
public:
|
||||||
VersionChecker();
|
|
||||||
//TODO Write a cpputils::shared_ref and use it
|
//TODO Write a cpputils::shared_ref and use it
|
||||||
VersionChecker(std::shared_ptr<cpputils::HttpClient> httpClient);
|
VersionChecker(std::shared_ptr<cpputils::HttpClient> httpClient);
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ namespace cryfs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string CryConfigCreator::_generateEncKey(const std::string &cipher) {
|
string CryConfigCreator::_generateEncKey(const std::string &cipher) {
|
||||||
_console->print("\nGenerating secure encryption key...");
|
_console->print("\nGenerating secure encryption key. This might take some time..");
|
||||||
auto key = CryCiphers::find(cipher).createKey(_encryptionKeyGenerator);
|
auto key = CryCiphers::find(cipher).createKey(_encryptionKeyGenerator);
|
||||||
_console->print("done\n");
|
_console->print("done\n");
|
||||||
return key;
|
return key;
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
#include "cli/Cli.h"
|
#include "cli/Cli.h"
|
||||||
#include <messmer/cpp-utils/random/Random.h>
|
#include <messmer/cpp-utils/random/Random.h>
|
||||||
#include <messmer/cpp-utils/crypto/kdf/Scrypt.h>
|
#include <messmer/cpp-utils/crypto/kdf/Scrypt.h>
|
||||||
|
#include <messmer/cpp-utils/network/CurlHttpClient.h>
|
||||||
|
|
||||||
using namespace cryfs;
|
using namespace cryfs;
|
||||||
using cpputils::Random;
|
using cpputils::Random;
|
||||||
using cpputils::SCrypt;
|
using cpputils::SCrypt;
|
||||||
|
using cpputils::CurlHttpClient;
|
||||||
using std::make_shared;
|
using std::make_shared;
|
||||||
using cpputils::IOStreamConsole;
|
using cpputils::IOStreamConsole;
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
auto &keyGenerator = Random::OSRandom();
|
auto &keyGenerator = Random::OSRandom();
|
||||||
return Cli(keyGenerator, SCrypt::DefaultSettings, make_shared<IOStreamConsole>()).main(argc, argv);
|
return Cli(keyGenerator, SCrypt::DefaultSettings, make_shared<IOStreamConsole>(), make_shared<CurlHttpClient>()).main(argc, argv);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setVersionInfo(const string &versionInfo) {
|
void setVersionInfo(const string &versionInfo) {
|
||||||
http->addWebsite("http://www.cryfs.org/version_info.json", versionInfo);
|
http->addWebsite("https://www.cryfs.org/version_info.json", versionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -7,8 +7,10 @@
|
|||||||
#include <messmer/cpp-utils/tempfile/TempDir.h>
|
#include <messmer/cpp-utils/tempfile/TempDir.h>
|
||||||
#include <messmer/cpp-utils/tempfile/TempFile.h>
|
#include <messmer/cpp-utils/tempfile/TempFile.h>
|
||||||
#include "../../../src/cli/Cli.h"
|
#include "../../../src/cli/Cli.h"
|
||||||
|
#include "../../../src/cli/VersionChecker.h"
|
||||||
#include <messmer/cpp-utils/logging/logging.h>
|
#include <messmer/cpp-utils/logging/logging.h>
|
||||||
#include <messmer/cpp-utils/process/subprocess.h>
|
#include <messmer/cpp-utils/process/subprocess.h>
|
||||||
|
#include <messmer/cpp-utils/network/FakeHttpClient.h>
|
||||||
#include "../../testutils/MockConsole.h"
|
#include "../../testutils/MockConsole.h"
|
||||||
|
|
||||||
class CliTest : public ::testing::Test {
|
class CliTest : public ::testing::Test {
|
||||||
@ -23,6 +25,12 @@ public:
|
|||||||
cpputils::TempFile configfile;
|
cpputils::TempFile configfile;
|
||||||
std::shared_ptr<MockConsole> console;
|
std::shared_ptr<MockConsole> console;
|
||||||
|
|
||||||
|
std::shared_ptr<cpputils::HttpClient> _httpClient() {
|
||||||
|
std::shared_ptr<cpputils::FakeHttpClient> httpClient = std::make_shared<cpputils::FakeHttpClient>();
|
||||||
|
httpClient->addWebsite("https://www.cryfs.org/version_info.json", "{\"version_info\":{\"current\":\"0.8.5\"}}");
|
||||||
|
return httpClient;
|
||||||
|
}
|
||||||
|
|
||||||
void run(std::vector<const char*> args) {
|
void run(std::vector<const char*> args) {
|
||||||
std::vector<char*> _args;
|
std::vector<char*> _args;
|
||||||
_args.reserve(args.size()+1);
|
_args.reserve(args.size()+1);
|
||||||
@ -31,7 +39,7 @@ public:
|
|||||||
_args.push_back(const_cast<char*>(arg));
|
_args.push_back(const_cast<char*>(arg));
|
||||||
}
|
}
|
||||||
auto &keyGenerator = cpputils::Random::PseudoRandom();
|
auto &keyGenerator = cpputils::Random::PseudoRandom();
|
||||||
cryfs::Cli(keyGenerator, cpputils::SCrypt::TestSettings, console).main(_args.size(), _args.data());
|
cryfs::Cli(keyGenerator, cpputils::SCrypt::TestSettings, console, _httpClient()).main(_args.size(), _args.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXPECT_EXIT_WITH_HELP_MESSAGE(std::vector<const char*> args, const std::string &message = "") {
|
void EXPECT_EXIT_WITH_HELP_MESSAGE(std::vector<const char*> args, const std::string &message = "") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user