arekinath / PivApplet

PIV applet for JavaCard 2.2.2 and 3.0.4+ with full ECDSA/ECDH support
111 stars 37 forks source link

Using master branch for jcardSim #58

Open snlgaba opened 3 years ago

snlgaba commented 3 years ago

Hi,

I see to use PivApplet, we need to use your fork of jcardSim. Few key changes i see in your fork for jcard sim are: https://github.com/arekinath/jcardsim/commit/5574374559598f79be4483081784ddd1f660bcfc

  1. buffer = JCSystem.makeTransientByteArray((short)(engine.getInputBlockSize() + 1), JCSystem.CLEAR_ON_DESELECT); in src/main/java/com/licel/jcardsim/crypto/AsymmetricCipherImpl.java
  2. private static final short BUFFER_SIZE = 261; in src/main/java/com/licel/jcardsim/framework/APDUProxy.java

a) Could you please help me understand why this change was made? b) And why not merge this change in the master branch of jcardSim as well?

Really appreciate your time and efforts here.

Cheers!

dengert commented 3 years ago

"Add support for smartcard/vpcd integration" which allows the applet to be run in java simulator and use a socket interface to pcsc. https://frankmorgner.github.io/vsmartcard/virtualsmartcard/README.html

An example of its use: https://github.com/OpenSC/OpenSC/blob/master/.github/test-piv.sh

I don't know why it needs the extra byte I was involved in getting test-piv.sh to work under github actions recently.

Hopefully this is not causing a problem.

snlgaba commented 3 years ago

I do see this exception when i use jcardsim-3.0.5-SNAPSHOT.jar instead of jcardsim-3.0.5.12-SNAPSHOT.jar from arekinath branch of JcardSim.

Method: processGeneralAuthRsa

Exception: javacard.security.CryptoException at javacard.security.CryptoException.throwIt(Unknown Source) at com.licel.jcardsim.crypto.AsymmetricCipherImpl.update(AsymmetricCipherImpl.java:115) at com.licel.jcardsim.crypto.AsymmetricCipherImpl.doFinal(AsymmetricCipherImpl.java:92)

snlgaba commented 3 years ago

Hi,

Would you be able to help?

dengert commented 3 years ago

Sorry, no. But I am the main developer for the OpenSC PIV driver, if you have questions. 261 comes from APDU (4) + Lc (1) + max data (255) + Le (1) = (261) for short APDUs.