Skip to content

Support for copying private keys#12110

Merged
alex merged 7 commits intopyca:mainfrom
joakimnordling:feature/copy-private-keys
Dec 6, 2024
Merged

Support for copying private keys#12110
alex merged 7 commits intopyca:mainfrom
joakimnordling:feature/copy-private-keys

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
@joakimnordling joakimnordling deleted the feature/copy-private-keys branch December 6, 2024 19:45
reaperhulk added a commit that referenced this pull request May 19, 2025
@Yossarian pointed out that we missed this breaking change #12110
alex pushed a commit that referenced this pull request May 19, 2025
* add missing 45.0.0 changelog entry

@Yossarian pointed out that we missed this breaking change #12110

* Update CHANGELOG.rst

* oops
alex pushed a commit to alex/cryptography that referenced this pull request May 25, 2025
* add missing 45.0.0 changelog entry

@Yossarian pointed out that we missed this breaking change pyca#12110

* Update CHANGELOG.rst

* oops
reaperhulk added a commit that referenced this pull request May 25, 2025
* Rename PBES1 types to better match their origins in the spec (#12976)

PBEParams is defined in RFC 8018 as going with PBES1, but then its also used by PKCS#12 ciphers in RFC 7292.

* add vector and test for longer salt length in PBE (#12977)

* add vector and test for longer salt length in PBE

* Update docs/development/test-vectors.rst

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>

---------

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>

* fixes #12949 -- added support for decrypting des-cbc-md5 keys (#12978)

* add missing 45.0.0 changelog entry (#12946)

* add missing 45.0.0 changelog entry

@Yossarian pointed out that we missed this breaking change #12110

* Update CHANGELOG.rst

* oops

* changelog + version bump

* add pbeWithMD5AndDES-CBC test vector (#12956)

* typo

* fix documentation for the decrepit algorithms module (#12953)

---------

Co-authored-by: Paul Kehrer <paul.l.kehrer@gmail.com>
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