ecc25519

package
v0.0.0-...-9fbb145 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PublicKeySize  = ed25519.PublicKeySize
	PrivateKeySize = ed25519.PrivateKeySize
	PubPriKeySize  = ed25519.PublicKeySize
	FullKeySize    = ed25519.SignatureSize
)

Variables

This section is empty.

Functions

func PrivateKeyToCurve25519

func PrivateKeyToCurve25519(curve25519Private *[PubPriKeySize]byte, privateKey *[PubPriKeySize]byte)

PrivateKeyToCurve25519 converts an ed25519 private key into a corresponding curve25519 private key such that the resulting curve25519 public key will equal the result from PublicKeyToCurve25519.

func PublicKeyToCurve25519

func PublicKeyToCurve25519(curve25519Public *[PubPriKeySize]byte, publicKey *[PubPriKeySize]byte) bool

PublicKeyToCurve25519 converts an Ed25519 public key into the curve25519 public key that would be generated from the same private key.

func RepresentativeToPublicKey

func RepresentativeToPublicKey(publicKey, representative *[32]byte)

RepresentativeToPublicKey converts a uniform representative value for a curve25519 public key, as produced by ScalarBaseMult, to a curve25519 public key.

func ScalarBaseMult

func ScalarBaseMult(publicKey, representative, privateKey *[PubPriKeySize]byte) bool

ScalarBaseMult computes a curve25519 public key from a private key and also a uniform representative for that public key. Note that this function will fail and return false for about half of private keys. See http://elligator.cr.yp.to/elligator-20130828.pdf.

Types

type Curve

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

func (*Curve) Decrypt

func (cr *Curve) Decrypt(cipherText []byte) ([]byte, error)

func (*Curve) Encrypt

func (cr *Curve) Encrypt(plainText []byte) ([]byte, error)

encrypt up to 64 bytes

func (*Curve) GetKey

func (es *Curve) GetKey() []byte

func (*Curve) GetKeyString

func (es *Curve) GetKeyString() string

func (*Curve) GetPrivate

func (es *Curve) GetPrivate() []byte

func (*Curve) GetPrivateString

func (es *Curve) GetPrivateString() string

func (*Curve) GetPublic

func (es *Curve) GetPublic() []byte

func (*Curve) GetPublicString

func (es *Curve) GetPublicString() string

func (*Curve) MakeKey

func (es *Curve) MakeKey() (err error)

generate private and public key pairs

func (*Curve) SetKey

func (es *Curve) SetKey(key []byte) error

func (*Curve) SetKeyString

func (es *Curve) SetKeyString(key string) error

func (*Curve) SetPrivate

func (es *Curve) SetPrivate(pri32 []byte) error

if you must set the private key to sign, note that you also need to set the public key, because the real private key is actually a combination of the public key and private key

func (*Curve) SetPrivateString

func (es *Curve) SetPrivateString(pri string) error

func (*Curve) SetPublic

func (es *Curve) SetPublic(pub32 []byte) error

if you only need to verify the signature, you only need the public key. Generally, the verifier does not have a private key pub32 must be longer than 32 and only the first 32 bytes are fetched

func (*Curve) SetPublicString

func (es *Curve) SetPublicString(pub string) error

func (*Curve) Sign

func (es *Curve) Sign(data []byte) []byte

func (*Curve) Verify

func (es *Curve) Verify(sign *[FullKeySize]byte, data []byte) bool

Jump to

Keyboard shortcuts

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