Skip to content

Issue while using it for PIV applet #175

Description

@snlgaba

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions