proofDP

package module
v0.0.0-...-4810b32 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyProof

func VerifyProof(pp *PublicParams, c Chal, p Proof) bool

VerifyProof validates if the given 'p' is exactly a sound proof against the given challenge 'c'

func VerifySignature

func VerifySignature(s Signature, h [sha256.Size]byte, pk SignPubKey) bool

VerifySignature validates if a signature is signed using 'pk'-responding SignPrivKey instance on the given hash 'h'.

Types

type Chal

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

Chal wraps a validator created random value & corespoding idx

func GenChal

func GenChal(idx []byte) (Chal, error)

GenChal created a challenge instance for given 'idx'. Note that 'idx' here is actually refers to the (Fid||index) parameter in PDP paper. Also, GenChal creates just *ONE* challenge against the given 'idx'. According to the original paper, there should be a set of challenge against *ONE* file, which, however, is not going well with Lambda's system design.

func ParseChal

func ParseChal(s string) (Chal, error)

ParseChal trys to restore a Chal instance

func (*Chal) Marshal

func (c *Chal) Marshal() string

Marshal works as a serialization routine

type PrivateParams

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

PrivateParams holds the private parameters of a specific PDP proof. Note a PrivateParams instance can be used to validate multiple PublicParams's proof.

func GeneratePrivateParams

func GeneratePrivateParams(sk crypto.PrivKey) (*PrivateParams, error)

GeneratePrivateParams returns the PrivateParams instance created using given crypto.PrivKey

func ParsePrivateParams

func ParsePrivateParams(s string) (*PrivateParams, error)

ParsePrivateParams try to restore a PrivateParams instance

func (*PrivateParams) GeneratePublicParams

func (sp *PrivateParams) GeneratePublicParams(u math.EllipticPoint) *PublicParams

GeneratePublicParams returns a PublicParams instance generated using the given elliptic curve point 'u'

func (*PrivateParams) Marshal

func (sp *PrivateParams) Marshal() string

Marshal works as a serialization

type Proof

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

Proof is the product of Prove

func ParseProof

func ParseProof(s string) (Proof, error)

ParseProof trys to restore a Proof instance by parsing given string

func Prove

func Prove(pp *PublicParams, c Chal, t Tag, data io.Reader) (Proof, error)

Prove created a Proof instance against the given challenge & the local storage. Note that in this implementation a Chal instance contains only *ONE* pair of challenge target index & coresponding random value.

func (*Proof) Marshal

func (p *Proof) Marshal() string

Marshal works as a serialization routine

type PublicParams

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

PublicParams holds the public paramters of a specific PDP proof. Note that there may be multiple PublicParams instance coresponding to the same PrivateParams.

func ParsePublicParams

func ParsePublicParams(s string) (*PublicParams, error)

ParsePublicParams trys to restore a PublicParams instance from a given string

func (*PublicParams) Marshal

func (pp *PublicParams) Marshal() string

Marshal works as the serialization routine

type SignPrivKey

type SignPrivKey struct {
	Pk SignPubKey
	// contains filtered or unexported fields
}

SignPrivKey is the private key for PDP signature

func GenerateSignPrivKeyFromSecret

func GenerateSignPrivKeyFromSecret(secret []byte) (*SignPrivKey, error)

GenerateSignPrivKeyFromSecret creates a new SignPrivKey instance

func (*SignPrivKey) Sign

func (sk *SignPrivKey) Sign(h [sha256.Size]byte) Signature

Sign generates a signature using SignPrivKey instance on given hash

type SignPubKey

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

SignPubKey is the public key for PDP signature verification

type Signature

type Signature = math.EllipticPoint

Signature is a wrapper of the inner type

type Tag

type Tag = math.EllipticPoint

Tag is the product of GenTag & a param of the VerifyProof

func GenTag

func GenTag(sp *PrivateParams, pp *PublicParams, idx []byte, data io.Reader) (Tag, error)

GenTag calculates the tag for given 'data' & 'idx'. Since the 'data' block may be too huge to load into memory, a SHA256 digest is applied here. Note that 'idx' here is actually refers to the (Fid||index) parameter in PDP paper.

func ParseTag

func ParseTag(s string) (Tag, error)

ParseTag try to restore a Tag instance

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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