File tree 2 files changed +15
-3
lines changed
globalplatform/src/main/java/org/openjavacard/gp/scp
2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -336,6 +336,9 @@ public void open() throws CardException {
336
336
// create CardAPDU wrapper
337
337
mWrapper = buildWrapper ();
338
338
339
+ // this is where we start using MAC
340
+ mWrapper .startMAC ();
341
+
339
342
// perform EXTERNAL AUTHENTICATE to authenticate to card
340
343
LOG .debug ("performing authentication" );
341
344
performExternalAuthenticate (hostCryptogram );
Original file line number Diff line number Diff line change @@ -36,10 +36,10 @@ public abstract class SCPWrapper {
36
36
/** Session keys in use */
37
37
protected final GPKeySet mKeys ;
38
38
39
- /** Command encryption currently enabled? */
40
- protected boolean mENC ;
41
39
/** Command authentication currently enabled? */
42
40
protected boolean mMAC ;
41
+ /** Command encryption currently enabled? */
42
+ protected boolean mENC ;
43
43
/** Response authentication currently enabled? */
44
44
protected boolean mRMAC ;
45
45
/** Response encryption currently enabled? */
@@ -51,14 +51,23 @@ public abstract class SCPWrapper {
51
51
*/
52
52
SCPWrapper (GPKeySet keys ) {
53
53
mKeys = keys ;
54
- // SCP0102 and SCP03 all start with MAC enabled
54
+ // most protocols start with MAC enabled
55
55
mMAC = true ;
56
56
// other options must be enabled by client
57
57
mENC = false ;
58
58
mRMAC = false ;
59
59
mRENC = false ;
60
60
}
61
61
62
+ /**
63
+ * Used to start command authentication when it is expected
64
+ *
65
+ * Subclasses may want to set up state.
66
+ */
67
+ protected void startMAC () {
68
+ mMAC = true ;
69
+ }
70
+
62
71
/**
63
72
* Used to start command encryption when it is expected
64
73
*
You can’t perform that action at this time.
0 commit comments