Skip to content

Commit 3576b6c

Browse files
committed
GPSecureChannel: eliminate reference to GPCard
We want the SCP independent of GP code itself.
1 parent c736544 commit 3576b6c

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

globalplatform/src/main/java/org/openjavacard/gp/client/GPCard.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ public void connect() throws CardException {
381381
mCardKeyInfo.checkKeysetForUsage(mKeys);
382382

383383
// create a secure channel object
384-
mSecureChannel = new GPSecureChannel(this, mBasicWrapper, mKeys, mDiversification, mProtocolPolicy, mSecurityPolicy);
384+
mSecureChannel = new GPSecureChannel(mContext, mBasicWrapper, mKeys, mDiversification, mProtocolPolicy, mSecurityPolicy);
385385

386386
// set protocol expectation of secure channel
387387
if (mCardData != null) {

globalplatform/src/main/java/org/openjavacard/gp/scp/GPSecureChannel.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.openjavacard.gp.scp;
2121

22-
import org.openjavacard.gp.client.GPCard;
2322
import org.openjavacard.gp.client.GPContext;
2423
import org.openjavacard.gp.crypto.GPBouncy;
2524
import org.openjavacard.gp.crypto.GPCrypto;
@@ -59,8 +58,6 @@ public class GPSecureChannel extends CardChannel {
5958
private final SecureRandom mRandom;
6059
/** Context for checks */
6160
private final GPContext mContext;
62-
/** Reference to the card for communication */
63-
private final GPCard mCard;
6461
/** Underlying channel wrapper for communication */
6562
private final GPBasicWrapper mBasicWrapper;
6663
/** Underlying card channel */
@@ -92,18 +89,17 @@ public class GPSecureChannel extends CardChannel {
9289
* <p/>
9390
* Objects are not intended to be reconfigured.
9491
* <p/>
95-
* @param card this channel is for
92+
* @param context for this secure channel
9693
* @param basicWrapper to communicate through
9794
* @param keys to use
9895
* @param protocolPolicy to conform to
9996
* @param securityPolicy to conform to
10097
*/
101-
public GPSecureChannel(GPCard card, GPBasicWrapper basicWrapper,
98+
public GPSecureChannel(GPContext context, GPBasicWrapper basicWrapper,
10299
GPKeySet keys, GPKeyDiversification diversification,
103100
SCPProtocolPolicy protocolPolicy, SCPSecurityPolicy securityPolicy) {
104101
mRandom = new SecureRandom();
105-
mContext = card.getContext();
106-
mCard = card;
102+
mContext = context;
107103
mBasicWrapper = basicWrapper;
108104
mChannel = mBasicWrapper.getChannel();
109105
mStaticKeys = keys;

0 commit comments

Comments
 (0)