dualec

package module
v0.0.0-...-9a3fbda Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: BSD-3-Clause Imports: 15 Imported by: 0

README

dualec

Documentation

Overview

Package dualec implements the insecure, broken Dual_EC_DRBG algorithm.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c Curve, rand io.Reader, hash func() hash.Hash) (io.Reader, error)

New creates a Dual_EC_DRBG instance using the default parameters on a particular elliptic curve.

It generates seeds using the provider Reader and hash function.

func NewWithPQ

func NewWithPQ(c Curve, P, Q *Point, rand io.Reader, hash func() hash.Hash) (io.Reader, error)

NewWithPQ creates a Dual_EC_DRBG instance using custom parameters.

It generates seeds using the provider Reader and hash function.

func Recover

func Recover(c Curve, P, Q *Point, d []byte, r io.Reader, hash func() hash.Hash) (io.Reader, error)

Recover returns a Reader that will produce the same output as the input Reader, up until it reseeds.

Types

type Curve

type Curve interface {
	// Generator returns the curve's generator point.
	Generator() *Point
	// NewPoint validates and creates a Point from its encoding.
	NewPoint([]byte) (*Point, error)
	// ScalarMult performs the Point with a scalar, returning the
	// resulting Point.
	ScalarMult(*Point, []byte) (*Point, error)
	// contains filtered or unexported methods
}

Curve is a NIST prime curve.

func P256

func P256() Curve

P256 returns the NIST P-256 (secp256r1) curve.

func P384

func P384() Curve

P384 returns the NIST P-384 (secp384r1) curve.

func P521

func P521() Curve

P521 returns the NIST P-521 (secp521r1) curve.

type Point

type Point struct {
	// contains filtered or unexported fields
}

Point is a point on a NIST prime curve.

It does not include the point at infinity.

func Backdoor

func Backdoor(c Curve, P *Point) (Q *Point, d []byte)

Backdoor computes a backdoored Q for some fixed P.

func (*Point) BytesX

func (p *Point) BytesX() ([]byte, error)

BytesX returns the encoding of the x-coordinate.

Jump to

Keyboard shortcuts

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