VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/UserInterface.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-11-03 22:54:23 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-11-04 00:09:52 +0100
commita7d5b6a4774c92736c89e8d6122b13c75c8d17c8 (patch)
tree23d04cec3780b028473695ffaeb1c264e4dab901 /src/Main/UserInterface.cpp
parent8fb7742dadedcae9cc57f08460d44418f0735ec5 (diff)
downloadVeraCrypt-a7d5b6a4774c92736c89e8d6122b13c75c8d17c8.tar.gz
VeraCrypt-a7d5b6a4774c92736c89e8d6122b13c75c8d17c8.zip
Linux/MacOSX: Add switch to force the use of legacy maximum password length (64 UTF8 bytes)
The switch is --legacy-password-maxlength
Diffstat (limited to 'src/Main/UserInterface.cpp')
-rw-r--r--src/Main/UserInterface.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp
index ebad35da..7c29bbe0 100644
--- a/src/Main/UserInterface.cpp
+++ b/src/Main/UserInterface.cpp
@@ -464,6 +464,7 @@ namespace VeraCrypt
EX2MSG (PasswordOrMountOptionsIncorrect, LangString["PASSWORD_OR_KEYFILE_OR_MODE_WRONG"] + _("\n\nNote: If you are attempting to mount a partition located on an encrypted system drive without pre-boot authentication or to mount the encrypted system partition of an operating system that is not running, you can do so by selecting 'Options >' > 'Mount partition using system encryption'."));
EX2MSG (PasswordTooLong, StringFormatter (_("Password is longer than {0} characters."), (int) VolumePassword::MaxSize));
EX2MSG (PasswordUTF8TooLong, LangString["PASSWORD_UTF8_TOO_LONG"]);
+ EX2MSG (PasswordLegacyUTF8TooLong, LangString["LEGACY_PASSWORD_UTF8_TOO_LONG"]);
EX2MSG (PasswordUTF8Invalid, LangString["PASSWORD_UTF8_INVALID"]);
EX2MSG (PartitionDeviceRequired, _("Partition device required."));
EX2MSG (ProtectionPasswordIncorrect, _("Incorrect password to the protected hidden volume or the hidden volume does not exist."));
@@ -908,7 +909,8 @@ namespace VeraCrypt
wstring pwdInput;
getline(wcin, pwdInput);
- cmdLine.ArgPassword = ToUTF8Password ( pwdInput.c_str (), pwdInput.size ());
+ size_t maxUtf8Len = cmdLine.ArgUseLegacyPassword? VolumePassword::MaxLegacySize : VolumePassword::MaxSize;
+ cmdLine.ArgPassword = ToUTF8Password ( pwdInput.c_str (), pwdInput.size (), maxUtf8Len);
}
switch (cmdLine.ArgCommand)
@@ -1575,6 +1577,7 @@ namespace VeraCrypt
VC_CONVERT_EXCEPTION (PasswordEmpty);
VC_CONVERT_EXCEPTION (PasswordTooLong);
VC_CONVERT_EXCEPTION (PasswordUTF8TooLong);
+ VC_CONVERT_EXCEPTION (PasswordLegacyUTF8TooLong);
VC_CONVERT_EXCEPTION (PasswordUTF8Invalid);
VC_CONVERT_EXCEPTION (UnportablePassword);
VC_CONVERT_EXCEPTION (ElevationFailed);