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

Incorrect key length used in KeyBuilder tests with TYPE_HMAC keys #259

Open
nc-adnan opened this issue Feb 14, 2023 · 2 comments
Open

Incorrect key length used in KeyBuilder tests with TYPE_HMAC keys #259

nc-adnan opened this issue Feb 14, 2023 · 2 comments
Labels

Comments

@nc-adnan
Copy link

nc-adnan commented Feb 14, 2023

According to the Java Card 3.0.5 API, the keyLength parameter passed to the KeyBuilder.buildKey method is the key size in bits.

In the KeyBuilder tests configs, the key sizes are specified in bytes for TYPE_HMAC keys (64/128) which leads to incorrect results:

see JCAlgTest/AlgTest_JClient/src/algtestjclient/SingleModeTest.java:

KEYBUILDER_TEST_CFGS.put("TYPE_HMAC_TRANSIENT_RESET#2.2.2", new KBTestCfg(JCConsts.KeyBuilder_TYPE_HMAC_TRANSIENT_RESET, (short) 64));
KEYBUILDER_TEST_CFGS.put("TYPE_HMAC_TRANSIENT_DESELECT#2.2.2", new KBTestCfg(JCConsts.KeyBuilder_TYPE_HMAC_TRANSIENT_DESELECT, (short) 64));
KEYBUILDER_TEST_CFGS.put("TYPE_HMAC LENGTH_HMAC_SHA_1_BLOCK_64#2.2.2", new KBTestCfg(JCConsts.KeyBuilder_TYPE_HMAC, (short) 64));
KEYBUILDER_TEST_CFGS.put("TYPE_HMAC LENGTH_HMAC_SHA_256_BLOCK_64#2.2.2", new KBTestCfg(JCConsts.KeyBuilder_TYPE_HMAC, (short) 64));
KEYBUILDER_TEST_CFGS.put("TYPE_HMAC LENGTH_HMAC_SHA_384_BLOCK_64#2.2.2", new KBTestCfg(JCConsts.KeyBuilder_TYPE_HMAC, (short) 128));
KEYBUILDER_TEST_CFGS.put("TYPE_HMAC LENGTH_HMAC_SHA_512_BLOCK_64#2.2.2", new KBTestCfg(JCConsts.KeyBuilder_TYPE_HMAC, (short) 128));
@nc-adnan nc-adnan changed the title Incorrect key length in KeyBuilder tests with TYPE_HMAC keys Incorrect key length used in KeyBuilder tests with TYPE_HMAC keys Feb 14, 2023
@petrs petrs added the bug label Jul 23, 2023
@petrs
Copy link
Member

petrs commented Aug 3, 2023

Thank you @nc-adnan for reporting, it will take longer to fix this issue due to need for re-measurement of existing results for these six values. So I'm leaving the issue open for now.

@petrs
Copy link
Member

petrs commented Nov 23, 2024

fixed by 6e01f83

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

No branches or pull requests

2 participants