Skip to content

feat: support multiple bytes key_id for hsm signer (cka_id)#1107

Open
Spinbazz wants to merge 1 commit into
secure-systems-lab:mainfrom
Spinbazz:fix/cka_id_size_limit
Open

feat: support multiple bytes key_id for hsm signer (cka_id)#1107
Spinbazz wants to merge 1 commit into
secure-systems-lab:mainfrom
Spinbazz:fix/cka_id_size_limit

Conversation

@Spinbazz
Copy link
Copy Markdown

Description of the changes being introduced by the pull request:

Fix: remove keyid size limitation to 1 byte (FF)

Fixes #1105

@Spinbazz Spinbazz changed the title feat: support multiple octals object id feat: support multiple bytes object id Mar 25, 2026
@Spinbazz Spinbazz changed the title feat: support multiple bytes object id feat: support multiple bytes key_id for hsm signer (cka_id) Mar 25, 2026
Copy link
Copy Markdown
Collaborator

@jku jku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apologies for the silence, did not mean to leave you on unread for so long. The basic idea makes sense to me: the search filter is actually a byte array and current code fails if keyid > 0xFF.

I left one comment in code -- that looks like a hex conversion bug to me. Maybe adding a test with odd and even length hex string ids would make sense? let me know if you're not invested enough, I can look at adding that.

Comment on lines +213 to +216
keyid_hexstr = hex(keyid)[2::]
cka_id_filter = [
int(keyid_hexstr[i : i + 2], 16) for i in range(0, len(keyid_hexstr), 2)
]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this bit is buggy:

>>> hex(255)[2::]
'ff'
>>> hex(256)[2::]
'100'

that will screw up the filter AFAICT. The latter leads to cka_id_filter = [16, 0] which sounds wrong.

using keyid.to_bytes() instead might be simpler (but still requires figuring out the length).

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

Successfully merging this pull request may close these issues.

HSM key with a muliple bytes CKA_ID length failed (current max length CKA_ID 1 Byte : FF )

2 participants