com.cryptware.jsle4442api
Class SLE4442

java.lang.Object
  extended by com.cryptware.jsle4442api.SLE4442

public class SLE4442
extends java.lang.Object

SLE4442 implementation

Author:
Ugo Chirico - http://www.cryptware.it

Field Summary
static int BLU_ERROR_CARD_MODE_ERROR
          Error card mode
static int BLU_ERROR_CHANGE_PIN
          Error in change pin
static int BLU_ERROR_CPU_CARD
          Current smart card is Microprocessor card
static int BLU_ERROR_INCOMPATIBLE_READER
          this DLL does not work with the specified reader
static int BLU_ERROR_INTERNAL_ERROR
          An internal error has occured
static int BLU_ERROR_INVALID_HANDLE
          card handle non valido
static int BLU_ERROR_INVALID_MEMORY_RANGE
          Invalid memory range
static int BLU_ERROR_INVALID_PARAMETER
          one or more parameters are invalid
static int BLU_ERROR_NO_PIN_ATTEMPTS_LEFT
          no PIN verification attempts left, card probably locked
static int BLU_ERROR_NO_SMARTCARD
          No smart card in the reader
static int BLU_ERROR_NOT_INITIALIZED
          bluMemUV Initialize not called
static int BLU_ERROR_PIN_VERIFY_FAILED
          PIN verification failed
static int BLU_ERROR_PIN_VERIFY_NEEDED
          PIN must be verified before access is possible
static int BLU_ERROR_READING_FAILURE
          could not read all data from card
static int BLU_ERROR_REMOVED_CARD
          The card has been removed
static int BLU_ERROR_SHARING_VIOLATION
          Sharing violation
static int BLU_ERROR_UNKNOWN_CARD
          could not identify card
static int BLU_ERROR_UNRESPONSIVE_CARD
          Unresponsive smart card
static int BLU_ERROR_WRITING_FAILURE
          could not write all data to card
static int BLU_ERROR_WRONG_DRIVER
          Not valid driver file
static int OK_ERROR_BUFFER_OVERFLOW
          Buffer overflow
static int OK_ERROR_COMMUNICATE
          General communication error
static int OK_ERROR_ENTRY_NOT_FOUND
          Entry not found
static int OK_ERROR_FILE_NOT_FOUND
          File not found
static int OK_ERROR_GENERAL_FAILURE
          General failure.
static int OK_ERROR_ILLEGAL_ARGUMENT
          Illegal argument
static int OK_ERROR_INSUFFICIENT_PRIV
          You currently do not have the rights to execute the requested action.
static int OK_ERROR_INVALID_CFG_FILE
          Invalid configuration file
static int OK_ERROR_INVALID_HANDLE
          Invalid handle
static int OK_ERROR_ITEM_ALREADY_EXISTS
          The specified item alread exists.
static int OK_ERROR_ITEM_EXPIRED
          Some item (e.g. a certificate) has expired.
static int OK_ERROR_ITEM_NOT_FOUND
          An item (e.g. a key of a specific name) could not be found
static int OK_ERROR_ITEMS_LEFT
          There are still items left, therefore e.g. the directory / structure etc. can't be deleted.
static int OK_ERROR_NO_MORE_SECTIONS
          No more sections
static int OK_ERROR_NOT_ENOUGH_MEMORY
          Not enough memory
static int OK_ERROR_NOT_SUPPORTED
          The requested functionality is not supported at this time / under this OS / in this situation etc.
static int OK_ERROR_OPEN_FILE
          File opening failed
static int OK_ERROR_PW_LOCKED
          The password has been presented several times wrong and is therefore locked.
static int OK_ERROR_PW_NOT_LOCKED
          The password is not locked
static int OK_ERROR_PW_TOO_LONG
          The length of the password was too long.
static int OK_ERROR_PW_TOO_SHORT
          The lenght of the password was too short.
static int OK_ERROR_PW_WRONG
          The presented password is wrong
static int OK_ERROR_READ_FIO
          File IO read error
static int OK_ERROR_SECTION_NOT_FOUND
          Section not found
static int OK_ERROR_SEM_USED
          The semaphore is currently use by an other process
static int OK_ERROR_TIMEOUT
          A timeout has occurred
static int OK_ERROR_UNEXPECTED_RET_VALUE
          Unexpected return value
