diff options
-rw-r--r-- | src/Main/Forms/ChangePasswordDialog.cpp | 7 | ||||
-rw-r--r-- | src/Main/Forms/MountOptionsDialog.cpp | 6 | ||||
-rw-r--r-- | src/Main/Forms/VolumePasswordPanel.cpp | 10 | ||||
-rw-r--r-- | src/Main/Forms/VolumePasswordPanel.h | 1 | ||||
-rw-r--r-- | src/Volume/Volume.h | 27 |
5 files changed, 51 insertions, 0 deletions
diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp index ac8e8147..5b2fdd04 100644 --- a/src/Main/Forms/ChangePasswordDialog.cpp +++ b/src/Main/Forms/ChangePasswordDialog.cpp | |||
@@ -24,6 +24,12 @@ namespace VeraCrypt | |||
24 | bool enableNewPassword = false; | 24 | bool enableNewPassword = false; |
25 | bool enableNewKeyfiles = false; | 25 | bool enableNewKeyfiles = false; |
26 | bool enablePkcs5Prf = false; | 26 | bool enablePkcs5Prf = false; |
27 | bool isTrueCryptFile = false; | ||
28 | |||
29 | if (volumePath && volumePath->HasTrueCryptExtension ()) | ||
30 | { | ||
31 | isTrueCryptFile = true; | ||
32 | } | ||
27 | 33 | ||
28 | switch (mode) | 34 | switch (mode) |
29 | { | 35 | { |
@@ -54,6 +60,7 @@ namespace VeraCrypt | |||
54 | 60 | ||
55 | CurrentPasswordPanel = new VolumePasswordPanel (this, NULL, password, false, keyfiles, false, true, true, false, true, true); | 61 | CurrentPasswordPanel = new VolumePasswordPanel (this, NULL, password, false, keyfiles, false, true, true, false, true, true); |
56 | CurrentPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate)); | 62 | CurrentPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate)); |
63 | CurrentPasswordPanel->SetTrueCryptMode (isTrueCryptFile); | ||
57 | CurrentPasswordPanelSizer->Add (CurrentPasswordPanel, 1, wxALL | wxEXPAND); | 64 | CurrentPasswordPanelSizer->Add (CurrentPasswordPanel, 1, wxALL | wxEXPAND); |
58 | 65 | ||
59 | NewPasswordPanel = new VolumePasswordPanel (this, NULL, newPassword, true, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf); | 66 | NewPasswordPanel = new VolumePasswordPanel (this, NULL, newPassword, true, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf); |
diff --git a/src/Main/Forms/MountOptionsDialog.cpp b/src/Main/Forms/MountOptionsDialog.cpp index c6b47fd5..c7a853c2 100644 --- a/src/Main/Forms/MountOptionsDialog.cpp +++ b/src/Main/Forms/MountOptionsDialog.cpp | |||
@@ -36,6 +36,12 @@ namespace VeraCrypt | |||
36 | 36 | ||
37 | PasswordPanel = new VolumePasswordPanel (this, &options, options.Password, disableMountOptions, options.Keyfiles, !disableMountOptions, true, true, false, true, true); | 37 | PasswordPanel = new VolumePasswordPanel (this, &options, options.Password, disableMountOptions, options.Keyfiles, !disableMountOptions, true, true, false, true, true); |
38 | PasswordPanel->SetCacheCheckBoxValidator (wxGenericValidator (&Options.CachePassword)); | 38 | PasswordPanel->SetCacheCheckBoxValidator (wxGenericValidator (&Options.CachePassword)); |
39 | |||
40 | if (options.Path && options.Path->HasTrueCryptExtension() && !disableMountOptions | ||
41 | && !options.TrueCryptMode && (options.Pim <= 0)) | ||
42 | { | ||
43 | PasswordPanel->SetTrueCryptMode (true); | ||
44 | } | ||
39 | 45 | ||
40 | PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND); | 46 | PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND); |
41 | 47 | ||
diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp index 920d4f96..3ec6aedb 100644 --- a/src/Main/Forms/VolumePasswordPanel.cpp +++ b/src/Main/Forms/VolumePasswordPanel.cpp | |||
@@ -306,6 +306,16 @@ namespace VeraCrypt | |||
306 | { | 306 | { |
307 | return TrueCryptModeCheckBox->GetValue (); | 307 | return TrueCryptModeCheckBox->GetValue (); |
308 | } | 308 | } |
309 | |||
310 | void VolumePasswordPanel::SetTrueCryptMode (bool trueCryptMode) | ||
311 | { | ||
312 | bool bEnablePIM = !trueCryptMode; | ||
313 | TrueCryptModeCheckBox->SetValue (trueCryptMode); | ||
314 | PimCheckBox->Enable (bEnablePIM); | ||
315 | VolumePimStaticText->Enable (bEnablePIM); | ||
316 | VolumePimTextCtrl->Enable (bEnablePIM); | ||
317 | VolumePimHelpStaticText->Enable (bEnablePIM); | ||
318 | } | ||
309 | 319 | ||
310 | int VolumePasswordPanel::GetHeaderWipeCount () const | 320 | int VolumePasswordPanel::GetHeaderWipeCount () const |
311 | { | 321 | { |
diff --git a/src/Main/Forms/VolumePasswordPanel.h b/src/Main/Forms/VolumePasswordPanel.h index e692d447..a3ed2a6f 100644 --- a/src/Main/Forms/VolumePasswordPanel.h +++ b/src/Main/Forms/VolumePasswordPanel.h | |||
@@ -32,6 +32,7 @@ namespace VeraCrypt | |||
32 | shared_ptr <Pkcs5Kdf> GetPkcs5Kdf (bool bTrueCryptMode, bool &bUnsupportedKdf) const; | 32 | shared_ptr <Pkcs5Kdf> GetPkcs5Kdf (bool bTrueCryptMode, bool &bUnsupportedKdf) const; |
33 | int GetVolumePim () const; | 33 | int GetVolumePim () const; |
34 | bool GetTrueCryptMode () const; | 34 | bool GetTrueCryptMode () const; |
35 | void SetTrueCryptMode (bool trueCryptMode); | ||
35 | int GetHeaderWipeCount () const; | 36 | int GetHeaderWipeCount () const; |
36 | void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); } | 37 | void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); } |
37 | void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); } | 38 | void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); } |
diff --git a/src/Volume/Volume.h b/src/Volume/Volume.h index 30373ca1..620d0077 100644 --- a/src/Volume/Volume.h +++ b/src/Volume/Volume.h | |||
@@ -39,6 +39,33 @@ namespace VeraCrypt | |||
39 | 39 | ||
40 | bool IsDevice () const { return FilesystemPath (Data).IsBlockDevice() || FilesystemPath (Data).IsCharacterDevice(); } | 40 | bool IsDevice () const { return FilesystemPath (Data).IsBlockDevice() || FilesystemPath (Data).IsCharacterDevice(); } |
41 | bool IsEmpty () const { return Data.empty(); } | 41 | bool IsEmpty () const { return Data.empty(); } |
42 | |||
43 | wstring GetExtension () const | ||
44 | { | ||
45 | if (Data.empty() || (Data.size() == 1)) | ||
46 | return L""; | ||
47 | else | ||
48 | { | ||
49 | size_t pos = Data.find_last_of (L'.'); | ||
50 | if (pos == string::npos) | ||
51 | return L""; | ||
52 | return Data.substr (pos + 1); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | bool HasTrueCryptExtension () const | ||
57 | { | ||
58 | wstring sExt = GetExtension (); | ||
59 | if ((sExt.size () == 2) | ||
60 | && (sExt[0] == L't' || sExt[0] == L'T') | ||
61 | && (sExt[1] == L'c' || sExt[1] == L'C') | ||
62 | ) | ||
63 | { | ||
64 | return true; | ||
65 | } | ||
66 | else | ||
67 | return false; | ||
68 | } | ||
42 | 69 | ||
43 | protected: | 70 | protected: |
44 | wstring Data; | 71 | wstring Data; |