com.cryptware.jsmartosapi
Class SmartOS

java.lang.Object
  extended by com.cryptware.jsmartosapi.SmartOS
Direct Known Subclasses:
SmartOSK1, SmartOSKW

public class SmartOS
extends java.lang.Object

Base class for all SmartOS smart cards

Author:
Ugo Chirico

Field Summary
static int LIFECYCLE_FORMATTED
          Lifecycle formatted
static int LIFECYCLE_UNFORMATTED
          Lifecycle unformatted
static int MODE_CARDID
          Mode CardId
static int MODE_CARDINFO
          Mode CardInfo
static int MODE_CARDLIFECYCLE
          Mode CardLifeCycle
static int MODE_FORMAT_KEY_ERR_COUNT
          Mode Card FormatKeyErrorCounter
 
Constructor Summary
SmartOS(SmartCard sc)
          Constructs a SmartOS object
 
Method Summary
 ResponseAPDU ChangeReferenceData(byte id, java.lang.String pin)
          ChangeReferenceData Command
Sends a Change Reference Data Command APDU with specified pin
 ResponseAPDU Format(java.lang.String key)
          Sends a Format Command APDU with specified key
 ResponseAPDU GetData(byte mode)
          GetData Command
Sends a Get Data Command APDU with specified mode
 ResponseAPDU VerifyPIN(byte id, java.lang.String pin)
          VerifyPIN Command
Sends a Verify PIN Command APDU with specified PIN
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_CARDINFO

public static final int MODE_CARDINFO
Mode CardInfo

See Also:
Constant Field Values

MODE_CARDID

public static final int MODE_CARDID
Mode CardId

See Also:
Constant Field Values

MODE_CARDLIFECYCLE

public static final int MODE_CARDLIFECYCLE
Mode CardLifeCycle

See Also:
Constant Field Values

MODE_FORMAT_KEY_ERR_COUNT

public static final int MODE_FORMAT_KEY_ERR_COUNT
Mode Card FormatKeyErrorCounter

See Also:
Constant Field Values

LIFECYCLE_UNFORMATTED

public static final int LIFECYCLE_UNFORMATTED
Lifecycle unformatted

See Also:
Constant Field Values

LIFECYCLE_FORMATTED

public static final int LIFECYCLE_FORMATTED
Lifecycle formatted

See Also:
Constant Field Values
Constructor Detail

SmartOS

public SmartOS(SmartCard sc)
Constructs a SmartOS object

Parameters:
sc - SmartCard object used to send commands
Method Detail

Format

public ResponseAPDU Format(java.lang.String key)
Sends a Format Command APDU with specified key

Parameters:
key - Format Key (must be 10 bytes long)
Returns:
the response

GetData

public ResponseAPDU GetData(byte mode)
GetData Command
Sends a Get Data Command APDU with specified mode

Parameters:
mode - Mode value:
  • MODE_CARDINFO - Info about the card
  • MODE_CARDID Card's unique ID
  • MODE_CARDLIFECYCLE Card's life cycle
    • Returns:
      the response

VerifyPIN

public ResponseAPDU VerifyPIN(byte id,
                              java.lang.String pin)
VerifyPIN Command
Sends a Verify PIN Command APDU with specified PIN

Parameters:
id - the PIN identifier:
- for SmartOS K1 and KW ID is 0 for PIN, 1 for PUK
- For SmartOS K2 ID is related to a Security Data Object created before
pin - the PIN
Returns:
the response

ChangeReferenceData

public ResponseAPDU ChangeReferenceData(byte id,
                                        java.lang.String pin)
ChangeReferenceData Command
Sends a Change Reference Data Command APDU with specified pin

Parameters:
id - the PIN identifier:
- for SmartOS K1 and KW ID is 0 for PIN, 1 for PUK
- For SmartOS K2 ID is related to a Security Data Object created before
pin - the PIN
Returns:
the response