mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 19:08:26 -06:00
Linux/MacOSX: use command line values of TrueCryptMode and PRF as defaults for the password dialog
This commit is contained in:
@@ -48,11 +48,11 @@ namespace VeraCrypt
|
|||||||
throw ParameterIncorrect (SRC_POS);
|
throw ParameterIncorrect (SRC_POS);
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentPasswordPanel = new VolumePasswordPanel (this, 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));
|
||||||
CurrentPasswordPanelSizer->Add (CurrentPasswordPanel, 1, wxALL | wxEXPAND);
|
CurrentPasswordPanelSizer->Add (CurrentPasswordPanel, 1, wxALL | wxEXPAND);
|
||||||
|
|
||||||
NewPasswordPanel = new VolumePasswordPanel (this, newPassword, true, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf);
|
NewPasswordPanel = new VolumePasswordPanel (this, NULL, newPassword, true, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf);
|
||||||
NewPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate));
|
NewPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate));
|
||||||
NewPasswordPanelSizer->Add (NewPasswordPanel, 1, wxALL | wxEXPAND);
|
NewPasswordPanelSizer->Add (NewPasswordPanel, 1, wxALL | wxEXPAND);
|
||||||
|
|
||||||
|
|||||||
@@ -664,6 +664,11 @@ namespace VeraCrypt
|
|||||||
MountOptions mountOptions (GetPreferences().DefaultMountOptions);
|
MountOptions mountOptions (GetPreferences().DefaultMountOptions);
|
||||||
mountOptions.SlotNumber = SelectedSlotNumber;
|
mountOptions.SlotNumber = SelectedSlotNumber;
|
||||||
mountOptions.Path = GetSelectedVolumePath();
|
mountOptions.Path = GetSelectedVolumePath();
|
||||||
|
mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode;
|
||||||
|
if (CmdLine->ArgHash)
|
||||||
|
{
|
||||||
|
mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, CmdLine->ArgTrueCryptMode);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -881,6 +886,11 @@ namespace VeraCrypt
|
|||||||
SetVolumePath (favorite.Path);
|
SetVolumePath (favorite.Path);
|
||||||
|
|
||||||
MountOptions mountOptions (GetPreferences().DefaultMountOptions);
|
MountOptions mountOptions (GetPreferences().DefaultMountOptions);
|
||||||
|
mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode;
|
||||||
|
if (CmdLine->ArgHash)
|
||||||
|
{
|
||||||
|
mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, CmdLine->ArgTrueCryptMode);
|
||||||
|
}
|
||||||
favorite.ToMountOptions (mountOptions);
|
favorite.ToMountOptions (mountOptions);
|
||||||
|
|
||||||
shared_ptr <VolumeInfo> volume = Gui->MountVolume (mountOptions);
|
shared_ptr <VolumeInfo> volume = Gui->MountVolume (mountOptions);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace VeraCrypt
|
|||||||
if (disableMountOptions)
|
if (disableMountOptions)
|
||||||
OptionsButton->Show (false);
|
OptionsButton->Show (false);
|
||||||
|
|
||||||
PasswordPanel = new VolumePasswordPanel (this, 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));
|
||||||
|
|
||||||
PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);
|
PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);
|
||||||
@@ -61,7 +61,7 @@ namespace VeraCrypt
|
|||||||
OptionsButton->SetLabel (OptionsButtonLabel + L" >");
|
OptionsButton->SetLabel (OptionsButtonLabel + L" >");
|
||||||
OptionsPanel->Show (false);
|
OptionsPanel->Show (false);
|
||||||
|
|
||||||
ProtectionPasswordPanel = new VolumePasswordPanel (OptionsPanel, options.ProtectionPassword, true, options.ProtectionKeyfiles, false, true, true, false, true, true, _("P&assword to hidden volume:"));
|
ProtectionPasswordPanel = new VolumePasswordPanel (OptionsPanel, &options, options.ProtectionPassword, true, options.ProtectionKeyfiles, false, true, true, false, true, true, _("P&assword to hidden volume:"));
|
||||||
ProtectionPasswordSizer->Add (ProtectionPasswordPanel, 1, wxALL | wxEXPAND);
|
ProtectionPasswordSizer->Add (ProtectionPasswordPanel, 1, wxALL | wxEXPAND);
|
||||||
|
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
namespace VeraCrypt
|
namespace VeraCrypt
|
||||||
{
|
{
|
||||||
VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache, bool enablePassword, bool enableKeyfiles, bool enableConfirmation, bool enablePkcs5Prf, bool isMountPassword, const wxString &passwordLabel)
|
VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache, bool enablePassword, bool enableKeyfiles, bool enableConfirmation, bool enablePkcs5Prf, bool isMountPassword, const wxString &passwordLabel)
|
||||||
: VolumePasswordPanelBase (parent), Keyfiles (new KeyfileList)
|
: VolumePasswordPanelBase (parent), Keyfiles (new KeyfileList)
|
||||||
{
|
{
|
||||||
if (keyfiles)
|
if (keyfiles)
|
||||||
@@ -67,8 +67,14 @@ namespace VeraCrypt
|
|||||||
HeaderWipeCountText->Show (enablePkcs5Prf && !isMountPassword);
|
HeaderWipeCountText->Show (enablePkcs5Prf && !isMountPassword);
|
||||||
HeaderWipeCount->Show (enablePkcs5Prf && !isMountPassword);
|
HeaderWipeCount->Show (enablePkcs5Prf && !isMountPassword);
|
||||||
|
|
||||||
|
if (options && !disableTruecryptMode)
|
||||||
|
{
|
||||||
|
TrueCryptModeCheckBox->SetValue (options->TrueCryptMode);
|
||||||
|
}
|
||||||
|
|
||||||
if (enablePkcs5Prf)
|
if (enablePkcs5Prf)
|
||||||
{
|
{
|
||||||
|
int index, prfInitialIndex = 0;
|
||||||
if (isMountPassword)
|
if (isMountPassword)
|
||||||
{
|
{
|
||||||
// case of password for mounting
|
// case of password for mounting
|
||||||
@@ -78,9 +84,17 @@ namespace VeraCrypt
|
|||||||
foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms(false))
|
foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms(false))
|
||||||
{
|
{
|
||||||
if (!kdf.IsDeprecated() || isMountPassword)
|
if (!kdf.IsDeprecated() || isMountPassword)
|
||||||
Pkcs5PrfChoice->Append (kdf.GetName());
|
{
|
||||||
|
index = Pkcs5PrfChoice->Append (kdf.GetName());
|
||||||
|
if (isMountPassword && options && options->Kdf
|
||||||
|
&& (options->Kdf->GetName() == kdf.GetName())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
prfInitialIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Pkcs5PrfChoice->Select (0);
|
Pkcs5PrfChoice->Select (prfInitialIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enablePkcs5Prf || (!enablePassword && !enableKeyfiles))
|
if (!enablePkcs5Prf || (!enablePassword && !enableKeyfiles))
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace VeraCrypt
|
|||||||
class VolumePasswordPanel : public VolumePasswordPanelBase
|
class VolumePasswordPanel : public VolumePasswordPanelBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VolumePasswordPanel (wxWindow* parent, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache = false, bool enablePassword = true, bool enableKeyfiles = true, bool enableConfirmation = false, bool enablePkcs5Prf = false, bool isMountPassword = false, const wxString &passwordLabel = wxString());
|
VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache = false, bool enablePassword = true, bool enableKeyfiles = true, bool enableConfirmation = false, bool enablePkcs5Prf = false, bool isMountPassword = false, const wxString &passwordLabel = wxString());
|
||||||
virtual ~VolumePasswordPanel ();
|
virtual ~VolumePasswordPanel ();
|
||||||
|
|
||||||
void AddKeyfile (shared_ptr <Keyfile> keyfile);
|
void AddKeyfile (shared_ptr <Keyfile> keyfile);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace VeraCrypt
|
|||||||
VolumePasswordWizardPage::VolumePasswordWizardPage (wxPanel* parent, shared_ptr <VolumePassword> password, shared_ptr <KeyfileList> keyfiles, bool enableConfirmation)
|
VolumePasswordWizardPage::VolumePasswordWizardPage (wxPanel* parent, shared_ptr <VolumePassword> password, shared_ptr <KeyfileList> keyfiles, bool enableConfirmation)
|
||||||
: VolumePasswordWizardPageBase (parent), ConfirmationMode (enableConfirmation)
|
: VolumePasswordWizardPageBase (parent), ConfirmationMode (enableConfirmation)
|
||||||
{
|
{
|
||||||
PasswordPanel = new VolumePasswordPanel (this, password, true, keyfiles, false, true, true, enableConfirmation, !enableConfirmation, !enableConfirmation);
|
PasswordPanel = new VolumePasswordPanel (this, NULL, password, true, keyfiles, false, true, true, enableConfirmation, !enableConfirmation, !enableConfirmation);
|
||||||
PasswordPanel->UpdateEvent.Connect (EventConnector <VolumePasswordWizardPage> (this, &VolumePasswordWizardPage::OnPasswordPanelUpdate));
|
PasswordPanel->UpdateEvent.Connect (EventConnector <VolumePasswordWizardPage> (this, &VolumePasswordWizardPage::OnPasswordPanelUpdate));
|
||||||
|
|
||||||
PasswordPanelSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);
|
PasswordPanelSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);
|
||||||
|
|||||||
Reference in New Issue
Block a user