Description
Problem
The ECDSA signing implementation hashes data using Keccak-256 but passes the result to the cryptography library using Prehashed(hashes.SHA256()).
This creates a mismatch between the actual hash algorithm used and the one declared during signing.
Code Reference
private_key.py:286–287
data_hash = keccak256(data)
signature_der = self._private_key.sign(
data_hash,
ec.ECDSA(asym_utils.Prehashed(hashes.SHA256()))
)
### Steps to reproduce
- Call the sign() function with input data
- Observe that data is hashed using keccak256
- Observe that Prehashed(hashes.SHA256()) is used during signing
- Verify mismatch between actual hash and declared hash algorithm
Additional context
This issue can lead to subtle cryptographic bugs and signature verification failures, especially in systems relying on strict hash algorithm consistency.
Hedera network
No response
Version
v0.2.5
Operating system
platform-independent
Description
Problem
The ECDSA signing implementation hashes data using Keccak-256 but passes the result to the cryptography library using Prehashed(hashes.SHA256()).
This creates a mismatch between the actual hash algorithm used and the one declared during signing.
Code Reference
private_key.py:286–287
Additional context
This issue can lead to subtle cryptographic bugs and signature verification failures, especially in systems relying on strict hash algorithm consistency.
Hedera network
No response
Version
v0.2.5
Operating system
platform-independent