mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-05-29 16:00:22 +00:00
Linux/MacOSX: Implement Unicode passwords suppport. Make validation of parameters in GUI more robust.
This commit is contained in:
@@ -22,10 +22,8 @@ namespace VeraCrypt
|
||||
{
|
||||
public:
|
||||
VolumePassword ();
|
||||
VolumePassword (const byte *password, size_t size);
|
||||
VolumePassword (const char *password, size_t size);
|
||||
VolumePassword (const wchar_t *password, size_t charCount);
|
||||
VolumePassword (const wstring &password);
|
||||
VolumePassword (const byte *password, size_t size) { Set (password, size); }
|
||||
VolumePassword (const SecureBuffer &password) { Set (password.Ptr (), password.Size ()); }
|
||||
VolumePassword (const VolumePassword &password) { Set (password); }
|
||||
virtual ~VolumePassword ();
|
||||
|
||||
@@ -35,13 +33,10 @@ namespace VeraCrypt
|
||||
|
||||
operator BufferPtr () const { return BufferPtr (PasswordBuffer); }
|
||||
|
||||
void CheckPortability () const;
|
||||
byte *DataPtr () const { return PasswordBuffer; }
|
||||
bool IsEmpty () const { return PasswordSize == 0; }
|
||||
size_t Size () const { return PasswordSize; }
|
||||
void Set (const byte *password, size_t size);
|
||||
void Set (const wchar_t *password, size_t charCount);
|
||||
void Set (const ConstBufferPtr &password);
|
||||
void Set (const VolumePassword &password);
|
||||
|
||||
TC_SERIALIZABLE (VolumePassword);
|
||||
@@ -51,12 +46,10 @@ namespace VeraCrypt
|
||||
|
||||
protected:
|
||||
void AllocateBuffer ();
|
||||
bool IsPortable () const;
|
||||
|
||||
SecureBuffer PasswordBuffer;
|
||||
|
||||
size_t PasswordSize;
|
||||
bool Unportable;
|
||||
};
|
||||
|
||||
struct PasswordException : public Exception
|
||||
@@ -86,6 +79,8 @@ namespace VeraCrypt
|
||||
TC_EXCEPTION_NODECL (ProtectionPasswordKeyfilesIncorrect); \
|
||||
TC_EXCEPTION (PasswordEmpty); \
|
||||
TC_EXCEPTION (PasswordTooLong); \
|
||||
TC_EXCEPTION (PasswordUTF8TooLong); \
|
||||
TC_EXCEPTION (PasswordUTF8Invalid); \
|
||||
TC_EXCEPTION (UnportablePassword);
|
||||
|
||||
TC_EXCEPTION_SET;
|
||||
|
||||
Reference in New Issue
Block a user