GithubHelp home page GithubHelp logo

commons-eid's People

Contributors

fcorneli avatar florian-courault avatar janvdbergh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

commons-eid's Issues

Infinite loop when removing a card with multiple BeIDCards opened instances

Hello,

Description:
On Linux, using the java-8-openjdk, I get an infinite loop.
When it happens, we cannot use the card anymore, even if we reconnect the terminal and the card.

Steps to reproduce:

  • Instantiate the BeIDCards class more than one time.
  • Remove the card from the terminal.

Code to reproduce:

public static void main(String[] args) {
    Logger logger = new Logger() {
      @Override
      public void error(String s) {
        System.out.println(s);
      }
      @Override
      public void debug(String s) {
        System.out.println(s);
      }
    };
    Scanner sc = new Scanner(System.in);
    while (true) {
      switch (sc.nextInt()) {
        case 0:
          new BeIDCards(logger);
          break;
      }
    }
  }

Cause :
It happens if we perform multiple JCA actions like sign multiple times; or if we use JCA and non-JCA methods (example : sign and then fetch identity file).
It happens because we instantiate the BeIDCards class in the BeIDKeyStore class, in getBeIDCard, but this instance is never closed.

Log trace :

10:43:14.595 [CardAndTerminalManager] closing eID card
10:43:14.598 [CardAndTerminalManager] eID Card Removal Reported
10:43:22.709 [CardAndTerminalManager] Cannot wait for card terminal events [2] (No Card Readers Connected?): waitForChange() failed
10:43:22.709 [CardAndTerminalManager] no card readers connected?
10:44:03.322 [CardAndTerminalManager] cause: SCARD_E_NO_SERVICE
10:44:03.322 [CardAndTerminalManager] cause type: sun.security.smartcardio.PCSCException
10:44:03.322 [CardAndTerminalManager] cleared
10:44:09.311 [CardAndTerminalManager] subsystem not initialized
10:44:17.259 [CardAndTerminalManager] Cannot enumerate card terminals [1] (No Card Readers Connected?): list() failed
10:44:17.260 [CardAndTerminalManager] no card readers connected?
10:44:17.261 [CardAndTerminalManager] cause: SCARD_E_NO_SERVICE
10:44:17.261 [CardAndTerminalManager] cause type: sun.security.smartcardio.PCSCException
10:44:23.784 [CardAndTerminalManager] log: cleared
10:44:24.918 [CardAndTerminalManager] subsystem not initialized
10:44:25.352 [CardAndTerminalManager] Cannot enumerate card terminals [1] (No Card Readers Connected?): list() failed
10:44:25.353 [CardAndTerminalManager] no card readers connected?

The "list() failed" exception seems to be related to this old ticket: https://bugs.openjdk.java.net/browse/JDK-8026326
I don't know if there is something we can do about it ...

Let me now what do you think about it or if you need more information !
Regards,
Florian

PS : I saw your release on maven central, thanks about that !

UserCancelledException missing in BeIDCardUIAdapter.obtainPIN

The BeIDCardUI interface has the UserCancelledException defined on the 
obtainPIN method.
The BeIDCardUIAdapter class, which implements this interfac,e does not have 
this exception defined. When the BeIDCardUIAdapter is extended for a custom 
implementation which redefines the obtain method, the UserCancelledException is 
also missing. This causes problems for the "user cancelled" implementation.
Shouldn't this exception be added on this method in the adapter class?



Original issue reported on code.google.com by [email protected] on 22 Nov 2013 at 11:05

CardTerminals.list() may return different objects on subsequent calls

CardAndTerminalManager assumes that subsequent calls to CardTerminals.list() 
return the same CardTerminal objects every time. As far as I can tell from the 
smartcardio API documentation, this is not guaranteed. In fact, the 
jnasmartcardio implementation returns new objects every time.

The consequence is that CardAndTerminalManager will trigger 
terminalsDetached/terminalsAttached and cardsRemoved/cardsInserted events for 
every terminal and card present during each iteration.

