Documentation
¶
Overview ¶
Package cryptowedge provides implementations of classical attacks against RSA and related public-key cryptosystems.
The package is intended for security research, CTF challenges, and educational use: each attack targets a specific weakness (small private exponent, small public exponent, shared factors, and so on) and recovers key material or plaintext when that weakness is present.
Attacks ¶
Wiener implements Wiener's attack, recovering the private exponent of RSA keys with a small d (roughly d < N^(1/4)/3).
Usage ¶
These functions succeed only when the targeted weakness is present; against securely generated keys they report failure rather than recovering anything. Use them only against systems you are authorized to test.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotVulnerable = errors.New("wiener: key not vulnerable to Wiener's attack")
Functions ¶
func Wiener ¶
Wiener attempts to recover the RSA private exponent from the public key (N, e) using Wiener's attack.
It walks the convergents of the continued fraction of e/N, and for each candidate reconstructs phi(N), solves the quadratic x^2 - (N-phi+1)x + N = 0 for the prime factors, and verifies that they reconstruct N. On success it returns the private exponent d together with the factors p and q of N.
The attack only works against keys with a small private exponent, roughly d < N^(1/4)/3. If no convergent yields a valid factorization - the usual case for a securely generated key - Wiener returns ErrNotVulnerable and the three *big.Int results are nil.
N and e must be a well-formed RSA public key with N = p*q for distinct primes p and q; behavior is unspecified for other inputs.
Types ¶
This section is empty.