24
24
import org .openjavacard .gp .client .GPCard ;
25
25
import org .openjavacard .gp .client .GPContext ;
26
26
import org .openjavacard .tool .command .base .BasicGPCommand ;
27
+ import org .openjavacard .iso .AID ;
27
28
import org .openjavacard .util .HexUtil ;
28
29
29
30
import javax .smartcardio .CardException ;
@@ -39,41 +40,45 @@ public class GPIdentity extends BasicGPCommand {
39
40
names = "--new-iin" ,
40
41
description = "New Issuer Identification Number (IIN)"
41
42
)
42
- private byte [] iin ;
43
+ private byte [] newIIN ;
43
44
44
45
@ Parameter (
45
46
names = "--new-cin" ,
46
47
description = "New Card Identification Number (CIN)"
47
48
)
48
- private byte [] cin ;
49
+ private byte [] newCIN ;
49
50
50
51
@ Parameter (
51
52
names = "--new-isd" ,
52
53
description = "New AID for the ISD of the card"
53
54
)
54
- private byte [] isd ;
55
+ private byte [] newISD ;
55
56
56
57
@ Override
57
58
protected void performOperation (GPContext context , GPCard card ) throws CardException {
58
59
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
+
60
66
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 );
64
69
}
65
- byte [] iin = card .getCardIIN ();
66
70
if (iin != null ) {
67
71
os .println (" IIN " + HexUtil .bytesToHex (iin ));
68
72
}
69
- byte [] cin = card .getCardCIN ();
70
73
if (cin != null ) {
71
74
os .println (" CIN " + HexUtil .bytesToHex (cin ));
72
75
}
73
- os .println (" ISD " + card .getISD ());
76
+ if (lid != null ) {
77
+ os .println (" LID " + lid );
78
+ }
74
79
os .println ();
75
80
} else {
76
- card .getIssuerDomain ().changeIdentity (iin , cin , isd );
81
+ card .getIssuerDomain ().changeIdentity (newIIN , newCIN , newISD );
77
82
}
78
83
}
79
84
0 commit comments