Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue while using it for PIV applet #175

Open
snlgaba opened this issue Sep 2, 2021 · 1 comment
Open

Issue while using it for PIV applet #175

snlgaba opened this issue Sep 2, 2021 · 1 comment
Assignees

Comments

@snlgaba
Copy link

snlgaba commented Sep 2, 2021

Hi,

First of all, thanks for the great work.

I am trying to use this simulator to run PIV Applet: https://github.com/arekinath/PivApplet

It currently fails when trying to perform auth operations.

Exception i get is:
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)

This is because the buffer size here: https://github.com/licel/jcardsim/blob/master/src/main/java/com/licel/jcardsim/crypto/AsymmetricCipherImpl.java#L77 is 255 bytes for RSA 2048 key.

However, in the doFinal input size is 256 and it fails at:

https://github.com/licel/jcardsim/blob/master/src/main/java/com/licel/jcardsim/crypto/AsymmetricCipherImpl.java#L120

If I change the buffer size to getInputBlockSize() + 1 to make it 256, everything works.

Can you please help me understand why we are limiting the buffer size to engine.getInputBlockSize()? Is it possible to make the buffer size bigger and let RSAEngine fail if the input is bigger than expected for that Cipher.

@koh-osug
Copy link

I have merged in several pull requests in my version which might address this. See https://github.com/koh-osug/jcardsim/blob/master/src/main/java/com/licel/jcardsim/crypto/AsymmetricCipherImpl.java#L77
The latest released jars are addressing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants