From efa436974d8203485eec6faa1bf0116bb32f6fcd Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 30 Nov 2015 11:35:41 +0100 Subject: Linux/MacOSX: Implement Unicode passwords suppport. Make validation of parameters in GUI more robust. --- src/Volume/VolumePassword.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/Volume/VolumePassword.h') diff --git a/src/Volume/VolumePassword.h b/src/Volume/VolumePassword.h index bf10eb98..ff7479a5 100644 --- a/src/Volume/VolumePassword.h +++ b/src/Volume/VolumePassword.h @@ -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; -- cgit v1.2.3