static int OK_ERROR_WRITE_FIO
          File IO write error
static int SCM_ERROR_INVALID_MEMORY_RANGE
           
static int SCM_ERROR_PIN_ATTEMPTS_LEFT
           
static int SCM_ERROR_PIN_VERIFY_FAILED
           
static int SCM_ERROR_PIN_VERIFY_NEEDED
           
static int SCM_ERROR_REMOVED_CARD
           
static int SCM_INCOMPATIBLE_READER
           
static int SCM_UNKNOWN_CARD
           
 
Method Summary
static int changePIN(byte[] oldpin, byte[] newpin)
          Changes the PIN
static int close()
          Closes the native library
static int connect(Reader reader)
          Connects to the SLE4442 plugged in to the given reader
static int disconnect()
          Closes the connection to the SLE4442
static boolean isSmartCardPresent()
          Checks if the smart card is present in the reader
static void loadNativeLibrary()
          Loads the Native Library SLE4442Lib The library must be in the directory java.library.path or user.home
static int open()
          Opens the native library
static int readMainMemory(byte[] buffer, int offset, int len)
          Reads from the main memory
static int updateMainMemory(byte[] buffer, int offset, int len)
          Writes in the main memory
static int verifyPIN(byte[] pin)
          Verifies the PIN
static int writeProtectionMemoryBits(byte[] buffer, int offset, int len)
          Writes the bits of the protection memory
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCM_INCOMPATIBLE_READER

public static final int SCM_INCOMPATIBLE_READER
See Also:
Constant Field Values

SCM_UNKNOWN_CARD

public static final int SCM_UNKNOWN_CARD
See Also:
Constant Field Values

SCM_ERROR_INVALID_MEMORY_RANGE

public static final int SCM_ERROR_INVALID_MEMORY_RANGE
See Also:
Constant Field Values

SCM_ERROR_PIN_VERIFY_NEEDED

public static final int SCM_ERROR_PIN_VERIFY_NEEDED
See Also:
Constant Field Values

SCM_ERROR_PIN_VERIFY_FAILED

public static final int SCM_ERROR_PIN_VERIFY_FAILED
See Also:
Constant Field Values

SCM_ERROR_PIN_ATTEMPTS_LEFT

public static final int SCM_ERROR_PIN_ATTEMPTS_LEFT
See Also:
Constant Field Values

SCM_ERROR_REMOVED_CARD

public static final int SCM_ERROR_REMOVED_CARD
See Also:
Constant Field Values

OK_ERROR_INSUFFICIENT_PRIV

public static final int OK_ERROR_INSUFFICIENT_PRIV
You currently do not have the rights to execute the requested action. Usually a password has to be presented in advance.

See Also:
Constant Field Values

OK_ERROR_PW_WRONG

public static final int OK_ERROR_PW_WRONG
The presented password is wrong

See Also:
Constant Field Values

OK_ERROR_PW_LOCKED

public static final int OK_ERROR_PW_LOCKED
The password has been presented several times wrong and is therefore locked. Usually use some administrator tool to unblock it.

See Also:
Constant Field Values

OK_ERROR_PW_TOO_SHORT

public static final int OK_ERROR_PW_TOO_SHORT
The lenght of the password was too short.

See Also:
Constant Field Values

OK_ERROR_PW_TOO_LONG

public static final int OK_ERROR_PW_TOO_LONG
The length of the password was too long.

See Also:
Constant Field Values

OK_ERROR_PW_NOT_LOCKED

public static final int OK_ERROR_PW_NOT_LOCKED
The password is not locked

See Also:
Constant Field Values

OK_ERROR_ITEM_NOT_FOUND

public static final int OK_ERROR_ITEM_NOT_FOUND
An item (e.g. a key of a specific name) could not be found

See Also:
Constant Field Values

OK_ERROR_ITEMS_LEFT

public static final int OK_ERROR_ITEMS_LEFT
There are still items left, therefore e.g. the directory / structure etc. can't be deleted.

See Also:
Constant Field Values

OK_ERROR_INVALID_CFG_FILE

public static final int OK_ERROR_INVALID_CFG_FILE
Invalid configuration file

See Also:
Constant Field Values

OK_ERROR_SECTION_NOT_FOUND

public static final int OK_ERROR_SECTION_NOT_FOUND
Section not found

See Also:
Constant Field Values

OK_ERROR_ENTRY_NOT_FOUND

public static final int OK_ERROR_ENTRY_NOT_FOUND
Entry not found

See Also:
Constant Field Values

OK_ERROR_NO_MORE_SECTIONS

public static final int OK_ERROR_NO_MORE_SECTIONS
No more sections

See Also:
Constant Field Values

OK_ERROR_ITEM_ALREADY_EXISTS

public static final int OK_ERROR_ITEM_ALREADY_EXISTS
The specified item alread exists.

See Also:
Constant Field Values

OK_ERROR_ITEM_EXPIRED

public static final int OK_ERROR_ITEM_EXPIRED
Some item (e.g. a certificate) has expired.

See Also:
Constant Field Values

OK_ERROR_UNEXPECTED_RET_VALUE

public static final int OK_ERROR_UNEXPECTED_RET_VALUE
Unexpected return value

See Also:
Constant Field Values

OK_ERROR_COMMUNICATE

public static final int OK_ERROR_COMMUNICATE
General communication error

See Also:
Constant Field Values

OK_ERROR_NOT_ENOUGH_MEMORY

public static final int OK_ERROR_NOT_ENOUGH_MEMORY
Not enough memory

See Also:
Constant Field Values

OK_ERROR_BUFFER_OVERFLOW

public static final int OK_ERROR_BUFFER_OVERFLOW
Buffer overflow

See Also:
Constant Field Values

OK_ERROR_TIMEOUT

public static final int OK_ERROR_TIMEOUT
A timeout has occurred

See Also:
Constant Field Values

OK_ERROR_NOT_SUPPORTED

public static final int OK_ERROR_NOT_SUPPORTED
The requested functionality is not supported at this time / under this OS / in this situation etc.

See Also:
Constant Field Values

OK_ERROR_ILLEGAL_ARGUMENT

public static final int OK_ERROR_ILLEGAL_ARGUMENT
Illegal argument

See Also:
Constant Field Values

OK_ERROR_READ_FIO

public static final int OK_ERROR_READ_FIO
File IO read error

See Also:
Constant Field Values

OK_ERROR_WRITE_FIO

public static final int OK_ERROR_WRITE_FIO
File IO write error

See Also:
Constant Field Values

OK_ERROR_INVALID_HANDLE

public static final int OK_ERROR_INVALID_HANDLE
Invalid handle

See Also:
Constant Field Values

OK_ERROR_GENERAL_FAILURE

public static final int OK_ERROR_GENERAL_FAILURE
General failure. Use this error code in cases where no other errors match and it is not worth to define a new error code.

See Also:
Constant Field Values

OK_ERROR_FILE_NOT_FOUND

public static final int OK_ERROR_FILE_NOT_FOUND
File not found

See Also:
Constant Field Values

OK_ERROR_OPEN_FILE

public static final int OK_ERROR_OPEN_FILE
File opening failed

See Also:
Constant Field Values

OK_ERROR_SEM_USED

public static final int OK_ERROR_SEM_USED
The semaphore is currently use by an other process

See Also:
Constant Field Values

BLU_ERROR_NOT_INITIALIZED

public static final int BLU_ERROR_NOT_INITIALIZED
bluMemUV Initialize not called

See Also:
Constant Field Values

BLU_ERROR_INCOMPATIBLE_READER

public static final int BLU_ERROR_INCOMPATIBLE_READER
this DLL does not work with the specified reader

See Also:
Constant Field Values

BLU_ERROR_UNKNOWN_CARD

public static final int BLU_ERROR_UNKNOWN_CARD
could not identify card

See Also:
Constant Field Values

BLU_ERROR_INVALID_PARAMETER

public static final int BLU_ERROR_INVALID_PARAMETER
one or more parameters are invalid

See Also:
Constant Field Values

BLU_ERROR_INVALID_MEMORY_RANGE

public static final int BLU_ERROR_INVALID_MEMORY_RANGE
Invalid memory range

See Also:
Constant Field Values

BLU_ERROR_PIN_VERIFY_NEEDED

public static final int BLU_ERROR_PIN_VERIFY_NEEDED
PIN must be verified before access is possible

See Also:
Constant Field Values

BLU_ERROR_PIN_VERIFY_FAILED

