p256

package
v0.0.0-...-a7f001f Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func BytesToPoint

func BytesToPoint(p []byte) (x *big.Int, y *big.Int)

BytesToPoint maps a 32 bytes data into a point on the P256 curve using the Koblitz conversion algorithm. It may return nil if conversion fails. It can retrun nil with probability 64.645%.

Types

type CurveField

type CurveField interface {
	elliptic.Curve
	Inverse(k *big.Int) *big.Int
	CombinedMult(bigX, bigY *big.Int, baseScalar, scalar []byte) (x, y *big.Int)
}

Pull some internal fetures out for easier field operations

type Key

type Key ecdsa.PrivateKey

func New

func New(rand io.Reader) *Key

func PrivKey

func PrivKey(D []byte) (priv *Key)

func PubKey

func PubKey(XY []byte) (pubkey *Key)

func (*Key) Bytes

func (key *Key) Bytes() []byte

func (*Key) Decrypt

func (priv *Key) Decrypt(ciphertext []byte) []byte

func (*Key) Encrypt

func (pubkey *Key) Encrypt(plaintext []byte, rand io.Reader) []byte

func (*Key) Sign

func (priv *Key) Sign(digest []byte, rand io.Reader) []byte

func (*Key) Verify

func (pub *Key) Verify(digest, sig []byte) bool

Jump to

Keyboard shortcuts

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