Skip to content

fix(compressed_key,signatures): support visit_seq in CompressedKey Deserialize and add to_commitment_signature - #259

Open
cyzcz wants to merge 1 commit into
tari-project:mainfrom
cyzcz:fix/compressed-key-zeroize-and-com-sig
Open

cyzcz wants to merge 1 commit into
tari-project:mainfrom
cyzcz:fix/compressed-key-zeroize-and-com-sig

Conversation

@cyzcz

@cyzcz cyzcz commented Nov 7, 2026

Copy link
Copy Markdown

Description

This PR fixes two issues in tari_crypto:

  1. Clear cached public_key: OnceLock<T> in Zeroize for CompressedKey<T> and support visit_seq in Deserialize (src/compressed_key.rs):

    • CompressedKey<T>::zeroize had the doc comment /// Zeroizes both the point and (if it exists) the compressed point, but only called self.key.zeroize(), leaving self.public_key: OnceLock<T> intact so a subsequent to_public_key() call still returned the cached decompressed PublicKey. Reset self.public_key = OnceLock::new().
    • Also implement visit_seq on CompressedKeyVisitor so binary/sequence deserializers that emit byte sequences instead of borrowed byte slices can deserialize CompressedKey<T>.
  2. Add CompressedCommitmentSignature::to_commitment_signature (src/signatures/compressed_commitment_signature.rs):

    • CompressedSchnorrSignature provides to_schnorr_signature(&self) and CompressedCommitmentAndPublicKeySignature provides to_capk_signature(&self), while CompressedCommitmentSignature had new_from_commitment_signature but was missing to_commitment_signature(&self).

How Has This Been Tested?

  • Added unit test zeroize_clears_cached_public_key in src/compressed_key.rs.
  • Verified cargo test --lib (122 tests) and cargo clippy --no-deps --lib --tests -- -D warnings pass cleanly.

@cyzcz cyzcz changed the title fix(compressed_key): clear cached public_key on Zeroize and add to_commitment_signature fix(compressed_key,signatures): support visit_seq in CompressedKey Deserialize and add to_commitment_signature Nov 26, 2026
@cyzcz
cyzcz force-pushed the fix/compressed-key-zeroize-and-com-sig branch from 973d134 to 95132e2 Compare November 26, 2026 17:17
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.

1 participant