public static final int BLU_ERROR_PIN_VERIFY_FAILED
PIN verification failed

See Also:
Constant Field Values

BLU_ERROR_NO_PIN_ATTEMPTS_LEFT

public static final int BLU_ERROR_NO_PIN_ATTEMPTS_LEFT
no PIN verification attempts left, card probably locked

See Also:
Constant Field Values

BLU_ERROR_REMOVED_CARD

public static final int BLU_ERROR_REMOVED_CARD
The card has been removed

See Also:
Constant Field Values

BLU_ERROR_READING_FAILURE

public static final int BLU_ERROR_READING_FAILURE
could not read all data from card

See Also:
Constant Field Values

BLU_ERROR_WRITING_FAILURE

public static final int BLU_ERROR_WRITING_FAILURE
could not write all data to card

See Also:
Constant Field Values

BLU_ERROR_INVALID_HANDLE

public static final int BLU_ERROR_INVALID_HANDLE
card handle non valido

See Also:
Constant Field Values

BLU_ERROR_INTERNAL_ERROR

public static final int BLU_ERROR_INTERNAL_ERROR
An internal error has occured

See Also:
Constant Field Values

BLU_ERROR_CARD_MODE_ERROR

public static final int BLU_ERROR_CARD_MODE_ERROR
Error card mode

See Also:
Constant Field Values

BLU_ERROR_WRONG_DRIVER

public static final int BLU_ERROR_WRONG_DRIVER
Not valid driver file

See Also:
Constant Field Values

BLU_ERROR_CHANGE_PIN

public static final int BLU_ERROR_CHANGE_PIN
Error in change pin

See Also:
Constant Field Values

BLU_ERROR_NO_SMARTCARD

public static final int BLU_ERROR_NO_SMARTCARD
No smart card in the reader

See Also:
Constant Field Values

BLU_ERROR_UNRESPONSIVE_CARD

public static final int BLU_ERROR_UNRESPONSIVE_CARD
Unresponsive smart card

See Also:
Constant Field Values

BLU_ERROR_SHARING_VIOLATION

public static final int BLU_ERROR_SHARING_VIOLATION
Sharing violation

See Also:
Constant Field Values

BLU_ERROR_CPU_CARD

public static final int BLU_ERROR_CPU_CARD
Current smart card is Microprocessor card

See Also:
Constant Field Values
Method Detail

connect

public static int connect(Reader reader)
Connects to the SLE4442 plugged in to the given reader

Parameters:
reader -
Returns:
0 if the connection succeeds, an error code if it fails.

loadNativeLibrary

public static void loadNativeLibrary()
Loads the Native Library SLE4442Lib The library must be in the directory java.library.path or user.home


open

public static int open()
Opens the native library

Returns:
the result

close

public static int close()
Closes the native library

Returns:
the result

disconnect

public static int disconnect()
Closes the connection to the SLE4442

Returns:
0 if the disconnection succeeds, an error code if it fails.

readMainMemory

public static int readMainMemory(byte[] buffer,
                                 int offset,
                                 int len)
Reads from the main memory

Parameters:
buffer - the output buffer
offset - the offset in the card's memory
len - the amount of bytes to read
Returns:
the result

updateMainMemory

public static int updateMainMemory(byte[] buffer,
                                   int offset,
                                   int len)
Writes in the main memory

Parameters:
buffer - the input buffer
offset - the offset in the card's memory
len - the amount of bytes to write
Returns:
the result

writeProtectionMemoryBits

public static int writeProtectionMemoryBits(byte[] buffer,
                                            int offset,
                                            int len)
Writes the bits of the protection memory

Parameters:
buffer - the input buffer to compare to set the bits of the protection memory
offset - the offset in the card's protection memory
len - the amount of bytes to write
Returns:
the result

verifyPIN

public static int verifyPIN(byte[] pin)
Verifies the PIN

Parameters:
pin - the PIN that must be 3 bytes long
Returns:
the result

changePIN

public static int changePIN(byte[] oldpin,
                            byte[] newpin)
Changes the PIN

Parameters:
oldpin - the old PIN (3 bytes long)
newpin - the new PIN (3 bytes long)
Returns:
the result

isSmartCardPresent

public static boolean isSmartCardPresent()
Checks if the smart card is present in the reader

Returns:
true if the smart card is present