VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2023-06-29 00:06:20 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2023-06-29 00:06:20 +0200
commit034b64f4153550cbe5849bcbfc27e187377cc512 (patch)
treed831496163c3891031765010bf1934406b0c4a3c /src/Main/Forms
parent502ab9112a7624dbd7c1c90c2e12ed45512b8b3c (diff)
downloadVeraCrypt-034b64f4153550cbe5849bcbfc27e187377cc512.tar.gz
VeraCrypt-034b64f4153550cbe5849bcbfc27e187377cc512.zip
EMV keyfile support: Overall code improvements and bug fixes
Diffstat (limited to 'src/Main/Forms')
-rw-r--r--src/Main/Forms/ChangePasswordDialog.cpp2
-rw-r--r--src/Main/Forms/Forms.cpp10
-rw-r--r--src/Main/Forms/Forms.h2
-rw-r--r--src/Main/Forms/MainFrame.cpp4
-rw-r--r--src/Main/Forms/MountOptionsDialog.cpp2
-rw-r--r--src/Main/Forms/PreferencesDialog.cpp2
-rw-r--r--src/Main/Forms/SecurityTokenKeyfilesDialog.cpp52
-rw-r--r--src/Main/Forms/VolumeCreationWizard.cpp8
-rw-r--r--src/Main/Forms/WaitDialog.cpp20
9 files changed, 56 insertions, 46 deletions
diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp
index 0992cf3b..0b54fefc 100644
--- a/src/Main/Forms/ChangePasswordDialog.cpp
+++ b/src/Main/Forms/ChangePasswordDialog.cpp
@@ -204,7 +204,7 @@ namespace VeraCrypt
wxBusyCursor busy;
ChangePasswordThreadRoutine routine(Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps,
CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetVolumePim(), CurrentPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf), CurrentPasswordPanel->GetTrueCryptMode(),CurrentPasswordPanel->GetKeyfiles(),
- newPassword, newPim, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf), NewPasswordPanel->GetHeaderWipeCount(), Gui->GetPreferences().ActivateEMVOption);
+ newPassword, newPim, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf), NewPasswordPanel->GetHeaderWipeCount(), Gui->GetPreferences().EMVSupportEnabled);
Gui->ExecuteWaitThreadRoutine (this, &routine);
}
diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp
index 8667a741..e92b970e 100644
--- a/src/Main/Forms/Forms.cpp
+++ b/src/Main/Forms/Forms.cpp
@@ -2208,13 +2208,13 @@ PreferencesDialogBase::PreferencesDialogBase( wxWindow* parent, wxWindowID id, c
bSizer128->Add( sbSizer37, 0, wxEXPAND|wxALL, 5 );
- wxStaticBoxSizer* sbSizer38;
- sbSizer38 = new wxStaticBoxSizer( new wxStaticBox( SecurityTokensPage, wxID_ANY, _("IDT_EMV_OPTIONS") ), wxVERTICAL );
+ wxStaticBoxSizer* sbSizer38;
+ sbSizer38 = new wxStaticBoxSizer( new wxStaticBox( SecurityTokensPage, wxID_ANY, _("IDT_EMV_OPTIONS") ), wxVERTICAL );
- ActivateEMVOptionCheckBox = new wxCheckBox( sbSizer38->GetStaticBox(), wxID_ANY, _("IDC_ACTIVATE_EMV_OPTION"), wxDefaultPosition, wxDefaultSize, 0 );
- sbSizer38->Add( ActivateEMVOptionCheckBox, 0, wxALL, 5 );
+ EMVSupportEnabledCheckBox = new wxCheckBox( sbSizer38->GetStaticBox(), wxID_ANY, _("IDC_ENABLE_EMV_SUPPORT"), wxDefaultPosition, wxDefaultSize, 0 );
+ sbSizer38->Add( EMVSupportEnabledCheckBox, 0, wxALL, 5 );
- bSizer128->Add( sbSizer38, 0, wxEXPAND|wxALL, 5 );
+ bSizer128->Add( sbSizer38, 0, wxEXPAND|wxALL, 5 );
bSizer127->Add( bSizer128, 1, wxEXPAND|wxALL, 5 );
diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h
index 904e96dd..60937550 100644
--- a/src/Main/Forms/Forms.h
+++ b/src/Main/Forms/Forms.h
@@ -593,7 +593,7 @@ namespace VeraCrypt
wxTextCtrl* Pkcs11ModulePathTextCtrl;
wxButton* SelectPkcs11ModuleButton;
wxCheckBox* CloseSecurityTokenSessionsAfterMountCheckBox;
- wxCheckBox* ActivateEMVOptionCheckBox;
+ wxCheckBox* EMVSupportEnabledCheckBox;
wxListCtrl* HotkeyListCtrl;
wxTextCtrl* HotkeyTextCtrl;
wxButton* AssignHotkeyButton;
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index b52682ce..4b9b9bf1 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -683,7 +683,7 @@ namespace VeraCrypt
{
mountOptions.Pim = CmdLine->ArgPim;
}
- mountOptions.EMVOption = GetPreferences().ActivateEMVOption;
+ mountOptions.EMVSupportEnabled = GetPreferences().EMVSupportEnabled;
Gui->MountAllFavoriteVolumes (mountOptions);
}
catch (exception &e)
@@ -718,7 +718,7 @@ namespace VeraCrypt
{
mountOptions.Pim = CmdLine->ArgPim;
}
- mountOptions.EMVOption = GetPreferences().ActivateEMVOption;
+ mountOptions.EMVSupportEnabled = GetPreferences().EMVSupportEnabled;
try
{
diff --git a/src/Main/Forms/MountOptionsDialog.cpp b/src/Main/Forms/MountOptionsDialog.cpp
index 28a9919c..4b8f7ce5 100644
--- a/src/Main/Forms/MountOptionsDialog.cpp
+++ b/src/Main/Forms/MountOptionsDialog.cpp
@@ -193,7 +193,7 @@ namespace VeraCrypt
Options.MountPoint = make_shared <DirectoryPath> (mountPoint);
Options.FilesystemOptions = FilesystemOptionsTextCtrl->GetValue();
- Options.EMVOption = Gui->GetPreferences().ActivateEMVOption;
+ Options.EMVSupportEnabled = Gui->GetPreferences().EMVSupportEnabled;
EndModal (wxID_OK);
}
diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp
index 6caae325..abf1d505 100644
--- a/src/Main/Forms/PreferencesDialog.cpp
+++ b/src/Main/Forms/PreferencesDialog.cpp
@@ -96,7 +96,7 @@ namespace VeraCrypt
// Security tokens
Pkcs11ModulePathTextCtrl->SetValue (wstring (Preferences.SecurityTokenModule));
TC_CHECK_BOX_VALIDATOR (CloseSecurityTokenSessionsAfterMount);
- TC_CHECK_BOX_VALIDATOR (ActivateEMVOption);
+ TC_CHECK_BOX_VALIDATOR (EMVSupportEnabled);
// System integration
TC_CHECK_BOX_VALIDATOR (StartOnLogon);
diff --git a/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp b/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
index 2c5896a7..d78e22fd 100644
--- a/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
+++ b/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
@@ -53,7 +53,7 @@ namespace VeraCrypt
wxBusyCursor busy;
SecurityTokenKeyfileListCtrl->DeleteAllItems();
- SecurityTokenKeyfileList = Token::GetAvailableKeyfiles(Gui->GetPreferences().ActivateEMVOption);
+ SecurityTokenKeyfileList = Token::GetAvailableKeyfiles(Gui->GetPreferences().EMVSupportEnabled);
size_t i = 0;
foreach (const shared_ptr<TokenKeyfile> key, SecurityTokenKeyfileList)
@@ -177,34 +177,38 @@ namespace VeraCrypt
}
}
- void SecurityTokenKeyfilesDialog::OnListItemSelected(wxListEvent &event) {
- if (event.GetItem().GetData() != (wxUIntPtr) nullptr) {
- BOOL deletable = true;
- foreach(long
- item, Gui->GetListCtrlSelectedItems(SecurityTokenKeyfileListCtrl))
- {
- TokenKeyfile *keyfile = reinterpret_cast <TokenKeyfile *> (SecurityTokenKeyfileListCtrl->GetItemData(
- item));
- if (!keyfile->Token->isEditable()) {
- deletable = false;
- }
- }
- if (deletable) {
- DeleteButton->Enable();
- }
- ExportButton->Enable();
- OKButton->Enable();
- }
- }
+ void SecurityTokenKeyfilesDialog::OnListItemSelected(wxListEvent &event)
+ {
+ if (event.GetItem().GetData() != (wxUIntPtr) nullptr)
+ {
+ BOOL deletable = true;
+ foreach(long
+ item, Gui->GetListCtrlSelectedItems(SecurityTokenKeyfileListCtrl))
+ {
+ TokenKeyfile *keyfile = reinterpret_cast <TokenKeyfile *> (SecurityTokenKeyfileListCtrl->GetItemData(item));
+ if (!keyfile->Token->isEditable())
+ {
+ deletable = false;
+ break;
+ }
+ }
+ if (deletable)
+ {
+ DeleteButton->Enable();
+ }
+ ExportButton->Enable();
+ OKButton->Enable();
+ }
+ }
void SecurityTokenKeyfilesDialog::OnOKButtonClick ()
{
foreach (long item, Gui->GetListCtrlSelectedItems (SecurityTokenKeyfileListCtrl))
- {
- TokenKeyfile *key = reinterpret_cast <TokenKeyfile *> (SecurityTokenKeyfileListCtrl->GetItemData(item));
+ {
+ TokenKeyfile *key = reinterpret_cast <TokenKeyfile *> (SecurityTokenKeyfileListCtrl->GetItemData(item));
- SelectedSecurityTokenKeyfilePaths.push_back(*key);
- }
+ SelectedSecurityTokenKeyfilePaths.push_back(*key);
+ }
EndModal (wxID_OK);
}
}
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index 0487455f..5939fc1b 100644
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -795,7 +795,7 @@ namespace VeraCrypt
shared_ptr <VolumePassword> hiddenPassword;
try
{
- hiddenPassword = Keyfile::ApplyListToPassword (Keyfiles, Password, Gui->GetPreferences().ActivateEMVOption);
+ hiddenPassword = Keyfile::ApplyListToPassword (Keyfiles, Password, Gui->GetPreferences().EMVSupportEnabled);
}
catch (...)
{
@@ -846,7 +846,7 @@ namespace VeraCrypt
shared_ptr <VolumePassword> hiddenPassword;
try
{
- hiddenPassword = Keyfile::ApplyListToPassword (Keyfiles, Password, Gui->GetPreferences().ActivateEMVOption);
+ hiddenPassword = Keyfile::ApplyListToPassword (Keyfiles, Password, Gui->GetPreferences().EMVSupportEnabled);
}
catch (...)
{
@@ -1032,7 +1032,7 @@ namespace VeraCrypt
options->Size = VolumeSize;
options->Type = OuterVolume ? VolumeType::Normal : SelectedVolumeType;
options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*SelectedHash, false);
- options->EMVOption = Gui->GetPreferences().ActivateEMVOption;
+ options->EMVSupportEnabled = Gui->GetPreferences().EMVSupportEnabled;
Creator.reset (new VolumeCreator);
@@ -1162,7 +1162,7 @@ namespace VeraCrypt
// remember Outer password and keyfiles in order to be able to compare it with those of Hidden volume
try
{
- OuterPassword = Keyfile::ApplyListToPassword (Keyfiles, Password, Gui->GetPreferences().ActivateEMVOption);
+ OuterPassword = Keyfile::ApplyListToPassword (Keyfiles, Password, Gui->GetPreferences().EMVSupportEnabled);
}
catch (...)
{
diff --git a/src/Main/Forms/WaitDialog.cpp b/src/Main/Forms/WaitDialog.cpp
index c2e0be96..720c2bdc 100644
--- a/src/Main/Forms/WaitDialog.cpp
+++ b/src/Main/Forms/WaitDialog.cpp
@@ -9,8 +9,8 @@
#include "System.h"
#include "Volume/EncryptionModeXTS.h"
#include "Main/GraphicUserInterface.h"
+#include "Common/PCSCException.h"
#include "Common/SecurityToken.h"
-#include "Common/IccDataExtractor.h"
#include "WaitDialog.h"
namespace VeraCrypt
@@ -103,12 +103,18 @@ namespace VeraCrypt
VC_CONVERT_EXCEPTION (VolumeException);
VC_CONVERT_EXCEPTION (PasswordException);
- VC_CONVERT_EXCEPTION (PCSCException);
- VC_CONVERT_EXCEPTION (WinscardLibraryNotInitialized);
- VC_CONVERT_EXCEPTION (InvalidEMVPath);
- VC_CONVERT_EXCEPTION (EMVKeyfileDataNotFound);
- VC_CONVERT_EXCEPTION (EMVPANNotFound);
- VC_CONVERT_EXCEPTION (EMVUnknownCardType);
+ VC_CONVERT_EXCEPTION (PCSCException);
+ VC_CONVERT_EXCEPTION (CommandAPDUNotValid);
+ VC_CONVERT_EXCEPTION (ExtendedAPDUNotSupported);
+ VC_CONVERT_EXCEPTION (ScardLibraryInitializationFailed);
+ VC_CONVERT_EXCEPTION (EMVUnknownCardType);
+ VC_CONVERT_EXCEPTION (EMVSelectAIDFailed);
+ VC_CONVERT_EXCEPTION (EMVIccCertNotFound);
+ VC_CONVERT_EXCEPTION (EMVIssuerCertNotFound);
+ VC_CONVERT_EXCEPTION (EMVCPLCNotFound);
+ VC_CONVERT_EXCEPTION (InvalidEMVPath);
+ VC_CONVERT_EXCEPTION (EMVKeyfileDataNotFound);
+ VC_CONVERT_EXCEPTION (EMVPANNotFound);
throw *ex;
}