unrarsrc  6.1.7
About: unrar extracts, views and tests the contents of archives created with the RAR archiver.
  Fossies Dox: unrarsrc-6.1.7.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

secpassword.hpp
Go to the documentation of this file.
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.
7{
8 private:
9 void Process(const wchar *Src,size_t SrcSize,wchar *Dst,size_t DstSize,bool Encode);
10
12
13 // It is important to have this 'bool' value, so if our object is cleaned
14 // with memset as a part of larger structure, it is handled correctly.
16 public:
19 void Clean();
20 void Get(wchar *Psw,size_t MaxSize);
21 void Set(const wchar *Psw);
22 bool IsSet() {return PasswordSet;}
23 size_t Length();
24 bool operator == (SecPassword &psw);
25
26 // Set to true if we need to pass a password to another process.
27 // We use it when transferring parameters to UAC elevated WinRAR.
29};
30
31
32void cleandata(void *data,size_t size);
33void SecHideData(void *Data,size_t DataSize,bool Encode,bool CrossProcess);
34
35#endif
bool PasswordSet
Definition: secpassword.hpp:15
void Set(const wchar *Psw)
size_t Length()
void Clean()
Definition: secpassword.cpp:70
bool operator==(SecPassword &psw)
bool IsSet()
Definition: secpassword.hpp:22
wchar Password[MAXPASSWORD]
Definition: secpassword.hpp:11
void Process(const wchar *Src, size_t SrcSize, wchar *Dst, size_t DstSize, bool Encode)
bool CrossProcess
Definition: secpassword.hpp:28
void Get(wchar *Psw, size_t MaxSize)
#define MAXPASSWORD
Definition: rardefs.hpp:14
wchar_t wchar
Definition: rartypes.hpp:13
void SecHideData(void *Data, size_t DataSize, bool Encode, bool CrossProcess)
void cleandata(void *data, size_t size)
Definition: secpassword.cpp:80