Skip to content

Conversation

@daniel-sanche
Copy link
Collaborator

@daniel-sanche daniel-sanche commented Jan 12, 2026

The rsa library has been deprecated and archived. This PR adds cryptography as a the new preferred backend for RSA operations

In the short term, both rsa and cryptography will be listed as dependencies. Soon, rsa will be removed, but still supported as an optional dependency. Eventually, it will be completely removed from the codebase.

As a part of this change, I introduced new RSASigner and RSAVerifier wrapper classes, that can use either cryptography or rsa implementations. Previously, the library would only import one or the other, depending on if cryptography was installed. This simplifies the import structure, and puts rsa and cryptography on equal footing

Fixes #912
Towards #1810
Towards #941

@daniel-sanche daniel-sanche changed the title [DRAFT] feat: add cryptography as required dependency feat: add cryptography as required dependency Jan 13, 2026
@daniel-sanche daniel-sanche marked this pull request as ready for review January 13, 2026 19:24
@daniel-sanche daniel-sanche requested review from a team as code owners January 13, 2026 19:24
@parthea
Copy link
Contributor

parthea commented Jan 14, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully transitions the library to use cryptography as a required dependency for RSA operations, moving away from the deprecated rsa library. The introduction of RSASigner and RSAVerifier wrapper classes is a clean approach to maintain backward compatibility while encouraging migration. The dependency updates and test modifications are all well-executed. I have a couple of minor suggestions to improve the docstrings in the new wrapper classes, which will enhance documentation clarity and prevent potential issues with tooling.

@parthea parthea assigned parthea and chalmerlowe and unassigned daniel-sanche Jan 15, 2026
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1665): Remove the pinned version of pyopenssl
# once `TestDecryptPrivateKey::test_success` is updated to remove the deprecated `OpenSSL.crypto.sign` and
# `OpenSSL.crypto.verify` methods. See: https://www.pyopenssl.org/en/latest/changelog.html#id3.
"pyopenssl < 24.3.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

non-blocking: For testing, we're using pyopenssl < 24.3.0, we should revisit this in the future so that we're able to test the latest version of pyopenssl. Same with aiohttp below

@daniel-sanche daniel-sanche merged commit 52558ae into main Jan 16, 2026
24 checks passed
@daniel-sanche daniel-sanche deleted the add_cryptography_dependency branch January 16, 2026 18:07
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.

Push cryptography more strongly

3 participants