wallet: clean old key material before overwriting in SetKey #35056

pull flawlesscode254 wants to merge 1 commits into bitcoin:master from flawlesscode254:fix/clean-key-before-overwrite changing 2 files +16 −0
  1. flawlesscode254 commented at 3:44 AM on April 12, 2026: none

    When CCrypter::SetKey() is called on an instance that already has a key set (fKeySet=true), the old key and IV are overwritten without being cleansed first. This can leave sensitive key material in memory longer than necessary.

    This fix adds a call to CleanKey() before overwriting the key when fKeySet is already true, ensuring old key material is securely wiped before new key data is written

  2. wallet: clean old key material before overwriting in SetKey
    When CCrypter::SetKey() is called on an instance that already has a key
    set (fKeySet=true), the old key and IV are overwritten without being
    cleansed first. This can leave sensitive key material in memory longer
    than necessary.
    
    This fix adds a call to CleanKey() before overwriting the key when
    fKeySet is already true, ensuring old key material is securely wiped
    before new key data is written.
    
    Add a test case to verify the behavior works correctly.
    2244b82cdc
  3. DrahtBot added the label Wallet on Apr 12, 2026
  4. DrahtBot commented at 3:44 AM on April 12, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. flawlesscode254 closed this on Apr 12, 2026

Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me