MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / encrypt_stream_name

Function encrypt_stream_name

libcppcryptfs/filename/cryptfilename.cpp:1048–1079  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1046}
1047
1048const WCHAR * // returns base64-encoded, encrypted stream name. input stream name is expected to start with colon
1049encrypt_stream_name(const CryptContext *con, const unsigned char *dir_iv, const WCHAR *stream, wstring& storage)
1050{
1051
1052 if (!stream || stream[0] != ':')
1053 return NULL;
1054
1055 wstring stream_without_type;
1056 wstring type;
1057
1058 if (!remove_stream_type(stream, stream_without_type, type))
1059 return NULL;
1060
1061 LPCWSTR rs;
1062
1063 if (stream_without_type.length() > 1) {
1064 rs = encrypt_filename(con, dir_iv, stream_without_type.c_str() + 1, storage, NULL);
1065 } else {
1066 storage = L"";
1067 rs = storage.c_str();
1068 }
1069
1070 if (!rs)
1071 return NULL;
1072
1073 if (is_long_name(rs))
1074 return NULL;
1075
1076 storage = L":" + storage + type;
1077
1078 return storage.c_str();
1079}
1080
1081const WCHAR * // returns UNICODE plaintext stream name. input stream name is expected to start with colon
1082decrypt_stream_name(CryptContext *con, const BYTE *dir_iv, const WCHAR *stream, wstring& storage)

Callers 2

convert_find_stream_dataFunction · 0.85
encrypt_filenameFunction · 0.85

Calls 3

remove_stream_typeFunction · 0.85
encrypt_filenameFunction · 0.85
is_long_nameFunction · 0.85

Tested by

no test coverage detected