OpenCryptoProject / JCMathLib

Implementation of mathematical operations with big numbers and elliptic curve points for smart cards with JavaCard platform.
MIT License
83 stars 27 forks source link

Add conditional execution of JCMathLib methods based on card-specific configuration files #20

Closed petrs closed 1 year ago

petrs commented 3 years ago

Not all operations of JCMathLib are supported on all cards. If executed, some operations will fail or may even block the card (e.g., n_mod_exp on JCOP3 J3H145G see https://github.com/OpenCryptoProject/JCMathLib/issues/13). Currently, developer must remove these operations manually from the code.

Solution: Add simple java file CardSupportCfg.java containing true/false param for each method supported by JCMathLib. The parameter is controlled in runtime and if false, then method is not executed (exception) despite being present in code.

For new card, developer can select pre-prepared CardSupportCfg for tested smartcards or create own using simple testing tool

dufkan commented 1 year ago

A variant of this approach included in Release 2.0.