weakkey

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package weakkey tests one public key for the ways a key can be broken from the public half alone: an RSA modulus with a small factor, with two primes close together (Fermat), or with the shape of the Infineon RSALib defect (ROCA, CVE-2017-15361); and an elliptic-curve key whose private scalar is small enough to find by search, as in the 2026 eMudhra CA keys.

Every positive is a proof, never a suspicion: a factor that divides the modulus, or a scalar that reproduces the public point. ROCA is the one exception; it is a fingerprint, with a false positive rate far below one in a million. The tests are pure and need no network.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reach

func Reach(curve string) int

Reach is how large a private scalar (or its distance below the group order) the search finds on the named curve ("P-256"), as a power of two; 0 for a curve that is not searched.

Types

type Kind

type Kind string

Kind names a weakness.

const (
	RSASmallFactor Kind = "rsa-small-factor"
	RSAClosePrimes Kind = "rsa-close-primes"
	RSAROCA        Kind = "rsa-roca"
	ECSmallScalar  Kind = "ec-small-scalar"
)

The weaknesses this package finds.

func Tests

func Tests(pub crypto.PublicKey) []Kind

Tests names the tests Check runs on a key of this type; empty when it runs none (Ed25519 and X25519 hash and clamp the seed, so a small seed does not give a small scalar; post-quantum keys have no such structure).

type Weakness

type Weakness struct {
	Kind   Kind   `json:"kind"`
	Detail string `json:"detail"`
}

Weakness is one way a key is broken, with the proof in words.

func Check

func Check(pub crypto.PublicKey) []Weakness

Check runs every test that applies to the key. An empty result with len(Tests(pub)) > 0 means the key passed them.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL