Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix!: replace rsa dependency with cryptography#1771

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
sai-sunder-s wants to merge21 commits intomain
base:main
Choose a base branch
Loading
fromremove-rsa-dependency

Conversation

@sai-sunder-s
Copy link
Contributor

This commit removes thersa library as a dependency and makes thecryptography library a required, core dependency.

Previously,cryptography was an optional dependency, and the library would fall back to a pure Python RSA implementation using thersa library ifcryptography was not installed.

Changes made:

  • Modifiedsetup.py to removersa from dependencies and addcryptography with version constraints.
  • Updatedgoogle/auth/crypt/rsa.py to directly use thecryptography-based RSA implementation (_cryptography_rsa.py) and remove the fallback mechanism.
  • Removed the pure Python RSA implementation file (google/auth/crypt/_python_rsa.py).
  • Removed the corresponding tests for the pure Python RSA implementation (tests/crypt/test__python_rsa.py).

Core unit tests pass after these changes.

ktdreyer reacted with thumbs up emoji
This commit removes the `rsa` library as a dependency and makes the `cryptography` library a required, core dependency.Previously, `cryptography` was an optional dependency, and the library would fall back to a pure Python RSA implementation using the `rsa` library if `cryptography` was not installed.Changes made:- Modified `setup.py` to remove `rsa` from dependencies and add `cryptography` with version constraints.- Updated `google/auth/crypt/rsa.py` to directly use the `cryptography`-based RSA implementation (`_cryptography_rsa.py`) and remove the fallback mechanism.- Removed the pure Python RSA implementation file (`google/auth/crypt/_python_rsa.py`).- Removed the corresponding tests for the pure Python RSA implementation (`tests/crypt/test__python_rsa.py`).Core unit tests pass after these changes.
@sai-sunder-ssai-sunder-s added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelMay 23, 2025
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelMay 23, 2025
@sai-sunder-ssai-sunder-s added the owlbot:runAdd this label to trigger the Owlbot post processor. labelMay 28, 2025
@gcf-owl-botgcf-owl-botbot removed the owlbot:runAdd this label to trigger the Owlbot post processor. labelMay 28, 2025
Copy link
Contributor

@partheaparthea left a comment

Choose a reason for hiding this comment

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

LGTM. We should mark this asfix instead ofrefactor so that the change to setup.py is visible in release notes.

fix: add dependency on cryptographyfix: drop dependency on rsa

docs/conf.py Outdated

defautodoc_skip_member_handler(app,what,name,obj,skip,options):
"""
Skips members from internal modules (like _cryptography_rsa or base)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please could you file a bug for issue that requires this docs workaround, even if it will be closed with the changes in this PR. Add a link to the issue in this comment.

docs/conf.py Outdated
ifpublic_objisobj:
returnTrue# Skip this internal one
exceptImportError:
pass# Should not happen if the library is installed
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is not expected to happen, can we just let the error bubble up?

docs/conf.py Outdated
pass# Should not happen if the library is installed

# Handle Signer and Verifier from base
elifnamein ("Signer","Verifier")andhasattr(obj,"__module__"):
Copy link
Contributor

Choose a reason for hiding this comment

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

This code under this block is similar to the above if statement. Is it possible to refactor it?

Copy link
Contributor

@partheaparthea left a comment

Choose a reason for hiding this comment

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

Also remove rsa here:

@HiromuHota
Copy link

Any update here? rsa (https://stuvel.eu/software/rsa/) is officially archived.

@daniel-sanchedaniel-sanche changed the titleRefactor: Remove rsa and make cryptography a core dependencyfix: replace rsa dependency with cryptographyNov 19, 2025
@daniel-sanchedaniel-sanche marked this pull request as ready for reviewDecember 1, 2025 20:12
@daniel-sanchedaniel-sanche requested review froma team ascode ownersDecember 1, 2025 20:12
@daniel-sanchedaniel-sanche requested a review froma team as acode ownerDecember 4, 2025 22:25
@daniel-sanchedaniel-sanche changed the titlefix: replace rsa dependency with cryptographyfix!: replace rsa dependency with cryptographyDec 4, 2025
@daniel-sanche
Copy link
Collaborator

I looked a bit closer at the code, and it looks like this change would require a breaking change. Here's an example of some code that would break after this update:

import rsa as rsa_libimport google.auth.crypt.rsa# user didn't install optional `cryptography` dependency, so RSASigner and RSAVerifier # are imported from google.auth.crypt._python_rsasigner = google.auth.crypt.rsa.RSASigner(priv_key)verifier = google.auth.crypt.rsa.RSAVerifier(pub_key)message = b"Test"(pub_key, priv_key) = rsa_lib.newkeys(2048)signature = signer.sign(message)print(verifier.verify(message, signature))

I don't think there's a way to keep this flow consistent, without requiring rsa as a dependency


One thing we could do is make both rsa and cryptography optional dependencies, and raise an ImportError if both are missing? This would still be a breaking change, since they'll need to update their requirements.txt files. But they could keep using the rsa code in the mean-time.

I think it might be better to do a clean break from rsa though, since it's an archived package. I guess we could instruct users how to copy the old RSASigner/RSAVerifier classes into their codebase if they still want them

arnout pushed a commit to buildroot/buildroot that referenced this pull requestDec 15, 2025
Please note that this project was archived by the maintainer:sybrenstuvel/python-rsa@42b0e14The only buildroot package using python-rsa is python-google-auth whichdid not switch to an alternative yet:googleapis/google-auth-library-python#1771Signed-off-by: Bernd Kuhls <bernd@kuhls.net>Signed-off-by: Julien Olivain <ju.o@free.fr>
@daniel-sanche
Copy link
Collaborator

Quick update to those following this: This has been released as a pre-release v3.0.0.dev0 build ongithub andpypi

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@partheapartheaparthea left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@sai-sunder-s@HiromuHota@daniel-sanche@parthea@yoshi-kokoro

[8]ページ先頭

©2009-2025 Movatter.jp