be.zetes.zseidlib

## Class ZsEidLib

- java.lang.Object
- - be.zetes.zseidlib.ZsEidLib

-     public class ZsEidLib
      extends java.lang.Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `ZsEidLib.OnCardEventListener` Card Event Callbacks
    `static interface` | `ZsEidLib.OnCardReaderEventListener` Reader Event Callbacks

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ZsEidLib(Context ctx)` Sets the Android context.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `ReturnCode` | `closeReader()` Close Reader
    `ReturnCode` | `closeSDK()` Close SDK
    `Address` | `getAddress()` Get Address Use getLastError for getting the ReturnCode
    `java.security.cert.X509Certificate` | `getAuthenticationCertificate()` This method reads the eID authenticationCertificate.
    `CardStatus` | `getCardStatus()` Get card status
    `Identity` | `getIdentity()` Get Identity
    `ReturnCode` | `getLastError()` Get the last error code (ReturnCode)
    `java.security.cert.X509Certificate` | `getNonRepudiationCertificate()` This method reads the eID nonRepudiationCertificate.
    `byte[]` | `getPicture()` Get Picture Use getLastError for getting the ReturnCode
    `java.security.cert.X509Certificate` | `getRootCACertificate()` This method reads the eID rootCACertificate.
    `java.lang.String` | `getSdkVersion()` Return SDK Version
    `byte[]` | `getSignature(HashAlgo hashAlgo, byte[] hashData)` This method signs the hashed data
    `java.security.cert.X509Certificate` | `getSubCACertificate()` This method reads the eID subCACertificate.
    `ReturnCode` | `initSDK()` Initialize SDK - This method must be called prior to all the other methods of the SDK.
    `ReturnCode` | `initSDK(java.lang.String preferredReader, java.lang.String oemVersion)` Initialize SDK - This method must be called prior to all the other methods of the SDK.
    `ReturnCode` | `initSDK(java.lang.String preferredReader, java.lang.String oemVersion, int rssi_threshold)` Initialize SDK - This method must be called prior to all the other methods of the SDK.
    `boolean` | `isValidReader()` Check for valid reader
    `ReturnCode` | `powerOffCard()` Power Off Card
    `ReturnCode` | `powerOnCard()` Power On Card
    `void` | `registerCardEventListener(ZsEidLib.OnCardEventListener listener)` Register card event listener.
    `void` | `registerReaderEventListener(ZsEidLib.OnCardReaderEventListener listener)` Register reader event listener.
    `ReturnCode` | `setAutoTurnOff(boolean doesAutoTurnOff)` Enable/Disable Automatic Turnoff for BLE Reader
    `void` | `startScanning()` Start permanent scanning for reader
    `void` | `startScanning(long timeOut)` Start Scanning for BLE device
    `void` | `stopScanning()` Deprecated.
    `void` | `unregisterCardEventListener(ZsEidLib.OnCardEventListener listener)` Unregister card event listener.
    `void` | `unregisterReaderEventListener(ZsEidLib.OnCardReaderEventListener listener)` Unregister reader event listener.
    `ReturnCode` | `verifyPin(java.lang.String pin, KeyType keyType)` This method verifies the pin

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ZsEidLib

          public ZsEidLib(Context ctx)

      Sets the Android context.
      Parameters:
        `ctx` - Android context

  - ### Method Detail

    - #### registerCardEventListener

          public void registerCardEventListener(ZsEidLib.OnCardEventListener listener)

      Register card event listener.
      Parameters:
        `listener` - Card event callback

    - #### unregisterCardEventListener

          public void unregisterCardEventListener(ZsEidLib.OnCardEventListener listener)

      Unregister card event listener.
      Parameters:
        `listener` - Card event callback

    - #### registerReaderEventListener

          public void registerReaderEventListener(ZsEidLib.OnCardReaderEventListener listener)

      Register reader event listener.
      Parameters:
        `listener` - Reader event callback

    - #### unregisterReaderEventListener

          public void unregisterReaderEventListener(ZsEidLib.OnCardReaderEventListener listener)

      Unregister reader event listener.
      Parameters:
        `listener` - Reader event callback

    - #### getLastError

          public ReturnCode getLastError()

      Get the last error code (ReturnCode)
      Returns:
        LastError ReturnCode

    - #### getSdkVersion

          public java.lang.String getSdkVersion()

      Return SDK Version
      Returns:
        SDK_VERSION release version of SDK

    - #### initSDK

          public ReturnCode initSDK()

      Initialize SDK - This method must be called prior to all the other methods of the SDK.
      Returns:
        ReturnCode - A return code indicating the process result.
        ReturnCode.BlueToothNotSupported - Bluetooth not supported.
        ReturnCode.BlueToothNotEnabled - Bluetooth not enabled.
        ReturnCode.OK - Success.

    - #### initSDK

          public ReturnCode initSDK(java.lang.String preferredReader,
                                    java.lang.String oemVersion)

      Initialize SDK - This method must be called prior to all the other methods of the SDK.
      Parameters:
        `preferredReader` - specify a preferred readername to connect to this specific reader (optional)
        `oemVersion` - OEM version of reader family to support (optional)
      Returns:
        ReturnCode - A return code indicating the process result.
        ReturnCode.BlueToothNotSupported - Bluetooth not supported.
        ReturnCode.BlueToothNotEnabled - Bluetooth not enabled.
        ReturnCode.OK - Success.

    - #### initSDK

          public ReturnCode initSDK(java.lang.String preferredReader,
                                    java.lang.String oemVersion,
                                    int rssi_threshold)

      Initialize SDK - This method must be called prior to all the other methods of the SDK.
      Parameters:
        `preferredReader` - specify a preferred readername to connect to this specific reader (optional)
        `oemVersion` - OEM version of reader family to support (optional)
        `rssi_threshold` - threshold to limit the range for scanning for BLE readers (default: -60dB for very close readers) this value only defines the range for finding readers, once connected the reader doesn't need to be kept in close range
      Returns:
        ReturnCode - A return code indicating the process result.
        ReturnCode.BlueToothNotSupported - Bluetooth not supported.
        ReturnCode.BlueToothNotEnabled - Bluetooth not enabled.
        ReturnCode.OK - Success.

    - #### closeSDK

          public ReturnCode closeSDK()

      Close SDK
      Returns:
        ReturnCode - A return code indicating the process result.
        ReturnCode.OK - Success.
        ReturnCode.NOK - Generic error.

    - #### setAutoTurnOff

          public ReturnCode setAutoTurnOff(boolean doesAutoTurnOff)

      Enable/Disable Automatic Turnoff for BLE Reader
      Parameters:
        `doesAutoTurnOff` - boolean for disabling auto turn off feature for BLE reader
      Returns:
        ReturnCode - A return code indicating the process result.
        ReturnCode.OK - Success.
        ReturnCode.NOK - Generic error.

    - #### closeReader

          public ReturnCode closeReader()

      Close Reader
      Returns:
        ReturnCode - A return code indicating the process result.
        ReturnCode.NoReader - No Reader.
        ReturnCode.OK - Success.
        ReturnCode.NOK - Generic error.

    - #### powerOnCard

          public ReturnCode powerOnCard()

      Power On Card
      Returns:
        ReturnCode - A return code indicating the process result.
        ReturnCode.NoReader - No Reader.
        ReturnCode.OK - Success.
        ReturnCode.NOK - Generic error.

    - #### powerOffCard

          public ReturnCode powerOffCard()

      Power Off Card
      Returns:
        ReturnCode - A return code indicating the process result.
        ReturnCode.NoReader - No Reader.
        ReturnCode.OK - Success.
        ReturnCode.NOK - Generic error.

    - #### getIdentity

          public Identity getIdentity()

      Get Identity
      Returns:
        Identity - Identity data or null.
        ReturnCode with getLastError:
        ReturnCode.NoReader - No reader present
        ReturnCode.ManufacturerNameNotSupported - Manufacturer not supported
        ReturnCode.ReaderModelNotSupported - Model not supported
        ReturnCode.ReaderNameNotSupported - Name not supported
        ReturnCode.CardError - Card error
        ReturnCode.ReadError - Error reading card
        ReturnCode.ParseError - Error parsing data from card
        ReturnCode.OK - OK

    - #### getAddress

          public Address getAddress()

      Get Address Use getLastError for getting the ReturnCode
      Returns:
        Address - Address data or null.
        ReturnCode with getLastError:
        ReturnCode.NoReader - No reader present
        ReturnCode.ManufacturerNameNotSupported - Manufacturer not supported
        ReturnCode.ReaderModelNotSupported - Model not supported
        ReturnCode.ReaderNameNotSupported - Name not supported
        ReturnCode.CardError - Card error
        ReturnCode.ReadError - Error reading card
        ReturnCode.ParseError - Error parsing data from card
        ReturnCode.OK - OK

    - #### getPicture

          public byte[] getPicture()

      Get Picture Use getLastError for getting the ReturnCode
      Returns:
        Picture - Picture data or null.
        ReturnCode with getLastError:
        ReturnCode.NoReader - No reader present
        ReturnCode.ManufacturerNameNotSupported - Manufacturer not supported
        ReturnCode.ReaderModelNotSupported - Model not supported
        ReturnCode.ReaderNameNotSupported - Name not supported
        ReturnCode.CardError - Card error
        ReturnCode.ReadError - Error reading card
        ReturnCode.OK - OK

    - #### startScanning

          public void startScanning(long timeOut)

      Start Scanning for BLE device
      Parameters:
        `timeOut` - timeout for scanning

    - #### verifyPin

          public ReturnCode verifyPin(java.lang.String pin,
                                      KeyType keyType)

      This method verifies the pin
      Parameters:
        `pin` - pin for authentication key or non-repudiation key
        `keyType` - type of key
        KeyType.KT_AUTHENTICATION_KEY: authentication key
        KeyType.KT_NONREPUDIATION_KEY: document signing key
      Returns:
        ReturnCode.PinTooShort: Pin Too Short.
        ReturnCode.PinTooLong: Pin Too Long.
        ReturnCode.PinAttemptsLef3: 3 attempts left.
        ReturnCode.PinAttemptsLef2: 2 attempts left.
        ReturnCode.PinAttemptsLef1: 1 attempts left.
        ReturnCode.PinBlocked: Pin Blocked.
        ReturnCode.CardError: Card error.
        ReturnCode.NOK: General error.
        ReturnCode.OK: success.

    - #### getSignature

          public byte[] getSignature(HashAlgo hashAlgo,
                                     byte[] hashData)

      This method signs the hashed data
      Parameters:
        `hashAlgo` - hashing algorithm type
        HashAlgo.HASH_ALGO_NONE HashAlgo.HASH_ALGO_SHA_256
        `hashData` - hash value
      Returns:
        Signature or null on error

    - #### startScanning

          public void startScanning()

      Start permanent scanning for reader

    - #### stopScanning

          @Deprecated
          public void stopScanning()

      Deprecated.
      Stop Scanning for reader

    - #### isValidReader

          public boolean isValidReader()

      Check for valid reader
      Returns:
        true - Reader present
        false - No reader present

    - #### getCardStatus

          public CardStatus getCardStatus()

      Get card status
      Returns:
        see CardStatus

    - #### getAuthenticationCertificate

          public java.security.cert.X509Certificate getAuthenticationCertificate()

      This method reads the eID authenticationCertificate.
      Returns:
        X509Certificate containing authenticationCertificate or null on read error

    - #### getNonRepudiationCertificate

          public java.security.cert.X509Certificate getNonRepudiationCertificate()

      This method reads the eID nonRepudiationCertificate.
      Returns:
        X509Certificate containing nonRepudiationCertificate or null on read error

    - #### getSubCACertificate

          public java.security.cert.X509Certificate getSubCACertificate()

      This method reads the eID subCACertificate.
      Returns:
        X509Certificate containing subCACertificate or null on read error

    - #### getRootCACertificate

          public java.security.cert.X509Certificate getRootCACertificate()

      This method reads the eID rootCACertificate.
      Returns:
        X509Certificate containing rootCACertificate or null on read error