From 9a80f54ae4f11e31559198ba6bec14b4cbf0f178 Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 11 Jan 2011 18:23:36 +0000 Subject: establish secure channel git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@883 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/smcc/activation/SecureChannel.java | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 smccTest/src/main/java/at/gv/egiz/smcc/activation/SecureChannel.java (limited to 'smccTest/src/main/java') diff --git a/smccTest/src/main/java/at/gv/egiz/smcc/activation/SecureChannel.java b/smccTest/src/main/java/at/gv/egiz/smcc/activation/SecureChannel.java new file mode 100644 index 00000000..303b1b68 --- /dev/null +++ b/smccTest/src/main/java/at/gv/egiz/smcc/activation/SecureChannel.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.smcc.activation; + +import java.nio.ByteBuffer; +import javax.crypto.spec.SecretKeySpec; +import javax.smartcardio.Card; +import javax.smartcardio.CardChannel; +import javax.smartcardio.CardException; +import javax.smartcardio.CommandAPDU; +import javax.smartcardio.ResponseAPDU; + +/** + * + * @author clemens + */ +public class SecureChannel extends CardChannel { + + CardChannel basicChannel; + + SecretKeySpec kenc; + SecretKeySpec kmac; + byte[] kencssc; + byte[] kmacssc; + + public SecureChannel(CardChannel basicChannel, + SecretKeySpec kenc, SecretKeySpec kmac, + byte[] kencssc, byte[] kmacssc) { + this.basicChannel = basicChannel; + this.kenc = kenc; + this.kmac = kmac; + this.kencssc = kencssc; + this.kmacssc = kmacssc; + } + + + @Override + public Card getCard() { + return basicChannel.getCard(); + } + + @Override + public int getChannelNumber() { + return basicChannel.getChannelNumber(); + } + + @Override + public ResponseAPDU transmit(CommandAPDU capdu) throws CardException { + return basicChannel.transmit(capdu); + } + + @Override + public int transmit(ByteBuffer bb, ByteBuffer bb1) throws CardException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void close() throws CardException { + throw new UnsupportedOperationException("Not supported yet."); + } + +} -- cgit v1.2.3