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 ¶
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 ¶
GenChal created a challenge instance for given 'idx'. Note that 'idx' here is actually refers to the (Fid||index) parameter in PDP paper. Here the 'idx' works just as in GenTag() implementation. 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 GenChalWithSeed ¶
GenChalWithSeed created a challenge instatnce for given 'idx'. This routine works in the same way that GenChal does, except that the GenChalWithSeed requires an external entropy input 'rand'.
func (*Chal) GetNum ¶
func (c *Chal) GetNum() math.GaloisElem
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 []byte) (*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 ¶
ParseProof trys to restore a Proof instance by parsing given string
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
type SignPubKey ¶
type SignPubKey struct {
// contains filtered or unexported fields
}
SignPubKey is the public key for PDP signature verification
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 int64, 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. And we actually apply a different way of 'idx'-related calculating.