| 962 | } |
| 963 | |
| 964 | bool |
| 965 | get_actual_encrypted(CryptContext *con, LPCWSTR FileName, string& actual_encrypted) |
| 966 | { |
| 967 | |
| 968 | wstring encrypted_name; |
| 969 | |
| 970 | if (!get_bare_filename(FileName, encrypted_name)) |
| 971 | return false; |
| 972 | |
| 973 | wstring base64_hash; |
| 974 | |
| 975 | if (extract_lfn_base64_hash(&encrypted_name[0], base64_hash)) { |
| 976 | if (con->m_lfn_cache.lookup(&base64_hash[0], NULL, &actual_encrypted)) { |
| 977 | return true; |
| 978 | } |
| 979 | } |
| 980 | |
| 981 | wstring dirpath; |
| 982 | wstring decrypted_name; |
| 983 | |
| 984 | BYTE dir_iv[DIR_IV_LEN]; |
| 985 | |
| 986 | if (!get_file_directory(FileName, dirpath)) |
| 987 | return false; |
| 988 | |
| 989 | if (!derive_path_iv(con, &dirpath[0], dir_iv, TYPE_DIRIV)) |
| 990 | return false; |
| 991 | |
| 992 | //encrypted_name = encrypted_name.substr(0, encrypted_name.length() - sizeof(LONGNAME_SUFFIX_W) / sizeof(WCHAR) - 1); |
| 993 | |
| 994 | if (!decrypt_filename(con, dir_iv, &dirpath[0], &encrypted_name[0], decrypted_name)) |
| 995 | return false; |
| 996 | |
| 997 | if (!encrypt_filename(con, dir_iv, &decrypted_name[0], encrypted_name, &actual_encrypted)) |
| 998 | return false; |
| 999 | |
| 1000 | return true; |
| 1001 | } |
| 1002 | |
| 1003 | bool |
| 1004 | get_bare_filename(LPCWSTR filepath, wstring& filename) |
no test coverage detected