testsuite: add Pbkdf2FileMixin unit tests, refs #9556#9686
Merged
ThomasWaldmann merged 1 commit intoMay 31, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9686 +/- ##
==========================================
+ Coverage 83.87% 83.95% +0.07%
==========================================
Files 93 93
Lines 15586 15586
Branches 2335 2335
==========================================
+ Hits 13073 13085 +12
+ Misses 1785 1775 -10
+ Partials 728 726 -2 ☔ View full report in Codecov by Sentry. |
mr-raj12
force-pushed
the
testsuite-legacy-crypto-key
branch
from
May 30, 2026 21:07
efcf58f to
fb5ad53
Compare
Member
|
Do we already have similar tests for the argon2 kdf? |
Contributor
Author
|
Member
|
yes, please, would be good to have similar tests for both. |
4 tasks
ThomasWaldmann
pushed a commit
that referenced
this pull request
May 31, 2026
ThomasWaldmann
added a commit
that referenced
this pull request
May 31, 2026
testsuite: add argon2 wrong-passphrase test for decrypt_key_file, refs #9686
mr-raj12
added a commit
to mr-raj12/borg
that referenced
this pull request
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Unit tests for
Pbkdf2FileMixin, refs #9556.Pbkdf2FileMixin(legacy/crypto/key.py) is the PBKDF2 + AES-256-CTR layer borg 1.x uses to protect key files on disk. It shipped in earlier phases with no unit tests. This PR addssrc/borg/testsuite/crypto/legacy_key_test.pywith 4 tests coveringencrypt_key_fileanddecrypt_key_file.src/borg/testsuite/crypto/legacy_key_test.py-- 4 tests forPbkdf2FileMixin:encrypt_key_file->decrypt_key_filerecovers the original plaintextNone: PBKDF2 derives a different key, HMAC check fails,Nonereturned (not raised)None: correct passphrase and ciphertext but zeroed-out hash field failshmac.compare_digestUnsupportedKeyFormatError: version != 1 is not part of the borg 1.x formatBORG_TESTONLY_WEAKEN_KDFis set globally byconftest.py, so PBKDF2 runs at 1 iteration and tests are fast.No production code changes.
Refs #9556
Checklist
master(or maintenance branch if only applicable there)toxor the relevant test subset)