Skip to content

bug: recovery failure reason hardcoded to nonce-reuse message for all attack types #21

Description

@oritwoen

When attack.recover() returns None, the CLI always reports the reason as "all pairs have s1 == s2" — regardless of which attack type is running.

// main.rs:224-228
} else {
    (
        "unrecoverable".to_string(),
        Some("all pairs have s1 == s2".to_string()), // always this
        None,
    )
};

This is only accurate for nonce-reuse. For the other attacks, recovery fails for completely different reasons:

  • polynonce: elimination polynomial roots didn't verify as valid keys via k*G check
  • biased-nonce: lattice reduction didn't produce a short enough vector containing the private key

The current message is actively misleading — a user running --attack=polynonce who sees "all pairs have s1 == s2" has no useful information about what went wrong.

Fix: Either make Attack::recover() return a Result<RecoveredKey, RecoveryError> with typed failure reasons, or at minimum make the fallback message generic (e.g. "recovery did not produce a valid key") rather than attack-specific.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions