Skip to content

Commit

Permalink
Fix: KeySettings for DesFire
Browse files Browse the repository at this point in the history
  • Loading branch information
c3rebro committed Jul 26, 2022
1 parent 661aff1 commit 5eecbdf
Show file tree
Hide file tree
Showing 15 changed files with 274 additions and 51 deletions.
18 changes: 16 additions & 2 deletions RFiDGear/DataAccessLayer/Local/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public enum TaskType_MifareUltralightTask
public enum TaskType_MifareDesfireTask
{
None,
ChangeDefault,
AppExistCheck,
ReadAppSettings,
PICCMasterKeyChangeover,
Expand All @@ -112,7 +111,8 @@ public enum TaskType_MifareDesfireTask
WriteData,
DeleteFile,
DeleteApplication,
FormatDesfireCard
FormatDesfireCard,
ChangeDefault

}

Expand Down Expand Up @@ -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
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
37 changes: 37 additions & 0 deletions RFiDGear/DataAccessLayer/Remote/FromIO/RFiDDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public static RFiDDevice Instance
{
instance = new RFiDDevice();
return instance;

}
else
{
Expand Down Expand Up @@ -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
Expand Down
81 changes: 81 additions & 0 deletions RFiDGear/Resources/Manifest.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1084,4 +1084,85 @@ Needed by:
<data name="contextMenuItemExecuteSelectedItem" xml:space="preserve">
<value>gewählte Aufgabe ausführen</value>
</data>
<data name="buttonContentMifareClassicSetupReadData" xml:space="preserve">
<value>Daten lesen</value>
</data>
<data name="buttonContentMifareClassicSetupWriteData" xml:space="preserve">
<value>Daten schreiben</value>
</data>
<data name="checkBoxContentMifareClassicTaskUseMAD" xml:space="preserve">
<value>MAD Ben.</value>
</data>
<data name="checkBoxContentMifareClassicTaskUseMADToAuth" xml:space="preserve">
<value>Mit MAD Authentifizieren</value>
</data>
<data name="groupBoxHeaderAllTasksExecuteCondition" xml:space="preserve">
<value>Ausführungsbedingung für diese Aufgabe</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskDataExplorerDataInChip" xml:space="preserve">
<value>Daten auf dem Chip</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskDataExplorerDataInMemory" xml:space="preserve">
<value>Daten im Zwischenspeicher</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskMADAccess" xml:space="preserve">
<value>MAD Zugriff</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskMADKeyCurrent" xml:space="preserve">
<value>MAD Schlüssel - Aktuell</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskMADKeyTarget" xml:space="preserve">
<value>MAD Schlüssel - Neu</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskSectorCurrent" xml:space="preserve">
<value>Sektorschlüssel - Aktuell</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskSectorTarget" xml:space="preserve">
<value>Sektorschlüssel - Neu</value>
</data>
<data name="groupBoxHeaderUpdateWindowVersionInfo" xml:space="preserve">
<value>Versionsinformationen</value>
</data>
<data name="labelContentChange" xml:space="preserve">
<value>Ändern</value>
</data>
<data name="labelContentDesfireDataExplorerByteCount" xml:space="preserve">
<value>Schreibe n Byte(s)</value>
</data>
<data name="labelContentDesfireDataExplorerIndexStart" xml:space="preserve">
<value>Datenindex Startposition</value>
</data>
<data name="labelContentDesfireDataExplorerReadKey" xml:space="preserve">
<value>Leseschlüssel</value>
</data>
<data name="labelContentDesfireDataExplorerReadKeyNo" xml:space="preserve">
<value>Leseschl. No.</value>
</data>
<data name="labelContentDesfireDataExplorerReadKeyType" xml:space="preserve">
<value>Leseschlüsseltyp</value>
</data>
<data name="labelContentDesfireDataExplorerWriteKey" xml:space="preserve">
<value>Schreibschlüssel</value>
</data>
<data name="labelContentDesfireDataExplorerWriteKeyNo" xml:space="preserve">
<value>Schreibschl. No.</value>
</data>
<data name="labelContentDesfireDataExplorerWriteKeyType" xml:space="preserve">
<value>Schreibschlüsseltyp</value>
</data>
<data name="labelContentMifareClassicTaskMADFileSize" xml:space="preserve">
<value>Größe in Bytes</value>
</data>
<data name="labelContentRead" xml:space="preserve">
<value>(L)esen</value>
</data>
<data name="labelContentReadAndWrite" xml:space="preserve">
<value>L&amp;S</value>
</data>
<data name="labelContentSplashScreenLoadingData" xml:space="preserve">
<value>Bitte warten...</value>
</data>
<data name="labelContentWrite" xml:space="preserve">
<value>(S)chreiben</value>
</data>
</root>
78 changes: 78 additions & 0 deletions RFiDGear/Resources/Manifest.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1068,4 +1068,82 @@ Needed by:
<data name="contextMenuItemExecuteSelectedItem" xml:space="preserve">
<value>Run Selected Task</value>
</data>
<data name="buttonContentMifareClassicSetupReadData" xml:space="preserve">
<value>Read Data</value>
</data>
<data name="buttonContentMifareClassicSetupWriteData" xml:space="preserve">
<value>Write Data</value>
</data>
<data name="checkBoxContentMifareClassicTaskUseMAD" xml:space="preserve">
<value>Use MAD</value>
</data>
<data name="checkBoxContentMifareClassicTaskUseMADToAuth" xml:space="preserve">
<value>Use MAD Authentication</value>
</data>
<data name="groupBoxHeaderAllTasksExecuteCondition" xml:space="preserve">
<value>Execute Condition for this Task</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskDataExplorerDataInChip" xml:space="preserve">
<value>Data on Chip</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskDataExplorerDataInMemory" xml:space="preserve">
<value>Data In Memory/File</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskMADAccess" xml:space="preserve">
<value>MAD Access</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskMADKeyCurrent" xml:space="preserve">
<value>MAD Key - Current</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskMADKeyTarget" xml:space="preserve">
<value>MAD Key - Target</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskSectorCurrent" xml:space="preserve">
<value>SectorKey - Current</value>
</data>
<data name="groupBoxHeaderMifareClassicTaskSectorTarget" xml:space="preserve">
<value>SectorKey - Target</value>
</data>
<data name="groupBoxHeaderUpdateWindowVersionInfo" xml:space="preserve">
<value>Version Info</value>
</data>
<data name="labelContentChange" xml:space="preserve">
<value>Change</value>
</data>
<data name="labelContentDesfireDataExplorerByteCount" xml:space="preserve">
<value>Byte Count</value>
</data>
<data name="labelContentDesfireDataExplorerIndexStart" xml:space="preserve">
<value>Data Index Start Position</value>
</data>
<data name="labelContentDesfireDataExplorerReadKey" xml:space="preserve">
<value>Read Key</value>
</data>
<data name="labelContentDesfireDataExplorerReadKeyNo" xml:space="preserve">
<value>Read Key No.</value>
</data>
<data name="labelContentDesfireDataExplorerReadKeyType" xml:space="preserve">
<value>Read Key Type</value>
</data>
<data name="labelContentDesfireDataExplorerWriteKey" xml:space="preserve">
<value>Write Key</value>
</data>
<data name="labelContentDesfireDataExplorerWriteKeyType" xml:space="preserve">
<value>Write Key Type</value>
</data>
<data name="labelContentMifareClassicTaskMADFileSize" xml:space="preserve">
<value>Size (Bytes)</value>
</data>
<data name="labelContentRead" xml:space="preserve">
<value>Read</value>
</data>
<data name="labelContentReadAndWrite" xml:space="preserve">
<value>R&amp;W</value>
</data>
<data name="labelContentSplashScreenLoadingData" xml:space="preserve">
<value>Loading Project...</value>
</data>
<data name="labelContentWrite" xml:space="preserve">
<value>Write</value>
</data>
</root>
6 changes: 5 additions & 1 deletion RFiDGear/View/Splash.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -14,6 +15,9 @@
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
<Window.Resources>
<dal:ResourceLoader x:Key="Localization"/>
</Window.Resources>
<Window.Background>
<SolidColorBrush Opacity="0" Color="White" />
</Window.Background>
Expand All @@ -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" />
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="175" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}">
<Grid
Margin="0,0,0,0"
Expand Down Expand Up @@ -181,7 +181,7 @@
Margin="8,0,8,8"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Header="Data in Memory/File"
Header="{Binding LocalizationResourceSet, Converter={StaticResource Localization}, ConverterParameter='groupBoxHeaderMifareClassicTaskDataExplorerDataInMemory'}"
IsEnabled="{Binding IsDataExplorerEditTabEnabled}">
<Grid
Margin="0,0,0,0"
Expand Down Expand Up @@ -324,7 +324,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Command="{Binding WriteDataCommand}"
Content="Write" />
Content="{Binding LocalizationResourceSet, Converter={StaticResource Localization}, ConverterParameter='buttonContentMifareClassicSetupWriteData'}" />
<Button
Grid.Row="4"
Grid.Column="0"
Expand All @@ -334,7 +334,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Command="{Binding ReadDataCommand}"
Content="Read" />
Content="{Binding LocalizationResourceSet, Converter={StaticResource Localization}, ConverterParameter='buttonContentMifareClassicSetupReadData'}"/>
<GroupBox
Grid.Row="0"
Grid.Column="0"
Expand Down
Loading

0 comments on commit 5eecbdf

Please sign in to comment.