From 5eecbdf93f2bb94ca018bc5fbee0ebc07b824746 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 26 Jul 2022 14:19:12 +0200 Subject: [PATCH] Fix: KeySettings for DesFire --- RFiDGear/DataAccessLayer/Local/Constants.cs | 18 ++++- .../Remote/FromFile/DatabaseReaderWriter.cs | 7 ++ .../Remote/FromIO/RFiDDevice.cs | 37 +++++++++ RFiDGear/Resources/Manifest.de.resx | 81 +++++++++++++++++++ RFiDGear/Resources/Manifest.en.resx | 78 ++++++++++++++++++ RFiDGear/View/Splash.xaml | 6 +- .../MifareClassicSetupView.xaml | 2 +- .../TabPageMifareClassicDataExplorerView.xaml | 8 +- .../TabPageMifareClassicKeySetupView.xaml | 36 +++++---- .../MifareDesfireSetupView.xaml | 2 +- ...MifareDesfireApplicationMasteringView.xaml | 18 ++--- .../TabPageMifareDesfireDataExplorerView.xaml | 16 ++-- ...TabPageMifareDesfireFileMasteringView.xaml | 8 +- RFiDGear/View/UpdateNotifierView.xaml | 2 +- RFiDGear/ViewModel/MainWindowViewModel.cs | 6 +- 15 files changed, 274 insertions(+), 51 deletions(-) diff --git a/RFiDGear/DataAccessLayer/Local/Constants.cs b/RFiDGear/DataAccessLayer/Local/Constants.cs index 97664a0..51c9b58 100644 --- a/RFiDGear/DataAccessLayer/Local/Constants.cs +++ b/RFiDGear/DataAccessLayer/Local/Constants.cs @@ -100,7 +100,6 @@ public enum TaskType_MifareUltralightTask public enum TaskType_MifareDesfireTask { None, - ChangeDefault, AppExistCheck, ReadAppSettings, PICCMasterKeyChangeover, @@ -112,7 +111,8 @@ public enum TaskType_MifareDesfireTask WriteData, DeleteFile, DeleteApplication, - FormatDesfireCard + FormatDesfireCard, + ChangeDefault } @@ -183,16 +183,30 @@ public enum CARD_TYPE { Unspecified, ISO15693, + SAM_AV2, Mifare1K, Mifare2K, Mifare4K, DESFire, DESFireEV1, DESFireEV2, + DESFireEV3, + FeliCa, + iCode1, + MifarePlus_SL0_2K, + MifarePlus_SL0_4K, + MifarePlus_SL1_2K, + MifarePlus_SL1_4K, MifarePlus_SL3_1K, MifarePlus_SL3_2K, MifarePlus_SL3_4K, + MifarePlusX, + MifarePlusS, + MifareMini, MifareUltralight, + MifareUltralightC, + TagIt, + HIDiClass16KS, GENERIC_T_CL_A }; diff --git a/RFiDGear/DataAccessLayer/Remote/FromFile/DatabaseReaderWriter.cs b/RFiDGear/DataAccessLayer/Remote/FromFile/DatabaseReaderWriter.cs index 335cc38..aad9fc6 100644 --- a/RFiDGear/DataAccessLayer/Remote/FromFile/DatabaseReaderWriter.cs +++ b/RFiDGear/DataAccessLayer/Remote/FromFile/DatabaseReaderWriter.cs @@ -135,6 +135,13 @@ public bool ReadDatabase(string _fileName = "") @Path.Combine(appDataPath, chipDatabaseFileNameCompressed) : _fileName)) { + if(Directory.GetFiles(appDataPath, "*.tmp").Length > 0) + { + foreach(string tempFile in Directory.GetFiles(appDataPath, "*.tmp")) + { + File.Delete(tempFile); + } + } zip1.ExtractAll(appDataPath, ExtractExistingFileAction.OverwriteSilently); } diff --git a/RFiDGear/DataAccessLayer/Remote/FromIO/RFiDDevice.cs b/RFiDGear/DataAccessLayer/Remote/FromIO/RFiDDevice.cs index 3c10510..fc465a8 100644 --- a/RFiDGear/DataAccessLayer/Remote/FromIO/RFiDDevice.cs +++ b/RFiDGear/DataAccessLayer/Remote/FromIO/RFiDDevice.cs @@ -78,6 +78,7 @@ public static RFiDDevice Instance { instance = new RFiDDevice(); return instance; + } else { @@ -2597,6 +2598,42 @@ public ERROR GetMifareDesfireFileSettings(string _applicationMasterKey, DESFireK #region mifare plus + public ERROR ReadMFPlusChip() + { + try + { + if (readerUnit.ConnectToReader()) + { + if (readerUnit.WaitInsertion(Constants.MAX_WAIT_INSERTION)) + { + if (readerUnit.Connect()) + { + ReaderUnitName = readerUnit.ConnectedName; + + card = readerUnit.GetSingleChip(); + + + if (card.Type == "ISO15693") + { + var cmd = card.Commands as ISO15693Commands;// IMifareUltralightCommands; + + object t = cmd.GetSystemInformation(); + + } + + return ERROR.NoError; + } + } + } + return ERROR.NoError; + } + catch (Exception e) + { + LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : "")); + return ERROR.IOError; + } + } + #endregion #region ISO15693 diff --git a/RFiDGear/Resources/Manifest.de.resx b/RFiDGear/Resources/Manifest.de.resx index 9550dcf..0d6513d 100644 --- a/RFiDGear/Resources/Manifest.de.resx +++ b/RFiDGear/Resources/Manifest.de.resx @@ -1084,4 +1084,85 @@ Needed by: gewählte Aufgabe ausführen + + Daten lesen + + + Daten schreiben + + + MAD Ben. + + + Mit MAD Authentifizieren + + + Ausführungsbedingung für diese Aufgabe + + + Daten auf dem Chip + + + Daten im Zwischenspeicher + + + MAD Zugriff + + + MAD Schlüssel - Aktuell + + + MAD Schlüssel - Neu + + + Sektorschlüssel - Aktuell + + + Sektorschlüssel - Neu + + + Versionsinformationen + + + Ändern + + + Schreibe n Byte(s) + + + Datenindex Startposition + + + Leseschlüssel + + + Leseschl. No. + + + Leseschlüsseltyp + + + Schreibschlüssel + + + Schreibschl. No. + + + Schreibschlüsseltyp + + + Größe in Bytes + + + (L)esen + + + L&S + + + Bitte warten... + + + (S)chreiben + \ No newline at end of file diff --git a/RFiDGear/Resources/Manifest.en.resx b/RFiDGear/Resources/Manifest.en.resx index 153e754..c96cf75 100644 --- a/RFiDGear/Resources/Manifest.en.resx +++ b/RFiDGear/Resources/Manifest.en.resx @@ -1068,4 +1068,82 @@ Needed by: Run Selected Task + + Read Data + + + Write Data + + + Use MAD + + + Use MAD Authentication + + + Execute Condition for this Task + + + Data on Chip + + + Data In Memory/File + + + MAD Access + + + MAD Key - Current + + + MAD Key - Target + + + SectorKey - Current + + + SectorKey - Target + + + Version Info + + + Change + + + Byte Count + + + Data Index Start Position + + + Read Key + + + Read Key No. + + + Read Key Type + + + Write Key + + + Write Key Type + + + Size (Bytes) + + + Read + + + R&W + + + Loading Project... + + + Write + \ No newline at end of file diff --git a/RFiDGear/View/Splash.xaml b/RFiDGear/View/Splash.xaml index ef22bfb..9d5f75a 100644 --- a/RFiDGear/View/Splash.xaml +++ b/RFiDGear/View/Splash.xaml @@ -3,6 +3,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:dal="clr-namespace:RFiDGear.DataAccessLayer" xmlns:gif="http://wpfanimatedgif.codeplex.com" xmlns:local="clr-namespace:RFiDGear.View" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -14,6 +15,9 @@ WindowStartupLocation="CenterScreen" WindowStyle="None" mc:Ignorable="d"> + + + @@ -31,7 +35,7 @@ Margin="238,286,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" - Content="Loading Project..." + Content="{Binding LocalizationResourceSet, Converter={StaticResource Localization}, ConverterParameter='labelContentSplashScreenLoadingData'}" FontSize="14" FontWeight="ExtraBold" /> diff --git a/RFiDGear/View/TaskViews/RFIDTasks/MifareClassicTask/MifareClassicSetupView.xaml b/RFiDGear/View/TaskViews/RFIDTasks/MifareClassicTask/MifareClassicSetupView.xaml index 73008b2..c653d45 100644 --- a/RFiDGear/View/TaskViews/RFIDTasks/MifareClassicTask/MifareClassicSetupView.xaml +++ b/RFiDGear/View/TaskViews/RFIDTasks/MifareClassicTask/MifareClassicSetupView.xaml @@ -195,7 +195,7 @@ Grid.Row="2" Grid.ColumnSpan="4" Margin="8,0,8,0" - Header="ExecuteCondition"> + Header="{Binding LocalizationResourceSet, Converter={StaticResource Localization}, ConverterParameter='groupBoxHeaderAllTasksExecuteCondition'}"> diff --git a/RFiDGear/View/TaskViews/RFIDTasks/MifareClassicTask/MifareClassicTaskTabPages/TabPageMifareClassicDataExplorerView.xaml b/RFiDGear/View/TaskViews/RFIDTasks/MifareClassicTask/MifareClassicTaskTabPages/TabPageMifareClassicDataExplorerView.xaml index 569d314..e937e2c 100644 --- a/RFiDGear/View/TaskViews/RFIDTasks/MifareClassicTask/MifareClassicTaskTabPages/TabPageMifareClassicDataExplorerView.xaml +++ b/RFiDGear/View/TaskViews/RFIDTasks/MifareClassicTask/MifareClassicTaskTabPages/TabPageMifareClassicDataExplorerView.xaml @@ -58,7 +58,7 @@ Margin="8,0,8,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" - Header="Data on Chip" + Header="{Binding LocalizationResourceSet, Converter={StaticResource Localization}, ConverterParameter='groupBoxHeaderMifareClassicTaskDataExplorerDataInChip'}" IsEnabled="{Binding IsDataExplorerEditTabEnabled}"> + Content="{Binding LocalizationResourceSet, Converter={StaticResource Localization}, ConverterParameter='buttonContentMifareClassicSetupWriteData'}" />