diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-06-24 14:14:34 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-06-24 15:33:16 +0200 |
commit | 9913af3a8ed61333cafd0e611f214f7c86652423 (patch) | |
tree | bae9cbe7b95cb56df9d210cf32b44a0c15574ce8 /src/Main/Forms | |
parent | f927ce9b58b137846bb78a47f5a83f7261eac9ff (diff) | |
download | VeraCrypt-9913af3a8ed61333cafd0e611f214f7c86652423.tar.gz VeraCrypt-9913af3a8ed61333cafd0e611f214f7c86652423.zip |
Linux/MacOSX: first dynamic mode implementation
Diffstat (limited to 'src/Main/Forms')
-rwxr-xr-x[-rw-r--r--] | src/Main/Forms/ChangePasswordDialog.cpp | 36 | ||||
-rwxr-xr-x | src/Main/Forms/Forms.cpp | 36 | ||||
-rwxr-xr-x | src/Main/Forms/Forms.h | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Main/Forms/MountOptionsDialog.cpp | 2 | ||||
-rwxr-xr-x | src/Main/Forms/TrueCrypt.fbp | 288 | ||||
-rwxr-xr-x | src/Main/Forms/VolumeCreationWizard.cpp | 28 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Main/Forms/VolumeCreationWizard.h | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Main/Forms/VolumePasswordPanel.cpp | 32 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Main/Forms/VolumePasswordPanel.h | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Main/Forms/VolumePasswordWizardPage.h | 1 | ||||
-rw-r--r-- | src/Main/Forms/VolumePropertiesDialog.cpp | 5 |
11 files changed, 403 insertions, 33 deletions
diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp index d4a8853f..702b01e4 100644..100755 --- a/src/Main/Forms/ChangePasswordDialog.cpp +++ b/src/Main/Forms/ChangePasswordDialog.cpp @@ -90,20 +90,44 @@ namespace VeraCrypt } shared_ptr <VolumePassword> newPassword; + int newPim = 0; if (DialogMode == Mode::ChangePasswordAndKeyfiles) { newPassword = NewPasswordPanel->GetPassword(); + newPim = NewPasswordPanel->GetVolumePim(); newPassword->CheckPortability(); - if (newPassword->Size() > 0 && newPassword->Size() < VolumePassword::WarningSizeThreshold - && !Gui->AskYesNo (LangString ["PASSWORD_LENGTH_WARNING"], false, true)) + if (newPassword->Size() > 0) { - NewPasswordPanel->SetFocusToPasswordTextCtrl(); - return; + if (newPassword->Size() < VolumePassword::WarningSizeThreshold) + { + if (newPim < 485) + { + Gui->ShowError ("PIM_REQUIRE_LONG_PASSWORD"); + return; + } + + if (!Gui->AskYesNo (LangString ["PASSWORD_LENGTH_WARNING"], false, true)) + { + NewPasswordPanel->SetFocusToPasswordTextCtrl(); + return; + } + } + else if (newPim < 485) + { + if (!Gui->AskYesNo (LangString ["PIM_SMALL_WARNING"], false, true)) + { + NewPasswordPanel->SetFocusToPimTextCtrl(); + return; + } + } } } else + { newPassword = CurrentPasswordPanel->GetPassword(); + newPim = CurrentPasswordPanel->GetVolumePim(); + } shared_ptr <KeyfileList> newKeyfiles; if (DialogMode == Mode::ChangePasswordAndKeyfiles || DialogMode == Mode::ChangeKeyfiles) @@ -134,8 +158,8 @@ namespace VeraCrypt #endif wxBusyCursor busy; ChangePasswordThreadRoutine routine(Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps, - CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetPkcs5Kdf(), CurrentPasswordPanel->GetTrueCryptMode(),CurrentPasswordPanel->GetKeyfiles(), - newPassword, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(), NewPasswordPanel->GetHeaderWipeCount()); + CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetVolumePim(), CurrentPasswordPanel->GetPkcs5Kdf(), CurrentPasswordPanel->GetTrueCryptMode(),CurrentPasswordPanel->GetKeyfiles(), + newPassword, newPim, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(), NewPasswordPanel->GetHeaderWipeCount()); Gui->ExecuteWaitThreadRoutine (this, &routine); } diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp index dcbd38f5..0793a24c 100755 --- a/src/Main/Forms/Forms.cpp +++ b/src/Main/Forms/Forms.cpp @@ -3206,50 +3206,62 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i GridBagSizer->Add( ConfirmPasswordTextCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxBOTTOM|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
+ VolumePimStaticText = new wxStaticText( this, wxID_ANY, _("Volume PIM:"), wxDefaultPosition, wxDefaultSize, 0 );
+ VolumePimStaticText->Wrap( -1 );
+ GridBagSizer->Add( VolumePimStaticText, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT, 5 );
+
+ VolumePimTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ VolumePimTextCtrl->SetMaxLength( 10 );
+ GridBagSizer->Add( VolumePimTextCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND, 5 );
+
+ VolumePinHelpStaticText = new wxStaticText( this, wxID_ANY, _("(Empty or 0 for default iterations)"), wxDefaultPosition, wxDefaultSize, 0 );
+ VolumePinHelpStaticText->Wrap( -1 );
+ GridBagSizer->Add( VolumePinHelpStaticText, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
+
CacheCheckBox = new wxCheckBox( this, wxID_ANY, _("Cach&e passwords and keyfiles in memory "), wxDefaultPosition, wxDefaultSize, 0 );
- GridBagSizer->Add( CacheCheckBox, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
+ GridBagSizer->Add( CacheCheckBox, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
DisplayPasswordCheckBox = new wxCheckBox( this, wxID_ANY, _("&Display password"), wxDefaultPosition, wxDefaultSize, 0 );
- GridBagSizer->Add( DisplayPasswordCheckBox, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
+ GridBagSizer->Add( DisplayPasswordCheckBox, wxGBPosition( 5, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
UseKeyfilesCheckBox = new wxCheckBox( this, wxID_ANY, _("U&se keyfiles"), wxDefaultPosition, wxDefaultSize, 0 );
- GridBagSizer->Add( UseKeyfilesCheckBox, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT, 5 );
+ GridBagSizer->Add( UseKeyfilesCheckBox, wxGBPosition( 6, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT, 5 );
KeyfilesButton = new wxButton( this, wxID_ANY, _("&Keyfiles..."), wxDefaultPosition, wxDefaultSize, 0 );
- GridBagSizer->Add( KeyfilesButton, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT|wxALIGN_BOTTOM|wxLEFT, 5 );
+ GridBagSizer->Add( KeyfilesButton, wxGBPosition( 6, 2 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT|wxALIGN_BOTTOM|wxLEFT, 5 );
Pkcs5PrfSizer = new wxBoxSizer( wxVERTICAL );
- GridBagSizer->Add( Pkcs5PrfSizer, wxGBPosition( 6, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxBOTTOM, 5 );
+ GridBagSizer->Add( Pkcs5PrfSizer, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxBOTTOM, 5 );
Pkcs5PrfStaticText = new wxStaticText( this, wxID_ANY, _("PKCS-5 PRF:"), wxDefaultPosition, wxDefaultSize, 0 );
Pkcs5PrfStaticText->Wrap( -1 );
- GridBagSizer->Add( Pkcs5PrfStaticText, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+ GridBagSizer->Add( Pkcs5PrfStaticText, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
wxString Pkcs5PrfChoiceChoices[] = { _("Unchanged") };
int Pkcs5PrfChoiceNChoices = sizeof( Pkcs5PrfChoiceChoices ) / sizeof( wxString );
Pkcs5PrfChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Pkcs5PrfChoiceNChoices, Pkcs5PrfChoiceChoices, 0 );
Pkcs5PrfChoice->SetSelection( 0 );
- GridBagSizer->Add( Pkcs5PrfChoice, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
+ GridBagSizer->Add( Pkcs5PrfChoice, wxGBPosition( 8, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
TrueCryptModeCheckBox = new wxCheckBox( this, wxID_ANY, _("TrueCrypt Mode"), wxDefaultPosition, wxDefaultSize, 0 );
- GridBagSizer->Add( TrueCryptModeCheckBox, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
+ GridBagSizer->Add( TrueCryptModeCheckBox, wxGBPosition( 8, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
HeaderWipeCountText = new wxStaticText( this, wxID_ANY, _("Header Wipe:"), wxDefaultPosition, wxDefaultSize, 0 );
HeaderWipeCountText->Wrap( -1 );
- GridBagSizer->Add( HeaderWipeCountText, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 5 );
+ GridBagSizer->Add( HeaderWipeCountText, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 5 );
wxString HeaderWipeCountChoices[] = { _("1-pass"), _("3-pass"), _("7-pass"), _("35-pass"), _("256-pass") };
int HeaderWipeCountNChoices = sizeof( HeaderWipeCountChoices ) / sizeof( wxString );
HeaderWipeCount = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, HeaderWipeCountNChoices, HeaderWipeCountChoices, 0 );
HeaderWipeCount->SetSelection( 1 );
- GridBagSizer->Add( HeaderWipeCount, wxGBPosition( 8, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
+ GridBagSizer->Add( HeaderWipeCount, wxGBPosition( 9, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
PasswordPlaceholderSizer = new wxBoxSizer( wxVERTICAL );
- GridBagSizer->Add( PasswordPlaceholderSizer, wxGBPosition( 9, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxEXPAND, 5 );
+ GridBagSizer->Add( PasswordPlaceholderSizer, wxGBPosition( 10, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxEXPAND, 5 );
GridBagSizer->AddGrowableCol( 1 );
@@ -3264,6 +3276,7 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i // Connect Events
PasswordTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this );
ConfirmPasswordTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this );
+ VolumePimTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnPimChanged ), NULL, this );
DisplayPasswordCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnDisplayPasswordCheckBoxClick ), NULL, this );
UseKeyfilesCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnUseKeyfilesCheckBoxClick ), NULL, this );
KeyfilesButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonClick ), NULL, this );
@@ -3276,6 +3289,7 @@ VolumePasswordPanelBase::~VolumePasswordPanelBase() // Disconnect Events
PasswordTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this );
ConfirmPasswordTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this );
+ VolumePimTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnPimChanged ), NULL, this );
DisplayPasswordCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnDisplayPasswordCheckBoxClick ), NULL, this );
UseKeyfilesCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnUseKeyfilesCheckBoxClick ), NULL, this );
KeyfilesButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonClick ), NULL, this );
diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h index 24097686..c53d3c33 100755 --- a/src/Main/Forms/Forms.h +++ b/src/Main/Forms/Forms.h @@ -959,6 +959,9 @@ namespace VeraCrypt wxTextCtrl* PasswordTextCtrl;
wxStaticText* ConfirmPasswordStaticText;
wxTextCtrl* ConfirmPasswordTextCtrl;
+ wxStaticText* VolumePimStaticText;
+ wxTextCtrl* VolumePimTextCtrl;
+ wxStaticText* VolumePinHelpStaticText;
wxCheckBox* CacheCheckBox;
wxCheckBox* DisplayPasswordCheckBox;
wxCheckBox* UseKeyfilesCheckBox;
@@ -973,6 +976,7 @@ namespace VeraCrypt // Virtual event handlers, overide them in your derived class
virtual void OnTextChanged( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnPimChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDisplayPasswordCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUseKeyfilesCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnKeyfilesButtonClick( wxCommandEvent& event ) { event.Skip(); }
diff --git a/src/Main/Forms/MountOptionsDialog.cpp b/src/Main/Forms/MountOptionsDialog.cpp index e60492e1..9ebbbe98 100644..100755 --- a/src/Main/Forms/MountOptionsDialog.cpp +++ b/src/Main/Forms/MountOptionsDialog.cpp @@ -85,6 +85,7 @@ namespace VeraCrypt TransferDataFromWindow(); Options.Password = PasswordPanel->GetPassword(); + Options.Pim = PasswordPanel->GetVolumePim(); Options.Kdf = PasswordPanel->GetPkcs5Kdf(); Options.TrueCryptMode = PasswordPanel->GetTrueCryptMode(); Options.Keyfiles = PasswordPanel->GetKeyfiles(); @@ -97,6 +98,7 @@ namespace VeraCrypt { Options.Protection = VolumeProtection::HiddenVolumeReadOnly; Options.ProtectionPassword = ProtectionPasswordPanel->GetPassword(); + Options.ProtectionPim = ProtectionPasswordPanel->GetVolumePim(); Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf(); Options.ProtectionKeyfiles = ProtectionPasswordPanel->GetKeyfiles(); } diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp index 86621bac..31ea58e3 100755 --- a/src/Main/Forms/TrueCrypt.fbp +++ b/src/Main/Forms/TrueCrypt.fbp @@ -25835,10 +25835,276 @@ </object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
+ <property name="colspan">1</property>
+ <property name="column">0</property>
+ <property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT</property>
+ <property name="row">3</property>
+ <property name="rowspan">1</property>
+ <object class="wxStaticText" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">Volume PIM:</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">VolumePimStaticText</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <property name="wrap">-1</property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ <object class="gbsizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="colspan">1</property>
+ <property name="column">1</property>
+ <property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND</property>
+ <property name="row">3</property>
+ <property name="rowspan">1</property>
+ <object class="wxTextCtrl" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="maxlength">10</property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">VolumePimTextCtrl</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NUMERIC</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="value"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnText">OnPimChanged</event>
+ <event name="OnTextEnter"></event>
+ <event name="OnTextMaxLen"></event>
+ <event name="OnTextURL"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ <object class="gbsizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="colspan">1</property>
+ <property name="column">2</property>
+ <property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT</property>
+ <property name="row">3</property>
+ <property name="rowspan">1</property>
+ <object class="wxStaticText" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">(Empty or 0 for default iterations)</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">VolumePinHelpStaticText</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <property name="wrap">-1</property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ <object class="gbsizeritem" expanded="0">
+ <property name="border">5</property>
<property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
- <property name="row">3</property>
+ <property name="row">4</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@@ -25929,7 +26195,7 @@ <property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
- <property name="row">4</property>
+ <property name="row">5</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@@ -26020,7 +26286,7 @@ <property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
- <property name="row">5</property>
+ <property name="row">6</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@@ -26111,7 +26377,7 @@ <property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALIGN_RIGHT|wxALIGN_BOTTOM|wxLEFT</property>
- <property name="row">5</property>
+ <property name="row">6</property>
<property name="rowspan">1</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -26202,7 +26468,7 @@ <property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
- <property name="row">6</property>
+ <property name="row">7</property>
<property name="rowspan">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -26216,7 +26482,7 @@ <property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
- <property name="row">7</property>
+ <property name="row">8</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -26302,7 +26568,7 @@ <property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
- <property name="row">7</property>
+ <property name="row">8</property>
<property name="rowspan">1</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
@@ -26393,7 +26659,7 @@ <property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
- <property name="row">7</property>
+ <property name="row">8</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@@ -26484,7 +26750,7 @@ <property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT</property>
- <property name="row">8</property>
+ <property name="row">9</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -26570,7 +26836,7 @@ <property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALL</property>
- <property name="row">8</property>
+ <property name="row">9</property>
<property name="rowspan">1</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
@@ -26661,7 +26927,7 @@ <property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxTOP|wxEXPAND</property>
- <property name="row">9</property>
+ <property name="row">10</property>
<property name="rowspan">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp index 12dc7457..e7f3fb46 100755 --- a/src/Main/Forms/VolumeCreationWizard.cpp +++ b/src/Main/Forms/VolumeCreationWizard.cpp @@ -276,6 +276,7 @@ namespace VeraCrypt MountOptions mountOptions; mountOptions.Keyfiles = Keyfiles; mountOptions.Password = Password; + mountOptions.Pim = Pim; mountOptions.Path = make_shared <VolumePath> (SelectedVolumePath); try @@ -436,6 +437,7 @@ namespace VeraCrypt mountOptions.NoFilesystem = true; mountOptions.Protection = VolumeProtection::None; mountOptions.Password = Password; + mountOptions.Pim = Pim; mountOptions.Keyfiles = Keyfiles; mountOptions.Kdf = Kdf; mountOptions.TrueCryptMode = false; @@ -706,6 +708,7 @@ namespace VeraCrypt { VolumePasswordWizardPage *page = dynamic_cast <VolumePasswordWizardPage *> (GetCurrentPage()); Password = page->GetPassword(); + Pim = page->GetVolumePim(); Kdf = page->GetPkcs5Kdf(); Keyfiles = page->GetKeyfiles(); @@ -721,12 +724,28 @@ namespace VeraCrypt return GetCurrentStep(); } - if (Password->Size() < VolumePassword::WarningSizeThreshold - && !Gui->AskYesNo (LangString["PASSWORD_LENGTH_WARNING"], false, true)) + if (Password->Size() < VolumePassword::WarningSizeThreshold) { - return GetCurrentStep(); + if (Pim < 485) + { + Gui->ShowError ("PIM_REQUIRE_LONG_PASSWORD"); + return GetCurrentStep(); + } + + if (!Gui->AskYesNo (LangString["PASSWORD_LENGTH_WARNING"], false, true)) + { + return GetCurrentStep(); + } + } + else if (Pim < 485) + { + if (!Gui->AskYesNo (LangString["PIM_SMALL_WARNING"], false, true)) + { + return GetCurrentStep(); + } } } + if (forward && OuterVolume) { @@ -864,6 +883,7 @@ namespace VeraCrypt options->SectorSize = SectorSize; options->EA = SelectedEncryptionAlgorithm; options->Password = Password; + options->Pim = Pim; options->Keyfiles = Keyfiles; options->Path = SelectedVolumePath; options->Quick = QuickFormatEnabled; @@ -946,7 +966,7 @@ namespace VeraCrypt }); #endif - shared_ptr <Volume> outerVolume = Core->OpenVolume (make_shared <VolumePath> (SelectedVolumePath), true, Password, Kdf, false, Keyfiles, VolumeProtection::ReadOnly); + shared_ptr <Volume> outerVolume = Core->OpenVolume (make_shared <VolumePath> (SelectedVolumePath), true, Password, Pim, Kdf, false, Keyfiles, VolumeProtection::ReadOnly); MaxHiddenVolumeSize = Core->GetMaxHiddenVolumeSize (outerVolume); // Add a reserve (in case the user mounts the outer volume and creates new files diff --git a/src/Main/Forms/VolumeCreationWizard.h b/src/Main/Forms/VolumeCreationWizard.h index 09bc1c34..839a9993 100644..100755 --- a/src/Main/Forms/VolumeCreationWizard.h +++ b/src/Main/Forms/VolumeCreationWizard.h @@ -73,6 +73,7 @@ namespace VeraCrypt VolumeHostType::Enum SelectedVolumeHostType; VolumeType::Enum SelectedVolumeType; shared_ptr <VolumePassword> Password; + int Pim; shared_ptr <Pkcs5Kdf> Kdf; uint32 SectorSize; shared_ptr <Hash> SelectedHash; diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp index deab2803..d4200b66 100644..100755 --- a/src/Main/Forms/VolumePasswordPanel.cpp +++ b/src/Main/Forms/VolumePasswordPanel.cpp @@ -54,6 +54,9 @@ namespace VeraCrypt PasswordStaticText->Show (enablePassword); PasswordTextCtrl->Show (enablePassword); DisplayPasswordCheckBox->Show (enablePassword); + + VolumePimTextCtrl->Show (enablePassword); + VolumePinHelpStaticText->Show (enablePassword); ConfirmPasswordStaticText->Show (enableConfirmation); ConfirmPasswordTextCtrl->Show (enableConfirmation); @@ -213,6 +216,18 @@ namespace VeraCrypt } } + int VolumePasswordPanel::GetVolumePim () const + { + wxString pinStr (VolumePimTextCtrl->GetValue()); + long pin = 0; + if (pinStr.IsEmpty()) + return 0; + if (pinStr.ToLong (&pin)) + return (int) pin; + else + return -1; + } + bool VolumePasswordPanel::GetTrueCryptMode () const { return TrueCryptModeCheckBox->GetValue (); @@ -352,4 +367,21 @@ namespace VeraCrypt textCtrl->SetValue (wxString (L'X', textCtrl->GetLineLength(0))); GetPassword (textCtrl); } + + void VolumePasswordPanel::OnPimChanged (wxCommandEvent& event) + { + if (ConfirmPasswordTextCtrl->IsShown()) + { + if (GetVolumePim() != 0) + { + VolumePinHelpStaticText->SetForegroundColour(*wxRED); + VolumePinHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]); + } + else + { + VolumePinHelpStaticText->SetForegroundColour(*wxBLACK); + VolumePinHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]); + } + } + } } diff --git a/src/Main/Forms/VolumePasswordPanel.h b/src/Main/Forms/VolumePasswordPanel.h index 4cd338c5..45e0dd8c 100644..100755 --- a/src/Main/Forms/VolumePasswordPanel.h +++ b/src/Main/Forms/VolumePasswordPanel.h @@ -25,10 +25,12 @@ namespace VeraCrypt shared_ptr <KeyfileList> GetKeyfiles () const { return UseKeyfilesCheckBox->IsChecked() ? Keyfiles : shared_ptr <KeyfileList> (); } shared_ptr <VolumePassword> GetPassword () const; shared_ptr <Pkcs5Kdf> GetPkcs5Kdf () const; + int GetVolumePim () const; bool GetTrueCryptMode () const; int GetHeaderWipeCount () const; void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); } void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); } + void SetFocusToPimTextCtrl () { VolumePimTextCtrl->SetSelection (-1, -1); VolumePimTextCtrl->SetFocus(); } bool PasswordsMatch () const; Event UpdateEvent; @@ -44,6 +46,7 @@ namespace VeraCrypt void OnKeyfilesButtonRightClick (wxMouseEvent& event); void OnKeyfilesButtonRightDown (wxMouseEvent& event); void OnTextChanged (wxCommandEvent& event) { OnUpdate(); } + void OnPimChanged (wxCommandEvent& event); void OnUpdate () { UpdateEvent.Raise(); } void OnUseKeyfilesCheckBoxClick (wxCommandEvent& event) { OnUpdate(); } void WipeTextCtrl (wxTextCtrl *textCtrl); diff --git a/src/Main/Forms/VolumePasswordWizardPage.h b/src/Main/Forms/VolumePasswordWizardPage.h index 13a98c62..aad86c86 100644..100755 --- a/src/Main/Forms/VolumePasswordWizardPage.h +++ b/src/Main/Forms/VolumePasswordWizardPage.h @@ -22,6 +22,7 @@ namespace VeraCrypt shared_ptr <KeyfileList> GetKeyfiles () const { return PasswordPanel->GetKeyfiles(); } shared_ptr <VolumePassword> GetPassword () const { return PasswordPanel->GetPassword(); } + int GetVolumePim () const { return PasswordPanel->GetVolumePim(); } shared_ptr <Pkcs5Kdf> GetPkcs5Kdf () const { return PasswordPanel->GetPkcs5Kdf(); } bool IsValid (); void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); } diff --git a/src/Main/Forms/VolumePropertiesDialog.cpp b/src/Main/Forms/VolumePropertiesDialog.cpp index 9d17f04b..daa247c3 100644 --- a/src/Main/Forms/VolumePropertiesDialog.cpp +++ b/src/Main/Forms/VolumePropertiesDialog.cpp @@ -57,7 +57,10 @@ namespace VeraCrypt AppendToList ("BLOCK_SIZE", blockSize.str() + L" " + LangString ["BITS"]); AppendToList ("MODE_OF_OPERATION", volumeInfo.EncryptionModeName); - AppendToList ("PKCS5_PRF", volumeInfo.Pkcs5PrfName); + if (volumeInfo.Pim <= 0) + AppendToList ("PKCS5_PRF", volumeInfo.Pkcs5PrfName); + else + AppendToList ("PKCS5_PRF", StringFormatter (L"{0} (Dynamic)", volumeInfo.Pkcs5PrfName)); #if 0 AppendToList ("PKCS5_ITERATIONS", StringConverter::FromNumber (volumeInfo.Pkcs5IterationCount)); |