|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jason.client.SecureCardAccessor
Field Summary | |
private MyCipher |
cipher
|
private short |
id
|
private byte[] |
jdf
|
private KeyStore |
keyStore
|
private static byte[] |
loginData
|
private RemoteCardAccessor |
remoteCardAccessor
|
private byte |
role
|
static byte |
ROLE_CARD
|
private java.security.SecureRandom |
secureRandom
|
private XORKey |
sessionKey
|
private MySignature |
signature
|
Fields inherited from interface jason.Constants |
ANYBODY, APPLICATION_DATA_TAG, FCI_TAG, JC_RMI_DATA_TAG, JDF_TAG, NORMAL_TAG, SECURITY_AUTHENTIC, SECURITY_CONFIDENTIAL, SECURITY_CONFIDENTIAL_AUTHENTIC, SECURITY_PLAIN, TYPE_ARRAY, TYPE_BOOLEAN, TYPE_BOOLEAN_ARRAY, TYPE_BYTE, TYPE_BYTE_ARRAY, TYPE_INT, TYPE_INT_ARRAY, TYPE_OBJECT, TYPE_OBJECT_ARRAY, TYPE_SHORT, TYPE_SHORT_ARRAY, TYPE_VOID |
Constructor Summary | |
SecureCardAccessor()
Initialises all values to the default values. |
Method Summary | |
private static java.lang.String |
arrayToString(byte[] data)
Translates a byte array to a string |
private static java.lang.String |
arrayToString(byte[] data,
int offset,
int length)
Translates part of a byte array to a string |
private void |
checkFreshnessCounter(byte freshnessCounter)
Checks if the freshnessCounter is the successor of an earlier
freshness counter. |
byte[] |
exchangeAPDU(byte[] sendData)
Calls selectAPDU(byte[]) of invokeAPDU(byte[]) according to the command. |
short |
getSessionIdentifier()
Returns the session identifier. |
private byte[] |
invokeAPDU(byte[] sendData)
Encrypts and signs the parameters when necessary and decrypt / verifies the response from the card |
boolean |
login(byte role,
KeyStore keyStore)
Logs in with the specified role byte given the keystore. |
boolean |
putKey(byte role,
byte keyType,
java.security.Key key,
byte sessionAlgorithm)
Uploads a key to the key store object on the smart card. |
private byte[] |
selectAPDU(byte[] sendData)
Select the card applet by its AID. |
void |
setRemote(java.lang.String host,
int port)
Connects to a CardAccessor run on another host. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final byte ROLE_CARD
private RemoteCardAccessor remoteCardAccessor
private short id
private byte[] jdf
private byte role
private MyCipher cipher
private java.security.SecureRandom secureRandom
private MySignature signature
private KeyStore keyStore
private XORKey sessionKey
private static byte[] loginData
Constructor Detail |
public SecureCardAccessor()
Method Detail |
public byte[] exchangeAPDU(byte[] sendData) throws java.io.IOException
selectAPDU(byte[])
of invokeAPDU(byte[])
according to the command.
exchangeAPDU
in interface com.sun.javacard.javax.smartcard.rmiclient.CardAccessor
sendData
- Eiter a select APDU command or an invoke APDU command
java.io.IOException
- when an exception is thrown by selectAPDU(byte[])
or invokeAPDU(byte[])
public short getSessionIdentifier()
getSessionIdentifier
in interface com.sun.javacard.javax.smartcard.rmiclient.CardAccessor
public void setRemote(java.lang.String host, int port) throws java.rmi.RemoteException
host
- The foreign hostport
- The foreign port number
java.rmi.RemoteException
- when the connection cannot be set uppublic boolean login(byte role, KeyStore keyStore) throws java.io.IOException
role
- role bytekeyStore
- key store containing a key for the role
java.io.IOException
- when something went wrongpublic boolean putKey(byte role, byte keyType, java.security.Key key, byte sessionAlgorithm) throws java.io.IOException
role
- role bytekeyType
- value from KeyBuilder.TYPE_...key
- the key itselfsessionAlgorithm
- value from Cipher.ALG_...
java.io.IOException
- when something else went wrongprivate byte[] selectAPDU(byte[] sendData) throws java.io.IOException
sendData
- Select APDU command
java.io.IOException
- when something went wrongprivate byte[] invokeAPDU(byte[] sendData) throws java.io.IOException
sendData
- The marshalled parameters in plain text
JasonSecurityException
- when the card returns an ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED
InvalidSignatureException
- when the card signature does not match the locally calculated signature
InvalidFreshnessCounterException
- when the authentic response does not carry the correct freshness counter
java.io.IOException
private void checkFreshnessCounter(byte freshnessCounter) throws InvalidFreshnessCounterException
freshnessCounter
is the successor of an earlier
freshness counter. If this is true the freshness counter is increased.
freshnessCounter
- The freshnessCounter found in the card response
InvalidFreshnessCounterException
- when the counter is not a successor of the last counterprivate static java.lang.String arrayToString(byte[] data)
data
-
private static java.lang.String arrayToString(byte[] data, int offset, int length)
data
- offset
- length
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |