diff options
Diffstat (limited to 'src/Main')
19 files changed, 547 insertions, 53 deletions
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp index 541f66d0..b1bb4bd0 100644..100755 --- a/src/Main/CommandLineInterface.cpp +++ b/src/Main/CommandLineInterface.cpp @@ -19,9 +19,11 @@ namespace VeraCrypt { CommandLineInterface::CommandLineInterface (int argc, wchar_t** argv, UserInterfaceType::Enum interfaceType) : ArgCommand (CommandId::None), ArgFilesystem (VolumeCreationOptions::FilesystemType::Unknown), + ArgNewPim (-1), ArgNoHiddenVolumeProtection (false), + ArgPim (-1), ArgSize (0), ArgVolumeType (VolumeType::Unknown), ArgTrueCryptMode (false), StartBackgroundTask (false) @@ -62,14 +64,17 @@ namespace VeraCrypt parser.AddSwitch (L"", L"mount", _("Mount volume interactively")); parser.AddOption (L"m", L"mount-options", _("VeraCrypt volume mount options")); parser.AddOption (L"", L"new-keyfiles", _("New keyfiles")); parser.AddOption (L"", L"new-password", _("New password")); + parser.AddOption (L"", L"new-pim", _("New PIM")); parser.AddSwitch (L"", L"non-interactive", _("Do not interact with user")); parser.AddOption (L"p", L"password", _("Password")); + parser.AddOption (L"", L"pim", _("PIM")); parser.AddOption (L"", L"protect-hidden", _("Protect hidden volume")); parser.AddOption (L"", L"protection-hash", _("Hash algorithm for protected hidden volume")); parser.AddOption (L"", L"protection-keyfiles", _("Keyfiles for protected hidden volume")); parser.AddOption (L"", L"protection-password", _("Password for protected hidden volume")); + parser.AddOption (L"", L"protection-pim", _("PIM for protected hidden volume")); parser.AddOption (L"", L"random-source", _("Use file as source of random data")); parser.AddSwitch (L"", L"restore-headers", _("Restore volume headers")); parser.AddSwitch (L"", L"save-preferences", _("Save user preferences")); parser.AddSwitch (L"", L"quick", _("Enable quick format")); @@ -367,8 +372,22 @@ namespace VeraCrypt if (parser.Found (L"new-password", &str)) ArgNewPassword.reset (new VolumePassword (wstring (str))); + if (parser.Found (L"new-pim", &str)) + { + try + { + ArgNewPim = StringConverter::ToInt32 (wstring (str)); + if (ArgNewPim < 0) + throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); + } + catch (...) + { + throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); + } + } + if (parser.Found (L"non-interactive")) { if (interfaceType != UserInterfaceType::Text) throw_err (L"--non-interactive is supported only in text mode"); @@ -377,8 +396,22 @@ namespace VeraCrypt } if (parser.Found (L"password", &str)) ArgPassword.reset (new VolumePassword (wstring (str))); + + if (parser.Found (L"pim", &str)) + { + try + { + ArgPim = StringConverter::ToInt32 (wstring (str)); + if (ArgPim < 0) + throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); + } + catch (...) + { + throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); + } + } if (parser.Found (L"protect-hidden", &str)) { if (str == L"yes") @@ -402,8 +435,25 @@ namespace VeraCrypt { ArgMountOptions.ProtectionPassword.reset (new VolumePassword (wstring (str))); ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly; } + + if (parser.Found (L"protection-pim", &str)) + { + int pim = -1; + try + { + pim = StringConverter::ToInt32 (wstring (str)); + if (pim < 0) + throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); + } + catch (...) + { + throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); + } + ArgMountOptions.ProtectionPim = pim; + ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly; + } if (parser.Found (L"protection-hash", &str)) { bool bHashFound = false; diff --git a/src/Main/CommandLineInterface.h b/src/Main/CommandLineInterface.h index 217b5c39..cb08b393 100644..100755 --- a/src/Main/CommandLineInterface.h +++ b/src/Main/CommandLineInterface.h @@ -66,10 +66,12 @@ namespace VeraCrypt MountOptions ArgMountOptions; shared_ptr <DirectoryPath> ArgMountPoint; shared_ptr <KeyfileList> ArgNewKeyfiles; shared_ptr <VolumePassword> ArgNewPassword; + int ArgNewPim; bool ArgNoHiddenVolumeProtection; shared_ptr <VolumePassword> ArgPassword; + int ArgPim; bool ArgQuick; FilesystemPath ArgRandomSourcePath; uint64 ArgSize; shared_ptr <VolumePath> ArgVolumePath; 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 @@ -89,22 +89,46 @@ namespace VeraCrypt return; } 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) newKeyfiles = NewPasswordPanel->GetKeyfiles(); @@ -133,10 +157,10 @@ 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); } switch (DialogMode) 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 @@ -3205,52 +3205,64 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i ConfirmPasswordTextCtrl->SetMinSize( wxSize( 232,-1 ) );
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 );
@@ -3263,8 +3275,9 @@ 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 );
KeyfilesButton->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightDown ), NULL, this );
@@ -3275,8 +3288,9 @@ 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 );
KeyfilesButton->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightDown ), 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 @@ -958,8 +958,11 @@ namespace VeraCrypt wxStaticText* PasswordStaticText;
wxTextCtrl* PasswordTextCtrl;
wxStaticText* ConfirmPasswordStaticText;
wxTextCtrl* ConfirmPasswordTextCtrl;
+ wxStaticText* VolumePimStaticText;
+ wxTextCtrl* VolumePimTextCtrl;
+ wxStaticText* VolumePinHelpStaticText;
wxCheckBox* CacheCheckBox;
wxCheckBox* DisplayPasswordCheckBox;
wxCheckBox* UseKeyfilesCheckBox;
wxButton* KeyfilesButton;
@@ -972,8 +975,9 @@ namespace VeraCrypt wxBoxSizer* PasswordPlaceholderSizer;
// 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(); }
virtual void OnKeyfilesButtonRightDown( wxMouseEvent& 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 @@ -84,8 +84,9 @@ namespace VeraCrypt { TransferDataFromWindow(); Options.Password = PasswordPanel->GetPassword(); + Options.Pim = PasswordPanel->GetVolumePim(); Options.Kdf = PasswordPanel->GetPkcs5Kdf(); Options.TrueCryptMode = PasswordPanel->GetTrueCryptMode(); Options.Keyfiles = PasswordPanel->GetKeyfiles(); @@ -96,8 +97,9 @@ namespace VeraCrypt else if (ProtectionCheckBox->IsChecked()) { Options.Protection = VolumeProtection::HiddenVolumeReadOnly; Options.ProtectionPassword = ProtectionPasswordPanel->GetPassword(); + Options.ProtectionPim = ProtectionPasswordPanel->GetVolumePim(); Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf(); Options.ProtectionKeyfiles = ProtectionPasswordPanel->GetKeyfiles(); } else 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 @@ -25834,12 +25834,278 @@ </object>
</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>
<property name="LeftDockable">1</property>
@@ -25928,9 +26194,9 @@ <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">4</property>
+ <property name="row">5</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@@ -26019,9 +26285,9 @@ <property name="border">5</property>
<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>
<property name="LeftDockable">1</property>
@@ -26110,9 +26376,9 @@ <property name="border">5</property>
<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>
<property name="LeftDockable">1</property>
@@ -26201,9 +26467,9 @@ <property name="border">5</property>
<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>
<property name="name">Pkcs5PrfSizer</property>
@@ -26215,9 +26481,9 @@ <property name="border">5</property>
<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>
<property name="LeftDockable">1</property>
@@ -26301,9 +26567,9 @@ <property name="border">5</property>
<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>
<property name="LeftDockable">1</property>
@@ -26392,9 +26658,9 @@ <property name="border">5</property>
<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>
<property name="LeftDockable">1</property>
@@ -26483,9 +26749,9 @@ <property name="border">5</property>
<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>
<property name="LeftDockable">1</property>
@@ -26569,9 +26835,9 @@ <property name="border">5</property>
<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>
<property name="LeftDockable">1</property>
@@ -26660,9 +26926,9 @@ <property name="border">5</property>
<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>
<property name="name">PasswordPlaceholderSizer</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 @@ -275,8 +275,9 @@ namespace VeraCrypt MountOptions mountOptions; mountOptions.Keyfiles = Keyfiles; mountOptions.Password = Password; + mountOptions.Pim = Pim; mountOptions.Path = make_shared <VolumePath> (SelectedVolumePath); try { @@ -435,8 +436,9 @@ namespace VeraCrypt mountOptions.Path = make_shared <VolumePath> (SelectedVolumePath); mountOptions.NoFilesystem = true; mountOptions.Protection = VolumeProtection::None; mountOptions.Password = Password; + mountOptions.Pim = Pim; mountOptions.Keyfiles = Keyfiles; mountOptions.Kdf = Kdf; mountOptions.TrueCryptMode = false; @@ -705,8 +707,9 @@ namespace VeraCrypt case Step::VolumePassword: { VolumePasswordWizardPage *page = dynamic_cast <VolumePasswordWizardPage *> (GetCurrentPage()); Password = page->GetPassword(); + Pim = page->GetVolumePim(); Kdf = page->GetPkcs5Kdf(); Keyfiles = page->GetKeyfiles(); if (forward && Password && !Password->IsEmpty()) @@ -720,14 +723,30 @@ namespace VeraCrypt Gui->ShowError (e); 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) { // Use FAT to prevent problems with free space @@ -863,8 +882,9 @@ namespace VeraCrypt options->FilesystemClusterSize = SelectedFilesystemClusterSize; options->SectorSize = SectorSize; options->EA = SelectedEncryptionAlgorithm; options->Password = Password; + options->Pim = Pim; options->Keyfiles = Keyfiles; options->Path = SelectedVolumePath; options->Quick = QuickFormatEnabled; options->Size = VolumeSize; @@ -945,9 +965,9 @@ namespace VeraCrypt Core->SetFileOwner (finally_arg, finally_arg2); }); #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 // on it by accident or OS writes some new data behind his or her back, such as 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 @@ -72,8 +72,9 @@ namespace VeraCrypt VolumePath SelectedVolumePath; VolumeHostType::Enum SelectedVolumeHostType; VolumeType::Enum SelectedVolumeType; shared_ptr <VolumePassword> Password; + int Pim; shared_ptr <Pkcs5Kdf> Kdf; uint32 SectorSize; shared_ptr <Hash> SelectedHash; uint64 VolumeSize; 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 @@ -53,8 +53,11 @@ namespace VeraCrypt PasswordStaticText->Show (enablePassword); PasswordTextCtrl->Show (enablePassword); DisplayPasswordCheckBox->Show (enablePassword); + + VolumePimTextCtrl->Show (enablePassword); + VolumePinHelpStaticText->Show (enablePassword); ConfirmPasswordStaticText->Show (enableConfirmation); ConfirmPasswordTextCtrl->Show (enableConfirmation); @@ -212,8 +215,20 @@ namespace VeraCrypt return shared_ptr <Pkcs5Kdf> (); } } + 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 (); } @@ -351,5 +366,22 @@ 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 @@ -24,12 +24,14 @@ namespace VeraCrypt void AddKeyfile (shared_ptr <Keyfile> keyfile); 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; @@ -43,8 +45,9 @@ namespace VeraCrypt void OnKeyfilesButtonClick (wxCommandEvent& event); 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 @@ -21,8 +21,9 @@ namespace VeraCrypt ~VolumePasswordWizardPage (); 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); } void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } 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 @@ -56,9 +56,12 @@ namespace VeraCrypt blockSize << L"/" << volumeInfo.EncryptionAlgorithmMinBlockSize * 8; 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)); AppendToList ("VOLUME_CREATE_DATE", Gui->VolumeTimeToString (volumeInfo.VolumeCreationTime)); diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp index 3b4da416..d5413f37 100644..100755 --- a/src/Main/GraphicUserInterface.cpp +++ b/src/Main/GraphicUserInterface.cpp @@ -177,13 +177,15 @@ namespace VeraCrypt OpenVolumeThreadRoutine routine( options->Path, options->PreserveTimestamps, options->Password, + options->Pim, options->Kdf, false, options->Keyfiles, options->Protection, options->ProtectionPassword, + options->ProtectionPim, options->ProtectionKdf, options->ProtectionKeyfiles, true, volumeType, @@ -267,18 +269,18 @@ namespace VeraCrypt wxBusyCursor busy; // Re-encrypt volume header SecureBuffer newHeaderBuffer (normalVolume->GetLayout()->GetHeaderSize()); - ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, normalVolume->GetHeader(), normalVolumeMountOptions.Password, normalVolumeMountOptions.Keyfiles); + ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, normalVolume->GetHeader(), normalVolumeMountOptions.Password, normalVolumeMountOptions.Pim, normalVolumeMountOptions.Keyfiles); ExecuteWaitThreadRoutine (parent, &routine); backupFile.Write (newHeaderBuffer); if (hiddenVolume) { // Re-encrypt hidden volume header - ReEncryptHeaderThreadRoutine hiddenRoutine(newHeaderBuffer, hiddenVolume->GetHeader(), hiddenVolumeMountOptions.Password, hiddenVolumeMountOptions.Keyfiles); + ReEncryptHeaderThreadRoutine hiddenRoutine(newHeaderBuffer, hiddenVolume->GetHeader(), hiddenVolumeMountOptions.Password, hiddenVolumeMountOptions.Pim, hiddenVolumeMountOptions.Keyfiles); ExecuteWaitThreadRoutine (parent, &hiddenRoutine); } else @@ -1321,13 +1323,15 @@ namespace VeraCrypt OpenVolumeThreadRoutine routine( options.Path, options.PreserveTimestamps, options.Password, + options.Pim, options.Kdf, options.TrueCryptMode, options.Keyfiles, options.Protection, options.ProtectionPassword, + options.ProtectionPim, options.ProtectionKdf, options.ProtectionKeyfiles, options.SharedAccessAllowed, VolumeType::Unknown, @@ -1355,9 +1359,9 @@ namespace VeraCrypt // Re-encrypt volume header wxBusyCursor busy; SecureBuffer newHeaderBuffer (volume->GetLayout()->GetHeaderSize()); - ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, volume->GetHeader(), options.Password, options.Keyfiles); + ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, volume->GetHeader(), options.Password, options.Pim, options.Keyfiles); ExecuteWaitThreadRoutine (parent, &routine); // Write volume header @@ -1445,9 +1449,9 @@ namespace VeraCrypt Pkcs5KdfList keyDerivationFunctions = layout->GetSupportedKeyDerivationFunctions(options.TrueCryptMode); EncryptionAlgorithmList encryptionAlgorithms = layout->GetSupportedEncryptionAlgorithms(); EncryptionModeList encryptionModes = layout->GetSupportedEncryptionModes(); - DecryptThreadRoutine decryptRoutine(layout->GetHeader(), headerBuffer, *passwordKey, options.Kdf, options.TrueCryptMode, keyDerivationFunctions, encryptionAlgorithms, encryptionModes); + DecryptThreadRoutine decryptRoutine(layout->GetHeader(), headerBuffer, *passwordKey, options.Pim, options.Kdf, options.TrueCryptMode, keyDerivationFunctions, encryptionAlgorithms, encryptionModes); ExecuteWaitThreadRoutine (parent, &decryptRoutine); if (decryptRoutine.m_bResult) @@ -1474,9 +1478,9 @@ namespace VeraCrypt // Re-encrypt volume header wxBusyCursor busy; SecureBuffer newHeaderBuffer (decryptedLayout->GetHeaderSize()); - ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Keyfiles); + ReEncryptHeaderThreadRoutine routine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles); ExecuteWaitThreadRoutine (parent, &routine); // Write volume header @@ -1490,9 +1494,9 @@ namespace VeraCrypt if (decryptedLayout->HasBackupHeader()) { // Re-encrypt backup volume header - ReEncryptHeaderThreadRoutine backupRoutine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Keyfiles); + ReEncryptHeaderThreadRoutine backupRoutine(newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles); ExecuteWaitThreadRoutine (parent, &backupRoutine); // Write backup volume header diff --git a/src/Main/GraphicUserInterface.h b/src/Main/GraphicUserInterface.h index 7edea984..c9ff72cb 100644..100755 --- a/src/Main/GraphicUserInterface.h +++ b/src/Main/GraphicUserInterface.h @@ -29,9 +29,9 @@ namespace VeraCrypt virtual void AutoDismountVolumes (VolumeInfoList mountedVolumes, bool alwaysForce = true); virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const; virtual void BeginBusyState () const { wxBeginBusyCursor(); } virtual void BeginInteractiveBusyState (wxWindow *window); - virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const { ThrowTextModeRequired(); } + virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const { ThrowTextModeRequired(); } wxHyperlinkCtrl *CreateHyperlink (wxWindow *parent, const wxString &linkUrl, const wxString &linkText) const; virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const; virtual void CreateVolume (shared_ptr <VolumeCreationOptions> options) const { ThrowTextModeRequired(); } virtual void ClearListCtrlSelection (wxListCtrl *listCtrl) const; diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp index c1b17b2b..190aaf76 100644..100755 --- a/src/Main/TextUserInterface.cpp +++ b/src/Main/TextUserInterface.cpp @@ -179,8 +179,36 @@ namespace VeraCrypt return password; } + int TextUserInterface::AskPim (const wxString &message) const + { + int pim = -1; + wxString msg = _("Enter new PIM: "); + if (!message.empty()) + msg = message + L": "; + while (pim < 0) + { + wstring pimStr = AskString (msg); + if (pimStr.empty()) + pim = 0; + else + { + try + { + pim = (int) StringConverter::ToUInt32 (pimStr); + } + catch (...) + { + pim = -1; + continue; + } + } + } + + return pim; + } + ssize_t TextUserInterface::AskSelection (ssize_t optionCount, ssize_t defaultOption) const { while (true) { @@ -271,21 +299,24 @@ namespace VeraCrypt while (!volume) { ShowString (L"\n"); options->Password = AskPassword (LangString[volumeType == VolumeType::Hidden ? "ENTER_HIDDEN_VOL_PASSWORD" : "ENTER_NORMAL_VOL_PASSWORD"]); + options->Pim = AskPim (volumeType == VolumeType::Hidden ?_("Enter PIM for the hidden volume") : _("Enter PIM for the normal/outer volume")); options->Keyfiles = AskKeyfiles(); try { volume = Core->OpenVolume ( options->Path, options->PreserveTimestamps, options->Password, + options->Pim, kdf, false, options->Keyfiles, options->Protection, options->ProtectionPassword, + options->ProtectionPim, options->ProtectionKdf, options->ProtectionKeyfiles, true, volumeType, @@ -344,16 +375,16 @@ namespace VeraCrypt UserEnrichRandomPool(); // Re-encrypt volume header SecureBuffer newHeaderBuffer (normalVolume->GetLayout()->GetHeaderSize()); - Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, normalVolume->GetHeader(), normalVolumeMountOptions.Password, normalVolumeMountOptions.Keyfiles); + Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, normalVolume->GetHeader(), normalVolumeMountOptions.Password, normalVolumeMountOptions.Pim, normalVolumeMountOptions.Keyfiles); backupFile.Write (newHeaderBuffer); if (hiddenVolume) { // Re-encrypt hidden volume header - Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, hiddenVolume->GetHeader(), hiddenVolumeMountOptions.Password, hiddenVolumeMountOptions.Keyfiles); + Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, hiddenVolume->GetHeader(), hiddenVolumeMountOptions.Password, hiddenVolumeMountOptions.Pim, hiddenVolumeMountOptions.Keyfiles); } else { // Store random data in place of hidden volume header @@ -367,9 +398,9 @@ namespace VeraCrypt ShowString (L"\n"); ShowInfo ("VOL_HEADER_BACKED_UP"); } - void TextUserInterface::ChangePassword (shared_ptr <VolumePath> volumePath, shared_ptr <VolumePassword> password, shared_ptr <Hash> currentHash, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Hash> newHash) const + void TextUserInterface::ChangePassword (shared_ptr <VolumePath> volumePath, shared_ptr <VolumePassword> password, int pim, shared_ptr <Hash> currentHash, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Hash> newHash) const { shared_ptr <Volume> volume; // Volume path @@ -410,8 +441,14 @@ namespace VeraCrypt else if (!Preferences.NonInteractive) { password = AskPassword (); } + + // current PIM + if (!Preferences.NonInteractive && (pim < 0)) + { + pim = AskPim (_("Enter current PIM")); + } // Current keyfiles try { @@ -420,9 +457,9 @@ namespace VeraCrypt // Ask for keyfiles only if required try { keyfiles.reset (new KeyfileList); - volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, kdf, truecryptMode, keyfiles); + volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, truecryptMode, keyfiles); } catch (PasswordException&) { if (!Preferences.NonInteractive) @@ -430,9 +467,9 @@ namespace VeraCrypt } } if (!volume.get()) - volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, kdf, truecryptMode, keyfiles); + volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, truecryptMode, keyfiles); } catch (PasswordException &e) { if (Preferences.NonInteractive || !passwordInteractive || !keyfilesInteractive) @@ -449,8 +486,12 @@ namespace VeraCrypt if (newPassword.get()) newPassword->CheckPortability(); else if (!Preferences.NonInteractive) newPassword = AskPassword (_("Enter new password"), true); + + // New PIM + if ((newPim < 0) && !Preferences.NonInteractive) + newPim = AskPim (_("Enter new PIM")); // New keyfiles if (!newKeyfiles.get() && !Preferences.NonInteractive) { @@ -463,9 +504,9 @@ namespace VeraCrypt /* force the display of the random enriching interface */ RandomNumberGenerator::SetEnrichedByUserStatus (false); UserEnrichRandomPool(); - Core->ChangePassword (volume, newPassword, newKeyfiles, + Core->ChangePassword (volume, newPassword, newPim, newKeyfiles, newHash ? Pkcs5Kdf::GetAlgorithm (*newHash, false) : shared_ptr <Pkcs5Kdf>()); ShowInfo ("PASSWORD_CHANGED"); } @@ -746,8 +787,15 @@ namespace VeraCrypt } if (options->Password) options->Password->CheckPortability(); + + // PIM + if ((options->Pim < 0) && !Preferences.NonInteractive) + { + ShowString (L"\n"); + options->Pim = AskPim (_("Enter PIM")); + } // Keyfiles if (!options->Keyfiles && !Preferences.NonInteractive) { @@ -818,8 +866,9 @@ namespace VeraCrypt mountOptions.Path = make_shared <VolumePath> (options->Path); mountOptions.NoFilesystem = true; mountOptions.Protection = VolumeProtection::None; mountOptions.Password = options->Password; + mountOptions.Pim = options->Pim; mountOptions.Keyfiles = options->Keyfiles; shared_ptr <VolumeInfo> volume = Core->MountVolume (mountOptions); finally_do_arg (shared_ptr <VolumeInfo>, volume, { Core->DismountVolume (finally_arg, true); }); @@ -1069,8 +1118,11 @@ namespace VeraCrypt while (true) { if (!options.Password) options.Password = AskPassword(); + + if (options.Pim < 0) + options.Pim = AskPim (_("Enter PIM")); if (!options.Keyfiles) options.Keyfiles = AskKeyfiles(); @@ -1079,8 +1131,9 @@ namespace VeraCrypt if (!mountedVolumes.empty()) return mountedVolumes; options.Password.reset(); + options.Pim = -1; } } shared_ptr <VolumeInfo> TextUserInterface::MountVolume (MountOptions &options) const @@ -1143,8 +1196,13 @@ namespace VeraCrypt { ShowWarning ("UNSUPPORTED_CHARS_IN_PWD_RECOM"); } } + + if (options.Pim < 0) + { + options.Pim = AskPim (StringFormatter (_("Enter PIM for {0}"), wstring (*options.Path))); + } // Keyfiles if (!options.Keyfiles) options.Keyfiles = AskKeyfiles(); @@ -1158,8 +1216,10 @@ namespace VeraCrypt if (options.Protection == VolumeProtection::HiddenVolumeReadOnly) { if (!options.ProtectionPassword) options.ProtectionPassword = AskPassword (_("Enter password for hidden volume")); + if (options.ProtectionPim < 0) + options.ProtectionPim = AskPim (_("Enter PIM for hidden volume")); if (!options.ProtectionKeyfiles) options.ProtectionKeyfiles = AskKeyfiles (_("Enter keyfile for hidden volume")); } @@ -1170,8 +1230,9 @@ namespace VeraCrypt catch (ProtectionPasswordIncorrect &e) { ShowInfo (e); options.ProtectionPassword.reset(); + options.ProtectionPim = -1; } catch (PasswordIncorrect &e) { if (++incorrectPasswordCount > 2 && !options.UseBackupHeaders) @@ -1336,21 +1397,24 @@ namespace VeraCrypt while (!volume) { ShowString (L"\n"); options.Password = AskPassword(); + options.Pim = AskPim(); options.Keyfiles = AskKeyfiles(); try { volume = Core->OpenVolume ( options.Path, options.PreserveTimestamps, options.Password, + options.Pim, kdf, false, options.Keyfiles, options.Protection, options.ProtectionPassword, + options.ProtectionPim, options.ProtectionKdf, options.ProtectionKeyfiles, options.SharedAccessAllowed, VolumeType::Unknown, @@ -1373,9 +1437,9 @@ namespace VeraCrypt UserEnrichRandomPool(); // Re-encrypt volume header SecureBuffer newHeaderBuffer (volume->GetLayout()->GetHeaderSize()); - Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, volume->GetHeader(), options.Password, options.Keyfiles); + Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, volume->GetHeader(), options.Password, options.Pim, options.Keyfiles); // Write volume header int headerOffset = volume->GetLayout()->GetHeaderOffset(); shared_ptr <File> volumeFile = volume->GetFile(); @@ -1433,8 +1497,9 @@ namespace VeraCrypt while (!decryptedLayout) { options.Password = AskPassword (L"\n" + LangString["ENTER_HEADER_BACKUP_PASSWORD"]); + options.Pim = AskPim (_("Enter PIM")); options.Keyfiles = AskKeyfiles(); try { @@ -1454,9 +1519,9 @@ namespace VeraCrypt backupFile.ReadAt (headerBuffer, layout->GetType() == VolumeType::Hidden ? layout->GetHeaderSize() : 0); // Decrypt header shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password); - if (layout->GetHeader()->Decrypt (headerBuffer, *passwordKey, kdf, false, layout->GetSupportedKeyDerivationFunctions(false), layout->GetSupportedEncryptionAlgorithms(), layout->GetSupportedEncryptionModes())) + if (layout->GetHeader()->Decrypt (headerBuffer, *passwordKey, options.Pim, kdf, false, layout->GetSupportedKeyDerivationFunctions(false), layout->GetSupportedEncryptionAlgorithms(), layout->GetSupportedEncryptionModes())) { decryptedLayout = layout; break; } @@ -1478,9 +1543,9 @@ namespace VeraCrypt UserEnrichRandomPool(); // Re-encrypt volume header SecureBuffer newHeaderBuffer (decryptedLayout->GetHeaderSize()); - Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Keyfiles); + Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles); // Write volume header int headerOffset = decryptedLayout->GetHeaderOffset(); if (headerOffset >= 0) @@ -1492,9 +1557,9 @@ namespace VeraCrypt if (decryptedLayout->HasBackupHeader()) { // Re-encrypt backup volume header - Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Keyfiles); + Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles); // Write backup volume header headerOffset = decryptedLayout->GetBackupHeaderOffset(); if (headerOffset >= 0) diff --git a/src/Main/TextUserInterface.h b/src/Main/TextUserInterface.h index 01f344bb..2392f090 100644..100755 --- a/src/Main/TextUserInterface.h +++ b/src/Main/TextUserInterface.h @@ -23,15 +23,16 @@ namespace VeraCrypt virtual FilePath AskFilePath (const wxString &message = wxEmptyString) const; virtual shared_ptr <KeyfileList> AskKeyfiles (const wxString &message = L"") const; virtual shared_ptr <VolumePassword> AskPassword (const wxString &message = L"", bool verify = false) const; + virtual int AskPim (const wxString &message = L"") const; virtual ssize_t AskSelection (ssize_t optionCount, ssize_t defaultOption = -1) const; virtual wstring AskString (const wxString &message = wxEmptyString) const; virtual shared_ptr <VolumePath> AskVolumePath (const wxString &message = L"") const; virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const; virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const; virtual void BeginBusyState () const { } - virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const; + virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const; virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const; virtual void CreateVolume (shared_ptr <VolumeCreationOptions> options) const; virtual void DeleteSecurityTokenKeyfiles () const; virtual void DoShowError (const wxString &message) const; diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp index 62966e77..9abe0e6a 100644..100755 --- a/src/Main/UserInterface.cpp +++ b/src/Main/UserInterface.cpp @@ -897,8 +897,9 @@ namespace VeraCrypt { cmdLine.ArgMountOptions.Path = cmdLine.ArgVolumePath; cmdLine.ArgMountOptions.MountPoint = cmdLine.ArgMountPoint; cmdLine.ArgMountOptions.Password = cmdLine.ArgPassword; + cmdLine.ArgMountOptions.Pim = cmdLine.ArgPim; cmdLine.ArgMountOptions.Keyfiles = cmdLine.ArgKeyfiles; cmdLine.ArgMountOptions.SharedAccessAllowed = cmdLine.ArgForce; cmdLine.ArgMountOptions.TrueCryptMode = cmdLine.ArgTrueCryptMode; if (cmdLine.ArgHash) @@ -987,9 +988,9 @@ namespace VeraCrypt BackupVolumeHeaders (cmdLine.ArgVolumePath); return true; case CommandId::ChangePassword: - ChangePassword (cmdLine.ArgVolumePath, cmdLine.ArgPassword, cmdLine.ArgCurrentHash, cmdLine.ArgTrueCryptMode, cmdLine.ArgKeyfiles, cmdLine.ArgNewPassword, cmdLine.ArgNewKeyfiles, cmdLine.ArgHash); + ChangePassword (cmdLine.ArgVolumePath, cmdLine.ArgPassword, cmdLine.ArgPim, cmdLine.ArgCurrentHash, cmdLine.ArgTrueCryptMode, cmdLine.ArgKeyfiles, cmdLine.ArgNewPassword, cmdLine.ArgNewPim, cmdLine.ArgNewKeyfiles, cmdLine.ArgHash); return true; case CommandId::CreateKeyfile: CreateKeyfile (cmdLine.ArgFilePath); @@ -1008,8 +1009,9 @@ namespace VeraCrypt options->EA = cmdLine.ArgEncryptionAlgorithm; options->Filesystem = cmdLine.ArgFilesystem; options->Keyfiles = cmdLine.ArgKeyfiles; options->Password = cmdLine.ArgPassword; + options->Pim = cmdLine.ArgPim; options->Quick = cmdLine.ArgQuick; options->Size = cmdLine.ArgSize; options->Type = cmdLine.ArgVolumeType; diff --git a/src/Main/UserInterface.h b/src/Main/UserInterface.h index 1c94afdd..91e905d3 100644..100755 --- a/src/Main/UserInterface.h +++ b/src/Main/UserInterface.h @@ -28,9 +28,9 @@ namespace VeraCrypt virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const = 0; virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const = 0; virtual void BeginBusyState () const = 0; - virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const = 0; + virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const = 0; virtual void CheckRequirementsForMountingVolume () const; virtual void CloseExplorerWindows (shared_ptr <VolumeInfo> mountedVolume) const; virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const = 0; virtual void CreateVolume (shared_ptr <VolumeCreationOptions> options) const = 0; |