| 1046 | } |
| 1047 | |
| 1048 | const WCHAR * // returns base64-encoded, encrypted stream name. input stream name is expected to start with colon |
| 1049 | encrypt_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 | |
| 1081 | const WCHAR * // returns UNICODE plaintext stream name. input stream name is expected to start with colon |
| 1082 | decrypt_stream_name(CryptContext *con, const BYTE *dir_iv, const WCHAR *stream, wstring& storage) |
no test coverage detected