2424import org .openjavacard .gp .client .GPCard ;
2525import org .openjavacard .gp .client .GPContext ;
2626import org .openjavacard .tool .command .base .BasicGPCommand ;
27+ import org .openjavacard .iso .AID ;
2728import org .openjavacard .util .HexUtil ;
2829
2930import javax .smartcardio .CardException ;
@@ -39,41 +40,45 @@ public class GPIdentity extends BasicGPCommand {
3940 names = "--new-iin" ,
4041 description = "New Issuer Identification Number (IIN)"
4142 )
42- private byte [] iin ;
43+ private byte [] newIIN ;
4344
4445 @ Parameter (
4546 names = "--new-cin" ,
4647 description = "New Card Identification Number (CIN)"
4748 )
48- private byte [] cin ;
49+ private byte [] newCIN ;
4950
5051 @ Parameter (
5152 names = "--new-isd" ,
5253 description = "New AID for the ISD of the card"
5354 )
54- private byte [] isd ;
55+ private byte [] newISD ;
5556
5657 @ Override
5758 protected void performOperation (GPContext context , GPCard card ) throws CardException {
5859 PrintStream os = System .out ;
59- if (iin == null && cin == null && isd == null ) {
60+ if (newIIN == null && newCIN == null && newISD == null ) {
61+ String lid = card .getLifetimeIdentifier ();
62+ byte [] iin = card .getCardIIN ();
63+ byte [] cin = card .getCardCIN ();
64+ AID isd = card .getISD ();
65+
6066 os .println ("Card identity:" );
61- String identifier = card .getLifetimeIdentifier ();
62- if (identifier != null ) {
63- os .println (" LID " + identifier );
67+ if (isd != null ) {
68+ os .println (" ISD " + isd );
6469 }
65- byte [] iin = card .getCardIIN ();
6670 if (iin != null ) {
6771 os .println (" IIN " + HexUtil .bytesToHex (iin ));
6872 }
69- byte [] cin = card .getCardCIN ();
7073 if (cin != null ) {
7174 os .println (" CIN " + HexUtil .bytesToHex (cin ));
7275 }
73- os .println (" ISD " + card .getISD ());
76+ if (lid != null ) {
77+ os .println (" LID " + lid );
78+ }
7479 os .println ();
7580 } else {
76- card .getIssuerDomain ().changeIdentity (iin , cin , isd );
81+ card .getIssuerDomain ().changeIdentity (newIIN , newCIN , newISD );
7782 }
7883 }
7984
0 commit comments