Finished: NFC Lib v0.9, TODO: CMAC check, Change PICC Key

This commit is contained in:
TheJoKlLa
2020-11-07 21:28:55 +01:00
parent 6c51e40891
commit e4cc1348b8
6 changed files with 547 additions and 265 deletions

View File

@ -71,10 +71,10 @@ namespace NFC.ISO7816_4
return string.Format(pattern_case2, CLA, INS, P1, P2, Le);
case IsoCase.Case3Short:
case IsoCase.Case3Extended:
return string.Format(pattern_case3, CLA, INS, P1, P2, Lc, BitConverter.ToString(Data).Replace("-", " "));
return string.Format(pattern_case3, CLA, INS, P1, P2, Lc, BitConverter.ToString(Data).Replace("-", "").ToLower());
case IsoCase.Case4Short:
case IsoCase.Case4Extended:
return string.Format(pattern_case4, CLA, INS, P1, P2, Lc, BitConverter.ToString(Data).Replace("-", " "), Le);
return string.Format(pattern_case4, CLA, INS, P1, P2, Lc, BitConverter.ToString(Data).Replace("-", "").ToLower(), Le);
default:
throw new Exception("Unknown IsoCase");
}

View File

@ -146,8 +146,15 @@ namespace NFC.ISO7816_4
public override string ToString()
{
string pattern = "SW1: 0x{0:x} | SW2: 0x{1:x} | Body: 0x{2:x}";
return string.Format(pattern, SW1, SW2, Body);
if(Body == null)
{
return string.Format("SW1: 0x{0:x} | SW2: 0x{1:x}", SW1, SW2);
}
else
{
return string.Format("SW1: 0x{0:x} | SW2: 0x{1:x} | Body: {2:x}", SW1, SW2, BitConverter.ToString(Body).Replace("-", "").ToLower());
}
}
#endregion
}