/src/clamav/libclamunrar/secpassword.hpp
Line | Count | Source |
1 | | #ifndef _RAR_SECURE_PASSWORD_ |
2 | | #define _RAR_SECURE_PASSWORD_ |
3 | | |
4 | | // Store a password securely (if data encryption is provided by OS) |
5 | | // or obfuscated to make search for password in memory dump less trivial. |
6 | | class SecPassword |
7 | | { |
8 | | private: |
9 | | void Process(const wchar *Src,size_t SrcSize,wchar *Dst,size_t DstSize,bool Encode); |
10 | | |
11 | | std::vector<wchar> Password = std::vector<wchar>(MAXPASSWORD); |
12 | | bool PasswordSet; |
13 | | public: |
14 | | SecPassword(); |
15 | | ~SecPassword(); |
16 | | void Clean(); |
17 | | void Get(wchar *Psw,size_t MaxSize); |
18 | | void Set(const wchar *Psw); |
19 | 1.08M | bool IsSet() {return PasswordSet;} |
20 | | size_t Length(); |
21 | | bool operator == (SecPassword &psw); |
22 | | }; |
23 | | |
24 | | |
25 | | void cleandata(void *data,size_t size); |
26 | | void SecHideData(void *Data,size_t DataSize,bool Encode,bool CrossProcess); |
27 | | |
28 | | #endif |