Skip to content

Commit 1beaf11

Browse files
authored
Merge pull request #270 from Yubico/dennisdyallo/apdu
feat: Add ToString override to CommandApdu and ResponseApdu
2 parents 8aabd8b + d616a08 commit 1beaf11

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Yubico.Core/src/Yubico/Core/Iso7816/CommandApdu.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,5 +327,7 @@ private byte[] GetLeField(ApduEncoding apduEncoding)
327327

328328
return leField;
329329
}
330+
331+
public override string ToString() => $"CLA: 0x{Cla:X2} INS: 0x{Ins:X2} P1: 0x{P1:X2} P2: 0x{P2:X2} Lc: {Nc} Le: {Ne} Data: {Data.Length} bytes";
330332
}
331333
}

Yubico.Core/src/Yubico/Core/Iso7816/ResponseApdu.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,7 @@ public ResponseApdu(byte[] dataWithoutSW, short sw)
8585
SW2 = (byte)(sw & 0xFF);
8686
Data = dataWithoutSW.ToArray();
8787
}
88+
89+
public override string ToString() => $"SW1: 0x{SW1:X2} SW2: 0x{SW2:X2} Data: {Data.Span.Length} bytes";
8890
}
8991
}

0 commit comments

Comments
 (0)