At first sight, it looks relatively easy to fix, by using the CardTerminal name 
instead of the object to identity the terminals.

Original issue reported on code.google.com by [email protected] on 16 Feb 2015 at 7:41

When using an external keyboard with its own smart card reader, disconnecting and reconnecting it causes BeIDCards to no longer find any cards

Hello,

I'm working on an HP laptop which is docked into a docking station with an external Dell Smart Card Reader keyboard connected to it. When I insert an eID card and try to sign a PDF (via iText in Java), signing works. When I disconnect the keyboard however, BeIDCards seems to get stuck in a loop and it can no longer detect any cards.

In simple steps, reproducing the bug works like this:

  1. start application with keyboard connected (card inserted or not does not matter)
  2. try to sign a PDF (via a button in the application)
  3. if card is not inserted, the system will ask for it
    if card is inserted, I get a screen to enter my PIN
  4. disconnect the keyboard at this point (the only thing needed is that an instance of BeIDCards is actively running). normally the first error should start appearing in a loop. reconnecting the keyboard again will result in a different kind of error, but it will still run in a loop.

My laptop also has a built-in Alcor Micro USB Smart Card Reader. This second terminal is only detected upon inserting an eID card, thus the cardTerminalAttached and cardInserted events always fire together (cardTerminalDetached and cardRemoved as well). With this card reader, removal of the card does not pose an issue and I do not get the errorloop.

I've enabled logging in BeIDCards, signed one PDF (so BeIDCards is active), then disconnected the keyboard and reconnected it to reproduce this. Execution of the application is manually stopped from my IDE. You can find the console output of these actions in eid_errorlog20190722.txt attached to this issue.

Thanks in advance for any help with this issue.

Cannot close the CardAndTerminalManager while using the BeIDCards implementation

Hello,
I noticed a bug using the BeIDCards class: When its "close" method is called, nothing happens:
It calls the "stop" method of its BeIDCardManager, which does nothing, because the class uses its own object "CardAndTerminalManager". So, this one is never closed.
I proposed a pull request that fixes this bug, here.

Thank you for your attention and for your very useful software :) !

Does not work while compile.

It gives 15 errors. While compiling.

Source: 
https://code.google.com/p/commons-eid/source/browse/commons-eid-tests/src/test/j
ava/test/integ/be/fedict/commons/eid/client/TestBeIDCardListener.java

sun@sun-M14xR2:/var/tmp/commons-eid/commons-eid-tests/src/test/java/test/integ/b
e/fedict/commons/eid/client$ javac TestBeIDCardListener.java 
TestBeIDCardListener.java:21: package org.apache.commons.logging does not exist
import org.apache.commons.logging.Log;
                                 ^
TestBeIDCardListener.java:22: package org.apache.commons.logging does not exist
import org.apache.commons.logging.LogFactory;
                                 ^
TestBeIDCardListener.java:24: package be.fedict.commons.eid.client does not 
exist
import be.fedict.commons.eid.client.FileType;
                                   ^
TestBeIDCardListener.java:25: package be.fedict.commons.eid.client.event does 
not exist
import be.fedict.commons.eid.client.event.BeIDCardListener;
                                         ^
TestBeIDCardListener.java:27: cannot find symbol
symbol: class BeIDCardListener
public class TestBeIDCardListener implements BeIDCardListener {
                                             ^
TestBeIDCardListener.java:29: cannot find symbol
symbol  : class Log
location: class test.integ.be.fedict.commons.eid.client.TestBeIDCardListener
    private static final Log LOG = LogFactory
                         ^
TestBeIDCardListener.java:33: cannot find symbol
symbol  : class FileType
location: class test.integ.be.fedict.commons.eid.client.TestBeIDCardListener
    public void notifyReadProgress(final FileType fileType, final int offset,
                                         ^
TestBeIDCardListener.java:40: cannot find symbol
symbol  : class FileType
location: class test.integ.be.fedict.commons.eid.client.TestBeIDCardListener
    public void notifySigningBegin(final FileType keyType) {
                                         ^
TestBeIDCardListener.java:48: cannot find symbol
symbol  : class FileType
location: class test.integ.be.fedict.commons.eid.client.TestBeIDCardListener
    public void notifySigningEnd(final FileType keyType) {
                                       ^
TestBeIDCardListener.java:29: cannot find symbol
symbol  : variable LogFactory
location: class test.integ.be.fedict.commons.eid.client.TestBeIDCardListener
    private static final Log LOG = LogFactory
                                   ^
TestBeIDCardListener.java:32: method does not override or implement a method 
from a supertype
    @Override
    ^
TestBeIDCardListener.java:42: cannot find symbol
symbol  : variable FileType
location: class test.integ.be.fedict.commons.eid.client.TestBeIDCardListener
                + (keyType == FileType.AuthentificationCertificate
                              ^
TestBeIDCardListener.java:39: method does not override or implement a method 
from a supertype
    @Override
    ^
TestBeIDCardListener.java:50: cannot find symbol
symbol  : variable FileType
location: class test.integ.be.fedict.commons.eid.client.TestBeIDCardListener
                + (keyType == FileType.AuthentificationCertificate
                              ^
TestBeIDCardListener.java:47: method does not override or implement a method 
from a supertype
    @Override
    ^
15 errors

Original issue reported on code.google.com by [email protected] on 28 Apr 2013 at 9:57

Error reading birth date in March for German eID card

What steps will reproduce the problem?
1. Insert eID for german language citizen born in March 
2. Read birth date

What is the expected output? What do you see instead?

Exception:

be.ehealth.technicalconnector.exception.TechnicalConnectorException: Error 
while reading BeIDCard data : error parsing file: 
be.fedict.commons.eid.consumer.Identity
    at be.ehealth.technicalconnector.beid.BeIDInfo.<init>(BeIDInfo.java:71)
    at be.ehealth.technicalconnector.beid.BeIDInfo.getInstance(BeIDInfo.java:91)
    at be.business.connector.common.CommonIntegrationModuleImpl.createSession(CommonIntegrationModuleImpl.java:167)
    ... 19 more
Caused by: java.lang.RuntimeException: error parsing file: 
be.fedict.commons.eid.consumer.Identity
    at be.fedict.commons.eid.consumer.tlv.TlvParser.parse(TlvParser.java:58)
    at be.ehealth.technicalconnector.beid.BeIDInfo.<init>(BeIDInfo.java:60)
    ... 21 more
Caused by: be.fedict.commons.eid.consumer.tlv.DataConvertorException: unknown 
month: MÄR
    at be.fedict.commons.eid.consumer.tlv.DateOfBirthDataConvertor.toMonth(DateOfBirthDataConvertor.java:109)
    at be.fedict.commons.eid.consumer.tlv.DateOfBirthDataConvertor.convert(DateOfBirthDataConvertor.java:73)
    at be.fedict.commons.eid.consumer.tlv.DateOfBirthDataConvertor.convert(DateOfBirthDataConvertor.java:33)
    at be.fedict.commons.eid.consumer.tlv.TlvParser.parseThrowing(TlvParser.java:125)
    at be.fedict.commons.eid.consumer.tlv.TlvParser.parse(TlvParser.java:56)
    ... 22 more


Please provide any additional information below.

See code in:

https://code.google.com/p/commons-eid/source/browse/commons-eid-consumer/src/mai
n/java/be/fedict/commons/eid/consumer/tlv/DateOfBirthDataConvertor.java?name=

Google code view shows ?? instead of Ä in MÄR. 

Following code produces the same error:

        DateOfBirthDataConvertor conv = new DateOfBirthDataConvertor();

        Calendar cal = conv.convert("01.MÄR.2015".getBytes("UTF-8"));


Original issue reported on code.google.com by [email protected] on 4 Feb 2015 at 12:53

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.