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 for copying private keys #12110

Merged
merged 7 commits into from
Dec 6, 2024

Conversation

joakimnordling
Copy link
Contributor

@joakimnordling joakimnordling commented Dec 6, 2024

This adds support for copying private keys, such as the RSAPrivateKey. This resolves issue #11859.

Wasn't sure if it was better to generate a stronger key for DHPrivateKey in the tests or to load a smaller one from a file and use @pytest.mark.skip_fips(reason="non-FIPS parameters") to get it to pass on FIPS; settled for the first option, to have better test coverage in exchange of speed, but let me know if you'd prefer it the other way around. UPDATE: Based on feedback in the review changed to loading the key from a file and using skip_fips for that test.

@joakimnordling joakimnordling marked this pull request as ready for review December 6, 2024 11:30
Copy link
Member

@alex alex left a comment

Choose a reason for hiding this comment

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

In addition to adding the implementations to the concrete classes, you'll want to add them to the ABCs for each of these key types as well.

@alex
Copy link
Member

alex commented Dec 6, 2024

I think it's fine to load a weak key and skip on FIPS and be marginally faster.

@joakimnordling
Copy link
Contributor Author

Thanks, I reverted back to loading the key from a file and added a skip_fips to that particular test.

I also added abstract methods to the abstract base classes. The ABCs for the public keys were also missing the abstract version of the __copy__ methods, so I added it to those as well.

@alex alex merged commit 43d84b1 into pyca:main Dec 6, 2024
61 checks passed
@joakimnordling joakimnordling deleted the feature/copy-private-keys branch December 6, 2024 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants