Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ libcommonutil/libcommonutil.vcxproj.user
libcppcryptfs/libcppcryptfs.vcxproj.user
cppcryptfs/gitversion.rc2
cppcryptfsctl/gitversion.rc2
VersionGenerated.h
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ To start an elevated command prompt in Windows 10, click on the search (magnifyi
Whether or not you are using git, everything will go easier if you put everything in c:\git.

Getting OpenSSL from github will get you the latest development version of OpenSSL. However, the cppcryptfs releases are built using the
current 3.0.x Long Term Support (LTS) version of OpenSSL (currently openssl-3.0.13). These are available from https://www.openssl.org/source/. To use those, you will need to download
current 3.0.x Long Term Support (LTS) version of OpenSSL (currently openssl-3.0.21). These are available from https://www.openssl.org/source/. To use those, you will need to download
the .tar.gz and extract it into a directory. You can build it with the same instructions that follow regardless of how you get OpenSSL.

Microsoft has announced a compiler-based mitigation for one variant of the Spectre vulnerability. To use it, you need to have version 15.5 or higher of Visual Studio. To use the mitigation with OpenSSL, you need to add the /Qspectre flag to the compiler optimization flags. OpenSSL currently does not use this flag. Also, to be extra safe, add the /guard:cf (Control Flow Guard) flag. To use these, you need to edit c:\\git\openssl\\Configurations\\10-main.conf and change "/O2" to "/O2 /Qspectre /guard:cf" (omit /guard:cf if building for ARM64).
Expand Down
33 changes: 18 additions & 15 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cppcryptfs 是 gocryptfs 文件系统在 Windows 上的 C++ 实现。cppcryptfs

cppcryptfs 提供对虚拟文件系统中的文件和文件名进行实时、静态和云端加密。它使用 [Dokany](https://github.com/dokan-dev/dokany) 驱动程序和库在 Windows 下的用户模式中提供虚拟文件系统。

**重要提示**:根据 [此](https://github.com/rfjakob/gocryptfs/issues/50) 讨论,如果你的密码很强,你才应该将创建的 gocryptfs.conf 存储在云端。
**重要提示**:根据 [此](https://github.com/rfjakob/gocryptfs/issues/50) 讨论,只有你的密码足够强,才应该将创建的 gocryptfs.conf 存储在云端。
如果攻击者获取了你的 gocryptfs.conf,那么他们将能够动用他们拥有的任何资源对你加密的密码进行暴力破解。增加 scryptn 会减慢他们的破解速度(见下文)。开发者将他的 gocryptfs.conf 存储在云端并使用非常强的密码。

你可以使用 cppcryptfs 在一个文件夹中创建一个加密文件系统。这个加密文件系统由你选择的密码保护。
Expand Down Expand Up @@ -67,7 +67,7 @@ cppcryptfs 在没有管理员权限运行时失败的测试与对 DACL(自由

在 [INSTALL.md](INSTALL.md) 中有详细的构建说明。

cppcryptfs 当前与 Dokany 2.3.0.1000 保持同步。
cppcryptfs 当前与 Dokany 2.3.1.1000 保持同步。

使用方法
-------
Expand Down Expand Up @@ -199,13 +199,13 @@ cppcryptfs 会缓存有关文件系统的信息。如果缓存中的某个条目

如果你不在两个同时运行的 cppcryptfs 实例之间或 cppcryptfs 实例与 gocryptfs 实例之间同步文件系统,那么没有理由不将缓存生存时间设置为较高的值或无限期。

**多线程**
**Multi-threaded(多线程**

如果启用此选项,则每个文件系统可以有多个线程处理请求。这可能会提高性能。Dokany 会自动选择要使用的线程数。

如果禁用此选项,则每个文件系统将仅使用一个线程来处理请求。

**不区分大小写**
**Case insensitive(不区分大小写**

此选项仅在前向模式下且使用加密文件名时有效。使用加密文件名的反向模式文件系统始终区分大小写,而使用纯文本文件名的文件系统始终不区分大小写。

Expand All @@ -215,7 +215,7 @@ cppcryptfs 会缓存有关文件系统的信息。如果缓存中的某个条目

有关更多信息,请参阅“大小写敏感性”部分。

**启用挂载管理器(回收站)**
**Enable Mount Manager (Recycle Bin)(启用挂载管理器(回收站)**

当选择默认设置或推荐设置时,此设置当前未启用。如果你希望使用它,则必须单独启用。此设置尚未经过全面测试。

Expand Down Expand Up @@ -266,7 +266,7 @@ cppcryptfs --list=d:\

在默认设置和推荐设置中,此设置均未启用。

**在内存中加密密钥**
**Encrypt Keys in Memory(在内存中加密密钥**

启用此设置后,cppcryptfs 在不需要加密密钥(主密钥和任何派生密钥)时,会使用 Windows 数据保护 API (DPAPI) 对其进行加密。密钥使用 DPAPI 进行加密,在需要时进行解密,然后在不需要时将未加密的副本清零。有关 DPAPI 的更多信息,请参阅下面的“保存的密码”部分。

Expand All @@ -280,7 +280,7 @@ cppcryptfs --list=d:\

无论是默认设置还是推荐设置,都未启用此设置。

**在内存中缓存密钥**
**Cache Keys in Memory(在内存中缓存密钥**

除非启用“在内存中加密密钥”,否则此设置无效。

Expand All @@ -306,27 +306,27 @@ Dokany 通常需要 5 秒才能回调。然而,文件系统几乎会立即显

此设置默认启用。

**卸载时若正在使用则发出警告**
**Warn if in use when dismounting(卸载时若正在使用则发出警告**

如果启用此设置,当用户尝试卸载文件系统、卸载所有文件系统或退出程序时,如果挂载的文件系统上仍有任何打开的文件或目录,cppcryptfs 将通知用户并询问是否应继续卸载。

如果启用此设置,在卸载正在使用的文件系统时,命令行中需要使用 --force 标志。

无论是默认设置还是推荐设置,都未启用此设置。

**拒绝其他会话访问**
**Deny Other Sessions(拒绝其他会话)**

如果启用此设置,加密卷将仅在启动挂载它们的 cppcryptfs 实例的会话中可访问。用于挂载的任何驱动器号在其他会话中仍然可见,但其他会话无法访问这些驱动器。

此检查仅在调用 CreateFile API(该 API 既可以创建新文件和目录,也可以打开现有文件和目录)时进行。仅在 CreateFile 中拒绝其他会话的访问似乎就足够了。

此功能的测试范围让开发人员相信,此设置可以使挂载的卷免受共享同一台计算机并登录到不同会话的其他普通登录用户的访问。然而,不能确定一个有决心且有知识的攻击者无法找到绕过此保护的方法。

有关更多信息,请参阅下面的“拒绝服务访问”说明。
有关更多信息,请参阅下面的“Deny Services(拒绝服务)”说明。

无论是默认设置还是推荐设置,都未启用此设置。

**拒绝服务访问**
**Deny Services(拒绝服务)**

如果启用此设置,加密卷将无法被在会话 0 中运行的 Windows 服务访问。

Expand All @@ -346,7 +346,7 @@ Dokany 通常需要 5 秒才能回调。然而,文件系统几乎会立即显

更多设置
---------
还有一个设置选项卡
还有一个更多设置选项卡

![Alt text](/screenshots/screenshot_more_settings.png?raw=true "设置选项卡")
*显示推荐设置*
Expand All @@ -365,6 +365,10 @@ Dokany 通常需要 5 秒才能回调。然而,文件系统几乎会立即显

如果任何条件为真,则此设置开启,因此若要始终启用它,可以同时勾选“NTFS”和“非 NTFS”框。

**界面语言**

在这里你可以更改界面的语言。更改之后,必须转到挂载选项卡并退出程序,然后重新启动程序才能使更改生效。

保存的密码
------

Expand Down Expand Up @@ -414,7 +418,8 @@ https://msdn.microsoft.com/en-us/library/ms995355.aspx

可以以正向模式挂载已挂载的反向文件系统。正向文件系统也将是只读的,这主要用于测试。

### 命令行选项
命令行选项
------
cppcryptfs 接受一些用于挂载和卸载文件系统的命令行选项。目前,只能通过图形用户界面 (GUI) 创建文件系统。

cppcryptfs 只能有一个主实例运行。如果没有其他 cppcryptfs 实例正在运行,那么 cppcryptfs 会处理命令行参数,然后继续运行。如果已经有另一个 cppcryptfs 实例正在运行,那么 cppcryptfs 会将其命令行参数发送给正在运行的主实例。如果从控制台窗口运行,它会将处理命令行的任何输出打印到控制台。如果不是从控制台运行,它会在消息框中显示输出。
Expand All @@ -427,8 +432,6 @@ cppcryptfsctl 在成功时将 ERRORLEVEL 设置为 0,发生错误时设置为

命名管道的名称会用启动 cppcryptfs 的用户的用户名和域名进行修饰。因此,cppcryptfs/cppcryptfsctl 只能与同一用户启动的 cppcryptfs 实例进行通信。

### 使用方法

```
用法:cppcryptfs/cppcryptfsctl [选项]

Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Changelog
------------
v1.4.4.11 2 Sep 2026
* Added xchacha20-poly1305 cipher algorithm.
* Fixed a path out-of-bounds bug when checking a trailing path separator.
* Fixed translations.

v1.4.4.10 25 Apr 2026
* Added ARM64 build.

Expand Down
12 changes: 6 additions & 6 deletions cppcryptfs/cppcryptfs.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM64">
Expand Down Expand Up @@ -195,7 +195,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(PROJECTDIR)..\libcppcryptfs;C:\Program Files\Dokan\Dokan Library-2.3.1\include;$(ProjectDir);c:\git\rapidjson\include;C:\git\openssl-arm64-static\include</AdditionalIncludeDirectories>
<EnablePREfast>false</EnablePREfast>
Expand Down Expand Up @@ -254,7 +254,7 @@
<AdditionalIncludeDirectories>$(IntDir);$(ProjectDir);$(ProjectDir)res\en;$(ProjectDir)res\ru;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<PreBuildEvent>
<Command>python "$(ProjectDir)\..\build_scripts\make_version_header.py" "$(ProjectDir)</Command>
<Command>python "$(ProjectDir)\..\build_scripts\make_version_header.py" "$(ProjectDir)"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand Down Expand Up @@ -291,7 +291,7 @@
<AdditionalIncludeDirectories>$(IntDir);$(ProjectDir);$(ProjectDir)res\en;$(ProjectDir)res\ru;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<PreBuildEvent>
<Command>python "$(ProjectDir)\..\build_scripts\make_version_header.py" "$(ProjectDir)</Command>
<Command>python "$(ProjectDir)\..\build_scripts\make_version_header.py" "$(ProjectDir)"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
Expand All @@ -301,7 +301,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(PROJECTDIR)..\libcppcryptfs;C:\Program Files\Dokan\Dokan Library-2.3.1\include;$(ProjectDir);c:\git\rapidjson\include;C:\git\openssl-arm64-static\include</AdditionalIncludeDirectories>
<AdditionalOptions>/Qspectre</AdditionalOptions>
Expand All @@ -328,7 +328,7 @@
<AdditionalIncludeDirectories>$(IntDir);$(ProjectDir);$(ProjectDir)res\en;$(ProjectDir)res\ru;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<PreBuildEvent>
<Command>python "$(ProjectDir)\..\build_scripts\make_version_header.py" "$(ProjectDir)</Command>
<Command>python "$(ProjectDir)\..\build_scripts\make_version_header.py" "$(ProjectDir)"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
Binary file modified cppcryptfs/res/en/Resources_EN.rc
Binary file not shown.
Binary file modified cppcryptfs/res/ru/Resources_RU.rc
Binary file not shown.
Binary file modified cppcryptfs/res/zh-CN/Resources_ZH-CN.rc
Binary file not shown.
2 changes: 2 additions & 0 deletions cppcryptfs/res/zh-CN/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@
#define IDS_MEMORY_ALLOCATION_FAILURE 657
#define IDS_APLLY_LANGUAGE_RESTART 688
#define IDS_LANGUAGE_NAME 704
#define IDS_CHACHA_REQUIRES_HKDF 705
#define IDS_CHACHA_AESSIV_CONFLICT 706
#define IDR_LICENSE_CPPCRYPTFS 800
#define IDR_LICENSE_OPENSSL 801
#define IDR_LICENSE_RAPIDJSON 802
Expand Down
Binary file modified cppcryptfs/resource.h
Binary file not shown.
9 changes: 7 additions & 2 deletions cppcryptfs/ui/CreatePropertyPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ THE SOFTWARE.

static const WCHAR *data_encryption_types[] = {
L"AES256-GCM",
L"AES256-SIV"
L"AES256-SIV",
L"XChaCha20-Poly1305"
};

#define AES256_GCM_INDEX 0
#define AES256_SIV_INDEX 1
#define AES256_CHACHA_INDEX 2

#define NUM_DATA_ENC_TYPES (sizeof(data_encryption_types)/sizeof(data_encryption_types[0]))

Expand Down Expand Up @@ -182,6 +184,7 @@ void CCreatePropertyPage::CreateCryptfs()


bool siv = false;
bool chacha = false;
bool eme = false;
bool plaintext = false;
bool longfilenames = false;
Expand Down Expand Up @@ -230,6 +233,8 @@ void CCreatePropertyPage::CreateCryptfs()

if (cfenc == L"AES256-SIV")
siv = true;
else if (cfenc == L"XChaCha20-Poly1305")
chacha = true;

CString volume_name;
GetDlgItemText(IDC_VOLUME_NAME, volume_name);
Expand All @@ -245,7 +250,7 @@ void CCreatePropertyPage::CreateCryptfs()
const int scryptN = stoi((LPCTSTR)sel);

theApp.DoWaitCursor(1);
bool bResult = config.create(cpath, config_path, password.m_buf, eme, plaintext, longfilenames, siv, reverse, scryptN, volume_name, disablestreams, longnamemax, deterministicnames, error_mes);
bool bResult = config.create(cpath, config_path, password.m_buf, eme, plaintext, longfilenames, siv, chacha, reverse, scryptN, volume_name, disablestreams, longnamemax, deterministicnames, error_mes);
theApp.DoWaitCursor(-1);

if (!bResult) {
Expand Down
15 changes: 10 additions & 5 deletions cppcryptfs/ui/locutils.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#include "locutils.h"
#define VC_EXTRALEAN
#include <atlstr.h>
#include <windows.h>

// Load a string resource from the current module (the final EXE).
// Equivalent to MFC/ATL's CString::LoadString but without the ATL/MFC
// dependency, so it can be built on CI images that lack ATL.
// LoadStringW reads at most 255 characters per call; resources longer
// than that are truncated, but all resources here are short enough.
std::wstring LocUtils::GetStringFromResources(unsigned int nID) {
ATL::CStringW str;
if (str.LoadString(nID)) {
return std::wstring((LPCWSTR)str);
wchar_t buf[256];
int len = LoadStringW(GetModuleHandle(nullptr), nID, buf, _countof(buf));
if (len > 0) {
return std::wstring(buf, static_cast<size_t>(len));
}
return L"";
}
15 changes: 13 additions & 2 deletions cppcryptfsctl/cppcryptfsctl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ static int do_self_args(int argc, wchar_t* const argv[])

bool siv = false;

bool chacha = false;

bool do_version = false;

bool do_help = false;
Expand Down Expand Up @@ -194,6 +196,7 @@ static int do_self_args(int argc, wchar_t* const argv[])
{L"streams", required_argument, 0, 'b'},
{L"volumename", required_argument, 0, 'V'},
{L"siv", no_argument, 0, 'S'},
{L"chacha", no_argument, 0, 'X'},
{L"version", no_argument, 0, 'v' },
{L"help", no_argument, 0, 'h'},
{L"password", required_argument, 0, 'p'},
Expand All @@ -206,7 +209,7 @@ static int do_self_args(int argc, wchar_t* const argv[])
};

while (true) {
c = getopt_long(argc, argv, L"p:dI:c:sTL:b:V:Svh0:1:2:3:4:", long_options, &option_index);
c = getopt_long(argc, argv, L"p:dI:c:sTL:b:V:SXvh0:1:2:3:4:", long_options, &option_index);

if (c == -1)
break;
Expand Down Expand Up @@ -276,6 +279,9 @@ static int do_self_args(int argc, wchar_t* const argv[])
case 'S':
siv = true;
break;
case 'X':
chacha = true;
break;
case 'v':
do_version = true;
break;
Expand Down Expand Up @@ -319,6 +325,11 @@ static int do_self_args(int argc, wchar_t* const argv[])
}
}

if (chacha && reverse) {
wcerr << L"XChaCha20-Poly1305 cannot be used with reverse mode (reverse implies AES256-SIV)." << endl;
return 1;
}

if (do_version) {
wstring prod, ver, copyright;
GetProductVersionInfo(prod, ver, copyright);
Expand Down Expand Up @@ -371,7 +382,7 @@ static int do_self_args(int argc, wchar_t* const argv[])
return 1;
}

bool result = config.create(fs_path.c_str(), config_path.c_str(), password.m_buf, !plaintext_names, plaintext_names, longnames, reverse || siv, reverse, scryptn ? scryptn : DEFAULT_SCRYPTN, volume_name.c_str(), !streams, longnamemax, deterministicnames, mes);
bool result = config.create(fs_path.c_str(), config_path.c_str(), password.m_buf, !plaintext_names, plaintext_names, longnames, reverse || siv, chacha, reverse, scryptn ? scryptn : DEFAULT_SCRYPTN, volume_name.c_str(), !streams, longnamemax, deterministicnames, mes);

if (!result) {
wcerr << mes << endl;
Expand Down
Loading