Documentation
¶
Overview ¶
Package elliptic implements several standard elliptic curves over prime fields. Note that not all curves are supported everywhere (e.g. RHEL/Fedora).
Index ¶
- func GenerateKey(curve elliptic.Curve, rand io.Reader) (priv []byte, x, y *big.Int, err error)
- func IsSupported(curve elliptic.Curve) bool
- func Marshal(curve elliptic.Curve, x, y *big.Int) []byte
- func P256() elliptic.Curve
- func P384() elliptic.Curve
- func P521() elliptic.Curve
- func Unmarshal(curve elliptic.Curve, data []byte) (x, y *big.Int)
- type CurveParams
- func (curve CurveParams) Add(x1, y1, x2, y2 *big.Int) (x, y *big.Int)
- func (curve CurveParams) Double(x1, y1 *big.Int) (x, y *big.Int)
- func (curve CurveParams) IsOnCurve(x, y *big.Int) bool
- func (curve CurveParams) Params() *elliptic.CurveParams
- func (curve CurveParams) ScalarBaseMult(k []byte) (x, y *big.Int)
- func (curve CurveParams) ScalarMult(x1, y1 *big.Int, k []byte) (x, y *big.Int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKey ¶
GenerateKey returns a public/private key pair. The private key is generated using the given reader, which must return random data. TODO(runcom): add support for Go stdlib `elliptic.Curve`, for now unsupported
func IsSupported ¶
IsSupported is a shorthand to check if the given curve is supported on your system.
func P256 ¶
P256 returns a Curve which implements P-256 (see FIPS 186-3, section D.2.3) If the returned curve is nil then it's unsupported on your system.
func P384 ¶
P384 returns a Curve which implements P-384 (see FIPS 186-3, section D.2.4) If the returned curve is nil then it's unsupported on your system.
Types ¶
type CurveParams ¶
type CurveParams struct { *elliptic.CurveParams // contains filtered or unexported fields }
CurveParams contains the parameters of an elliptic curve
func (CurveParams) Params ¶
func (curve CurveParams) Params() *elliptic.CurveParams
func (CurveParams) ScalarBaseMult ¶
func (curve CurveParams) ScalarBaseMult(k []byte) (x, y *big.Int)