-
Notifications
You must be signed in to change notification settings - Fork 48
Incorrect key length used in KeyBuilder tests with TYPE_HMAC keys #259
Copy link
Copy link
Open
Labels
Description
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));
Reactions are currently unavailable