cryptox

package
v0.0.0-...-c52725e Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PublicKeySize is the size, in bytes, of public keys as used in this package.
	PublicKeySize = 32
	// PrivateKeySize is the size, in bytes, of private keys as used in this package.
	PrivateKeySize = 64
	// SignatureSize is the size, in bytes, of signatures generated and verified by this package.
	SignatureSize = 64
	// SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032.
	SeedSize = 32
)

Variables

This section is empty.

Functions

func AVerify

func AVerify(asig *bn256.G1, msgs []string, pks []*bn256.G2) bool

AVerify (asig *bn256.G1, msgs []string, pks []*bn256.G2) bool Aggregate Verification. We are given an aggregate signature σ <-- G1 for an aggregating subset of users U, indexed as before, and are given the original messages Mi <-- {1, 0}∗ and public keys vi <-- G2 for all users ui <-- U. To verify the aggregate signature σ, 1. ensure that the messages Mi are all distinct, and reject otherwise; and 2. compute hi = H(Mi) for 1 ≤ i ≤ k = |U|, and accept if e(σ, g2) = MullAll(e(hi, vi)) holds.

func Aggregate

func Aggregate(sigs []*bn256.G1) *bn256.G1

Aggregate (sigs []*bn256.G1) *bn256.G1 Aggregation. For the aggregating subset of users U ⊆ U, assign to each user an index i, ranging from 1 to k = jUj. Each user ui 2 U provides a signature σi 2 G1 on a message Mi 2 f0; 1g∗ of his choice. The messages Mi must all be distinct. Compute σ Qk i=1 σi. The aggregate signature is σ 2 G1.

func KeyGenerate

func KeyGenerate() (*big.Int, *bn256.G2, PrivateKey, PublicKey)

KeyGenerate () (*big.Int, *bn256.G2) Key Generation. For a particular user, pick random x <-$- Zp, and compute v = g2^x. The user’s public key is v <--- G2. The user’s secret key is x <--- Zp.

func Sign

func Sign(sk *big.Int, msg string) *bn256.G1

Sign (sk *big.Int, msg string) *bn256.G1 Signing. For a particular user, given the secret key x and a message M 2 f0; 1g∗, compute h H(M), where h 2 G1, and σ hx. The signature is σ 2 G1.

func Verify

func Verify(pk *bn256.G2, msg string, sig *bn256.G1) bool

Verify (pk *bn256.G2, msg string, sig *bn256.G1) bool Verification. Given user’s public key v, a message M, and a signature σ, compute h H(M); accept if e(σ; g2) = e(h; v) holds.

Types

type PrivateKey

type PrivateKey []byte

PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer.

func (PrivateKey) Public

func (priv PrivateKey) Public() crypto.PublicKey

Public returns the PublicKey corresponding to priv.

func (PrivateKey) Sign

func (priv PrivateKey) Sign(message []byte) (signature []byte, err error)

type PublicKey

type PublicKey []byte

PublicKey is the type of Ed25519 public keys.

func (PublicKey) Verify

func (pub PublicKey) Verify(message, sigBytes []byte) bool

Verify reports whether sig is a valid signature of message by publicKey. It will panic if len(publicKey) is not PublicKeySize.

Jump to

Keyboard shortcuts

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