|
28 | 28 | import org.openjavacard.gp.keys.GPKeyUsage;
|
29 | 29 | import org.openjavacard.gp.protocol.GP;
|
30 | 30 | import org.openjavacard.gp.structure.GPInitUpdateResponse;
|
31 |
| -import org.openjavacard.gp.wrapper.GPBasicWrapper; |
32 | 31 | import org.openjavacard.iso.ISO7816;
|
33 | 32 | import org.openjavacard.iso.SW;
|
34 | 33 | import org.openjavacard.iso.SWException;
|
@@ -58,8 +57,6 @@ public class GPSecureChannel extends CardChannel {
|
58 | 57 | private final SecureRandom mRandom;
|
59 | 58 | /** Context for checks */
|
60 | 59 | private final GPContext mContext;
|
61 |
| - /** Underlying channel wrapper for communication */ |
62 |
| - private final GPBasicWrapper mBasicWrapper; |
63 | 60 | /** Underlying card channel */
|
64 | 61 | private final CardChannel mChannel;
|
65 | 62 | /** Initial static keys */
|
@@ -90,18 +87,17 @@ public class GPSecureChannel extends CardChannel {
|
90 | 87 | * Objects are not intended to be reconfigured.
|
91 | 88 | * <p/>
|
92 | 89 | * @param context for this secure channel
|
93 |
| - * @param basicWrapper to communicate through |
| 90 | + * @param channel to communicate through |
94 | 91 | * @param keys to use
|
95 | 92 | * @param protocolPolicy to conform to
|
96 | 93 | * @param securityPolicy to conform to
|
97 | 94 | */
|
98 |
| - public GPSecureChannel(GPContext context, GPBasicWrapper basicWrapper, |
| 95 | + public GPSecureChannel(GPContext context, CardChannel channel, |
99 | 96 | GPKeySet keys, GPKeyDiversification diversification,
|
100 | 97 | SCPProtocolPolicy protocolPolicy, SCPSecurityPolicy securityPolicy) {
|
101 | 98 | mRandom = new SecureRandom();
|
102 | 99 | mContext = context;
|
103 |
| - mBasicWrapper = basicWrapper; |
104 |
| - mChannel = mBasicWrapper.getChannel(); |
| 100 | + mChannel = channel; |
105 | 101 | mStaticKeys = keys;
|
106 | 102 | mDiversification = diversification;
|
107 | 103 | mProtocolPolicy = protocolPolicy;
|
@@ -242,7 +238,7 @@ private ResponseAPDU transmitInternal(CommandAPDU command) throws CardException
|
242 | 238 | // wrap the command (sign, encrypt)
|
243 | 239 | CommandAPDU wrappedCommand = mWrapper.wrap(command);
|
244 | 240 | // send the wrapped command
|
245 |
| - ResponseAPDU wrappedResponse = mBasicWrapper.transmitRaw(wrappedCommand); |
| 241 | + ResponseAPDU wrappedResponse = mChannel.transmit(wrappedCommand); |
246 | 242 | // unwrap the response, but not if it is an error
|
247 | 243 | int sw = wrappedResponse.getSW();
|
248 | 244 | ResponseAPDU response = wrappedResponse;
|
@@ -547,7 +543,7 @@ private GPInitUpdateResponse performInitializeUpdate(byte keyVersion, byte keyId
|
547 | 543 | hostChallenge
|
548 | 544 | );
|
549 | 545 | // and transmit it on the underlying channel
|
550 |
| - ResponseAPDU initResponse = mBasicWrapper.transmitRaw(initCommand); |
| 546 | + ResponseAPDU initResponse = mChannel.transmit(initCommand); |
551 | 547 | // check the response
|
552 | 548 | checkResponse(initResponse);
|
553 | 549 | // parse the response
|
|
0 commit comments