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

Support HTTP digest authentication algorithm SHA-256 as per RFC-7617 #128192

Closed
calvinbui opened this issue Dec 23, 2024 · 4 comments
Closed

Support HTTP digest authentication algorithm SHA-256 as per RFC-7617 #128192

calvinbui opened this issue Dec 23, 2024 · 4 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@calvinbui
Copy link
Contributor

calvinbui commented Dec 23, 2024

Feature or enhancement

Proposal:

Support SHA-256 digest authentication following RFC7616 - https://datatracker.ietf.org/doc/html/rfc7616

CPython currently supports MD5 and SHA1 only.

Other possible methods include SHA-256-ness, SHA-512-256 and SHA-512-256-sess which hashlib doesn't currently appear to support out of the box.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

@rruuaanng
Copy link
Contributor

I think we only need SHA256. That is say.

from RFC-7616

   This specification defines the following algorithms:

   o  SHA2-256 (mandatory to implement)

   o  SHA2-512/256 (as a backup algorithm)

   o  MD5 (for backward compatibility).

@picnixz picnixz added the stdlib Python modules in the Lib dir label Dec 24, 2024
@picnixz picnixz changed the title Support digest authentication algorithm SHA-256 Support HTTP digest authentication algorithm SHA-256 as per RFC-7617 Dec 24, 2024
@picnixz
Copy link
Member

picnixz commented Dec 24, 2024

We do support SHA-512-256 in hashlib if the underlying OpenSSL library implements it. This is the truncated SHA-2-512. This can be constructed via hashlib.new('SHA512_256') (other names are available, see https://docs.openssl.org/3.3/man7/EVP_MD-SHA2/#identities) (there is no dedicated constructor for this function though).

As for SHA-256-ness and SHA-512-sess are similar to SHA-256/512 and only differ in how A1 is computed (see https://datatracker.ietf.org/doc/html/rfc7616#section-3.4.2).

gpshead added a commit that referenced this issue Dec 28, 2024
…GH-128193)

support sha-256 digest authentication

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
@picnixz
Copy link
Member

picnixz commented Dec 28, 2024

@calvinbui If you're interested in the follow-up PR for tests and docs, we can keep the issue opened.

@gpshead
Copy link
Member

gpshead commented Dec 29, 2024

I suggest just opening a new issue for test/doc improvements as those wouldn't strictly be related to this feature.

@gpshead gpshead closed this as completed Dec 29, 2024
gpshead added a commit to gpshead/cpython that referenced this issue Dec 29, 2024
gpshead added a commit that referenced this issue Dec 29, 2024
…ability (gh-128324)

Puts the _hashlib get_fips_mode logic check into test.support rather than spreading it out among other tests.
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 8, 2025
…C-7617 (pythonGH-128193)

support sha-256 digest authentication

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 8, 2025
… availability (pythongh-128324)

Puts the _hashlib get_fips_mode logic check into test.support rather than spreading it out among other tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants