| 42 | class CryptContext; |
| 43 | |
| 44 | class CryptConfig |
| 45 | { |
| 46 | public: |
| 47 | int m_N; |
| 48 | int m_R; |
| 49 | int m_P; |
| 50 | |
| 51 | bool m_PlaintextNames; |
| 52 | KeybufManager m_keybuf_manager; |
| 53 | private: |
| 54 | LockZeroBuffer<unsigned char> *m_pKeyBuf; |
| 55 | LockZeroBuffer<BYTE> *m_pGcmContentKey; |
| 56 | bool m_DirIV; |
| 57 | unsigned long long scrypt_mem(); |
| 58 | public: |
| 59 | wstring m_configPath; |
| 60 | bool DirIV() { return m_DirIV; }; |
| 61 | bool m_EMENames; |
| 62 | bool m_GCMIV128; |
| 63 | bool m_LongNames; |
| 64 | bool m_AESSIV; |
| 65 | bool m_Raw64; |
| 66 | bool m_HKDF; |
| 67 | bool m_DenyAccessToOthers; |
| 68 | |
| 69 | bool m_reverse; |
| 70 | |
| 71 | int m_LongNameMax; |
| 72 | |
| 73 | int m_Version; |
| 74 | wstring m_VolumeName; |
| 75 | |
| 76 | vector<unsigned char> m_encrypted_key_salt; |
| 77 | vector<unsigned char> m_encrypted_key; |
| 78 | |
| 79 | |
| 80 | wstring m_basedir; // the real root of the fs |
| 81 | |
| 82 | DWORD m_serial; // windows volume serial number - derived from root diriv or from hash of root dir |
| 83 | |
| 84 | wstring m_mountpoint; |
| 85 | |
| 86 | const unsigned char *GetMasterKey() { return m_pKeyBuf ? m_pKeyBuf->m_buf : NULL; } |
| 87 | DWORD GetMasterKeyLength() { return m_pKeyBuf ? m_pKeyBuf->m_len : 0; } |
| 88 | const WCHAR *GetMountPoint() { return m_mountpoint.c_str(); } |
| 89 | const WCHAR *GetBaseDir() { return m_basedir.c_str(); } |
| 90 | bool InitGCMContentKey(const BYTE *key); |
| 91 | |
| 92 | const BYTE *GetGcmContentKey() { return m_HKDF ? m_pGcmContentKey->m_buf : GetMasterKey(); }; |
| 93 | |
| 94 | CryptConfig(); |
| 95 | bool read(wstring& mes, const WCHAR *config_file_path = NULL, bool reverse = false); |
| 96 | bool encrypt_key(const wchar_t* password, const BYTE *masterkey, string& base64encryptedmastekey, string& scryptSalt, wstring& error_mes); |
| 97 | bool decrypt_key(LPCTSTR password); |
| 98 | |
| 99 | bool create(const WCHAR* path, const WCHAR* specified_config_path, const WCHAR* password, bool eme, bool plaintext, bool longfilenames, |
| 100 | bool siv, bool reverse, int scryptN, const WCHAR* volume_name, bool disablestreams, int longnamemax, bool deterministicnames, wstring& error_mes |
| 101 | ); |
nothing calls this directly
no outgoing calls
no test coverage detected