mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 19:08:26 -06:00
Linux & MacOSX: automatically check TrueCryptMode in password dialog when selecting a container file that has the .tc file extension
This commit is contained in:
@@ -24,6 +24,12 @@ namespace VeraCrypt
|
|||||||
bool enableNewPassword = false;
|
bool enableNewPassword = false;
|
||||||
bool enableNewKeyfiles = false;
|
bool enableNewKeyfiles = false;
|
||||||
bool enablePkcs5Prf = false;
|
bool enablePkcs5Prf = false;
|
||||||
|
bool isTrueCryptFile = false;
|
||||||
|
|
||||||
|
if (volumePath && volumePath->HasTrueCryptExtension ())
|
||||||
|
{
|
||||||
|
isTrueCryptFile = true;
|
||||||
|
}
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
@@ -54,6 +60,7 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
CurrentPasswordPanel = new VolumePasswordPanel (this, NULL, password, false, keyfiles, false, true, true, false, true, true);
|
CurrentPasswordPanel = new VolumePasswordPanel (this, NULL, password, false, keyfiles, false, true, true, false, true, true);
|
||||||
CurrentPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate));
|
CurrentPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate));
|
||||||
|
CurrentPasswordPanel->SetTrueCryptMode (isTrueCryptFile);
|
||||||
CurrentPasswordPanelSizer->Add (CurrentPasswordPanel, 1, wxALL | wxEXPAND);
|
CurrentPasswordPanelSizer->Add (CurrentPasswordPanel, 1, wxALL | wxEXPAND);
|
||||||
|
|
||||||
NewPasswordPanel = new VolumePasswordPanel (this, NULL, newPassword, true, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf);
|
NewPasswordPanel = new VolumePasswordPanel (this, NULL, newPassword, true, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf);
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ namespace VeraCrypt
|
|||||||
PasswordPanel = new VolumePasswordPanel (this, &options, options.Password, disableMountOptions, options.Keyfiles, !disableMountOptions, true, true, false, true, true);
|
PasswordPanel = new VolumePasswordPanel (this, &options, options.Password, disableMountOptions, options.Keyfiles, !disableMountOptions, true, true, false, true, true);
|
||||||
PasswordPanel->SetCacheCheckBoxValidator (wxGenericValidator (&Options.CachePassword));
|
PasswordPanel->SetCacheCheckBoxValidator (wxGenericValidator (&Options.CachePassword));
|
||||||
|
|
||||||
|
if (options.Path && options.Path->HasTrueCryptExtension() && !disableMountOptions
|
||||||
|
&& !options.TrueCryptMode && (options.Pim <= 0))
|
||||||
|
{
|
||||||
|
PasswordPanel->SetTrueCryptMode (true);
|
||||||
|
}
|
||||||
|
|
||||||
PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);
|
PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
|
|||||||
@@ -307,6 +307,16 @@ namespace VeraCrypt
|
|||||||
return TrueCryptModeCheckBox->GetValue ();
|
return TrueCryptModeCheckBox->GetValue ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VolumePasswordPanel::SetTrueCryptMode (bool trueCryptMode)
|
||||||
|
{
|
||||||
|
bool bEnablePIM = !trueCryptMode;
|
||||||
|
TrueCryptModeCheckBox->SetValue (trueCryptMode);
|
||||||
|
PimCheckBox->Enable (bEnablePIM);
|
||||||
|
VolumePimStaticText->Enable (bEnablePIM);
|
||||||
|
VolumePimTextCtrl->Enable (bEnablePIM);
|
||||||
|
VolumePimHelpStaticText->Enable (bEnablePIM);
|
||||||
|
}
|
||||||
|
|
||||||
int VolumePasswordPanel::GetHeaderWipeCount () const
|
int VolumePasswordPanel::GetHeaderWipeCount () const
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace VeraCrypt
|
|||||||
shared_ptr <Pkcs5Kdf> GetPkcs5Kdf (bool bTrueCryptMode, bool &bUnsupportedKdf) const;
|
shared_ptr <Pkcs5Kdf> GetPkcs5Kdf (bool bTrueCryptMode, bool &bUnsupportedKdf) const;
|
||||||
int GetVolumePim () const;
|
int GetVolumePim () const;
|
||||||
bool GetTrueCryptMode () const;
|
bool GetTrueCryptMode () const;
|
||||||
|
void SetTrueCryptMode (bool trueCryptMode);
|
||||||
int GetHeaderWipeCount () const;
|
int GetHeaderWipeCount () const;
|
||||||
void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); }
|
void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); }
|
||||||
void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); }
|
void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); }
|
||||||
|
|||||||
@@ -40,6 +40,33 @@ namespace VeraCrypt
|
|||||||
bool IsDevice () const { return FilesystemPath (Data).IsBlockDevice() || FilesystemPath (Data).IsCharacterDevice(); }
|
bool IsDevice () const { return FilesystemPath (Data).IsBlockDevice() || FilesystemPath (Data).IsCharacterDevice(); }
|
||||||
bool IsEmpty () const { return Data.empty(); }
|
bool IsEmpty () const { return Data.empty(); }
|
||||||
|
|
||||||
|
wstring GetExtension () const
|
||||||
|
{
|
||||||
|
if (Data.empty() || (Data.size() == 1))
|
||||||
|
return L"";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size_t pos = Data.find_last_of (L'.');
|
||||||
|
if (pos == string::npos)
|
||||||
|
return L"";
|
||||||
|
return Data.substr (pos + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HasTrueCryptExtension () const
|
||||||
|
{
|
||||||
|
wstring sExt = GetExtension ();
|
||||||
|
if ((sExt.size () == 2)
|
||||||
|
&& (sExt[0] == L't' || sExt[0] == L'T')
|
||||||
|
&& (sExt[1] == L'c' || sExt[1] == L'C')
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wstring Data;
|
wstring Data;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user