GithubHelp home page GithubHelp logo

eidlib's Introduction

*** NOTE: I am no longer maintaining this project. ***

Native Java e-ID library

The e-ID library is a user-friendly Java library to perform operations on the Belgian electronic identity card.

Since the introduction of the e-ID (electronic identity card) in Belgium there have been a growing number of applications using it. Except for being just a proof of identify, you can perform a vast number of administrative issues from your computer, sign electronic documents and e-mails and have safe chat session for children. A complete description of many of the applications available can be found at http://map.eid.belgium.be. With a growing number of applications, there is an increasing need for support for the e-ID in multiple languages, especially Java, which has grown to become one of the most popular programming languages.

For a long time, the problem with Java was that due to it’s platform independence, driver functionality could not be done in native Java. The only way to circumvent this was to apply JNI (Java Native Interface) which allows native calls to C (or C++, assembly, …). In the original middleware as issued by Fedict a JNI layer is present which allows Java programmers to perform operations on the e-ID card. With the introduction of Java 6 came the javax.smartcardio library (the API can be found here). With this library, one can send APDU messages to smart card readers.

The e-ID library provides a very user-friendly and well documented Java library that can be used without any need for an installation, the only thing that needs to be done is to import the JAR file.

eidlib's People

Contributors

kroverdulve avatar

Stargazers

 avatar Litrik De Roy avatar Maxime Laschet avatar Oleksandr Melnykov avatar Pierre-Henri avatar  avatar  avatar Tomas Dvorak avatar  avatar Vince Verberckt avatar Andy Costanza avatar

Watchers

James Cloos avatar Vince Verberckt avatar  avatar Kalin Maldzhanski avatar Ivan Dlugos avatar

eidlib's Issues

Status of card insert and exit is incorrect.

I am getting always this following ERROR, even the card is inserted or exit, the informations are not keep getting scanned and the status of card insert/exit is not clear.

What am i doing wrong please?

run:
AgeChecker -- type QUIT to end program.
javax.smartcardio.CardException: connect() failed
    at sun.security.smartcardio.TerminalImpl.connect(TerminalImpl.java:84)
    at be.belgium.eid.eidlib.SmartCard.connectCard(SmartCard.java:116)
    at be.belgium.eid.event.CardAlivePromptTask.run(CardAlivePromptTask.java:78)
Caused by: sun.security.smartcardio.PCSCException: SCARD_W_UNRESPONSIVE_CARD
    at sun.security.smartcardio.PCSC.SCardConnect(Native Method)
    at sun.security.smartcardio.CardImpl.<init>(CardImpl.java:100)
    at sun.security.smartcardio.TerminalImpl.connect(TerminalImpl.java:78)
    ... 2 more
javax.smartcardio.CardException: connect() failed
    at sun.security.smartcardio.TerminalImpl.connect(TerminalImpl.java:84)
    at be.belgium.eid.eidlib.SmartCard.connectCard(SmartCard.java:116)
    at be.belgium.eid.event.CardAlivePromptTask.run(CardAlivePromptTask.java:78)
Caused by: sun.security.smartcardio.PCSCException: SCARD_W_UNRESPONSIVE_CARD
    at sun.security.smartcardio.PCSC.SCardConnect(Native Method)
    at sun.security.smartcardio.CardImpl.<init>(CardImpl.java:100)
    at sun.security.smartcardio.TerminalImpl.connect(TerminalImpl.java:78)
    ... 2 more

Code:

package eid;
import be.belgium.eid.eidlib.BeID;
import be.belgium.eid.exceptions.EIDException;
import java.util.Date;
import java.util.Scanner;
import be.belgium.eid.eidlib.BeID;
import be.belgium.eid.event.CardAdapter;
import be.belgium.eid.exceptions.EIDException;

public class Eid {
    public static void main(String[] args) {
    try {
      final BeID eID = new BeID(true);  
      eID.enableCardListener(new CardAdapter() {
        public void cardInserted() {
          try {
            System.out.println(eID.getIDData().toString());
          } catch (EIDException e) { 
            System.err.println("AgeChecker eIDException: -- " + e.getMessage());
          } catch (Exception e) {
            System.err.println("AgeChecker exception: -- " + e.getMessage());
          }

        }
      });

      System.out.println("AgeChecker -- type QUIT to end program.");
      String input = "";
      while (!input.equalsIgnoreCase("QUIT")) {
        input = new Scanner(System.in).next();
      }

    } catch (NumberFormatException e) {
      System.err.println("AgeChecker -- Given argument should be an integral value.");
    }

    }
}

eidlib - how do i detect card inserted, card exit for 24/7?

I can read the card informations with following code:

package eid;
import be.belgium.eid.eidlib.BeID;
import be.belgium.eid.exceptions.EIDException;
public class Eid {
    public static void main(String[] args) {
        try {
            BeID eID = new BeID(true);
            // We fetch the information
            System.out.println("InformationRetrieval -- ID information:");
            System.out.println(eID.getIDData().toString());
            System.out.println("InformationRetrieval -- Address information:");
            System.out.println(eID.getIDAddress().toString());
            System.out.println("InformationRetrieval -- Photo is saved to file:");
            eID.getIDPhoto().writeToFile(eID.getIDData().getName());

        } catch (EIDException e) {
            System.err.println("InformationRetrieval eIDException -- "
                    + e.getMessage());
        } catch (Exception e) {
            System.err.println("InformationRetrieval exception -- "
                    + e.getMessage());
        }
    }
}

But i was asked if i can detect card inserted or card exited or card was invalidly inserted for a 24/7 monitoring project.

Can you please help me how to do that with eidlib?

EID Exception: The root certificate is incorrect?

Hello,

I am experiencing some very strange behaviour on 1 particular PC.
When trying to read an eid card with the software I wrote I get the error message "EID Exception: The root certificate is incorrect"
This only happens on this PC with this software. Using the demo software did read the eid card correctly! Google actually returns zero results for this issue.
The library clearly works (in the demo software and the same PC) and the application I wrote also works (on all other PC's).
I tried installing the latest version of the official eid software but that did nothing.
I am lost for possible causes of this. Where should I begin to look?

Kind regards,

Help - to get the picture in PHP

Using the SDK i get following field:

Hash picture: *P¿aÁ†?y2=....

How can i decode it now into PNG or JPEG? is the has picture is in JPEG? following did not worked.

    if(count($cresult) > 0) {
      $arr = explode("\n", $cresult[0]['card']);
      $encodedPhoto =str_replace("Hash picture: ", "", $arr[18]);
      //header('Content-Type: image/jpeg');
      echo "<img src='data:image/png;base64,{$encodedPhoto}' />";

    } 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.