| 853 | |
| 854 | |
| 855 | bool CryptConfig::create(const WCHAR *path, const WCHAR *specified_config_file_path, const WCHAR *password, bool eme, bool plaintext, bool longfilenames, bool siv, bool reverse, int scryptN, const WCHAR *volume_name, bool disablestreams, int longnamemax, bool deterministicnames, wstring& error_mes) |
| 856 | { |
| 857 | |
| 858 | if (specified_config_file_path && *specified_config_file_path == '\0') |
| 859 | specified_config_file_path = NULL; |
| 860 | |
| 861 | m_basedir = path; |
| 862 | |
| 863 | bool bret = true; |
| 864 | |
| 865 | if (eme) |
| 866 | m_EMENames = TRUE; |
| 867 | else if (plaintext) |
| 868 | m_PlaintextNames = TRUE; |
| 869 | |
| 870 | if (!m_PlaintextNames) |
| 871 | m_LongNames = longfilenames; |
| 872 | |
| 873 | if (m_LongNames) |
| 874 | m_LongNameMax = longnamemax; |
| 875 | |
| 876 | if (siv) |
| 877 | m_AESSIV = true; |
| 878 | |
| 879 | // Raw64 defaults to true, but must be disabled if PlaintextNames is active |
| 880 | // (PlaintextNames implies filenames are not encrypted, so Base64 encoding is conflicting) |
| 881 | m_Raw64 = !m_PlaintextNames; |
| 882 | |
| 883 | // HKDF default to true |
| 884 | m_HKDF = true; |
| 885 | |
| 886 | if (reverse) |
| 887 | m_reverse = true; |
| 888 | |
| 889 | try { |
| 890 | |
| 891 | string fs_feature_disable_mask = disablestreams ? "40000" : "00000"; |
| 892 | |
| 893 | wstring config_path; |
| 894 | |
| 895 | if (specified_config_file_path) { |
| 896 | config_path = specified_config_file_path; |
| 897 | } else { |
| 898 | |
| 899 | config_path = m_basedir; |
| 900 | |
| 901 | if (config_path[config_path.size() - 1] != '\\') |
| 902 | config_path.push_back('\\'); |
| 903 | |
| 904 | config_path += m_reverse ? REVERSE_CONFIG_NAME : CONFIG_NAME; |
| 905 | |
| 906 | } |
| 907 | |
| 908 | if (m_reverse && !m_AESSIV) { |
| 909 | error_mes = LocUtils::GetStringFromResources(IDS_ONLY_AES256SIV_WITH_REVERSE); |
| 910 | throw(-1); |
| 911 | } |
| 912 |
no test coverage detected