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

Update minimumKeySize for SHA1 Algorithm #32

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

amine2233
Copy link

Description

Fix minimumKeySize for some service use 10 or 16 instead of 20 about length of data

@gaetanomatonti gaetanomatonti self-requested a review April 27, 2022 12:43
@gaetanomatonti
Copy link
Owner

gaetanomatonti commented Apr 30, 2022

Thanks for your contribution @amine2233. I was aware of this issue but could not find any resource that explained why this is the case.
The RFC-4226 specifications state under section 4 paragraph R6 that the minimum size for the shared secret must be at least 128 bits (16 bytes) but recommends 160 bits (20 bytes). The SHA1 algorithm also uses a minimum secret size of 20 bytes.
If you could point me to any resource that explains why 10 bytes secrets are used I would highly appreciate it.

@amine2233
Copy link
Author

amine2233 commented May 6, 2022

@gaetanomatonti, thanks for your response and you work,
some services use a minimum size which is (16 bytes) but seems GitHub uses (10 bytes) I don't know why but it's very strange,

so I'm agree whit you to use the recommended or the minimum value, but maybe we can put this flexible on the code, if you have any idea don't hesitate

@gaetanomatonti gaetanomatonti changed the title update minimumKeySize for sha1 algo Update minimumKeySize for SHA1 Algorithm May 6, 2022
@gaetanomatonti
Copy link
Owner

gaetanomatonti commented May 6, 2022

maybe we can put this flexible on the code

@amine2233 thanks for the suggestion, this might be a viable solution. We can try adding an associated value to the sha1 case of the Algorithm enum, although it won't allow us to use a rawValue for the enum. This parameter will need to be propagated from the Metadata and URIParser types though. Moving the key size check when creating the metadata could be a better solution than to check only at generation time.

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.

2 participants