Documentation
¶
Overview ¶
Package feldman implements Feldman's verifiable secret sharing (VSS) scheme.
Feldman VSS extends Shamir's scheme with public verification. The dealer publishes commitments C_j = g^{a_j} for each coefficient a_j of the dealing polynomial. Shareholders can verify their share s_i by checking that g^{s_i} = ∏_j C_j^{i^j}.
This provides computational hiding (secret is hidden under DLog assumption) but only computational binding (dealer can potentially equivocate).
Index ¶
- Constants
- Variables
- type DealerFunc
- type DealerOutput
- type LiftedShare
- func (s *LiftedShare[E, FE]) ID() sharing.ID
- func (s *LiftedShare[E, FE]) MarshalCBOR() ([]byte, error)
- func (s *LiftedShare[E, FE]) ToAdditive(qualifiedSet *sharing.MinimalQualifiedAccessStructure) (*additive.Share[E], error)
- func (s *LiftedShare[E, FE]) UnmarshalCBOR(data []byte) error
- func (s *LiftedShare[E, FE]) Value() E
- type Scheme
- func (d *Scheme[E, FE]) AccessStructure() *sharing.ThresholdAccessStructure
- func (d *Scheme[E, FE]) Deal(secret *Secret[FE], prng io.Reader) (*DealerOutput[E, FE], error)
- func (d *Scheme[E, FE]) DealAndRevealDealerFunc(secret *Secret[FE], prng io.Reader) (*DealerOutput[E, FE], DealerFunc[FE], error)
- func (d *Scheme[E, FE]) DealRandom(prng io.Reader) (*DealerOutput[E, FE], *Secret[FE], error)
- func (d *Scheme[E, FE]) DealRandomAndRevealDealerFunc(prng io.Reader) (output *DealerOutput[E, FE], secret *Secret[FE], dealerFunc DealerFunc[FE], ...)
- func (*Scheme[E, FE]) Name() sharing.Name
- func (d *Scheme[E, FE]) Reconstruct(shares ...*Share[FE]) (*Secret[FE], error)
- func (d *Scheme[E, FE]) ReconstructAndVerify(reference VerificationVector[E, FE], shares ...*Share[FE]) (*Secret[FE], error)
- func (d *Scheme[E, FE]) Verify(share *Share[FE], reference VerificationVector[E, FE]) error
- type Secret
- type Share
- type SharesInExponent
- type VerificationVector
Constants ¶
const Name sharing.Name = "Feldman's Verifiable Secret Sharing Scheme"
Name is the canonical name of this secret sharing scheme.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type DealerFunc ¶
type DealerFunc[FE algebra.PrimeFieldElement[FE]] = shamir.DealerFunc[FE]
DealerFunc is the polynomial used to generate shares (same as Shamir).
type DealerOutput ¶
type DealerOutput[E algebra.PrimeGroupElement[E, FE], FE algebra.PrimeFieldElement[FE]] struct { // contains filtered or unexported fields }
DealerOutput contains the result of a Feldman VSS dealing operation: a map of shares and the verification vector for share verification.
func (*DealerOutput[E, FE]) Shares ¶
Shares returns the map of shareholder IDs to their corresponding shares.
func (*DealerOutput[E, FE]) VerificationMaterial ¶
func (d *DealerOutput[E, FE]) VerificationMaterial() VerificationVector[E, FE]
VerificationMaterial returns the verification vector V = (g^{a_0}, g^{a_1}, ..., g^{a_{t-1}}) which allows shareholders to verify their shares without revealing the secret.
type LiftedShare ¶
type LiftedShare[E algebra.PrimeGroupElement[E, FE], FE algebra.PrimeFieldElement[FE]] struct { // contains filtered or unexported fields }
LiftedShare represents a share lifted to the exponent: g^{f(i)} where f(i) is the underlying Shamir share value. This is used when shares need to be verified or combined in the group rather than the field.
func NewLiftedShare ¶
func NewLiftedShare[E algebra.PrimeGroupElement[E, FE], FE algebra.PrimeFieldElement[FE]](id sharing.ID, v E) (*LiftedShare[E, FE], error)
NewLiftedShare creates a new lifted share with the given ID and group element value.
func (*LiftedShare[E, FE]) ID ¶
func (s *LiftedShare[E, FE]) ID() sharing.ID
ID returns the shareholder identifier for this lifted share.
func (*LiftedShare[E, FE]) MarshalCBOR ¶
func (s *LiftedShare[E, FE]) MarshalCBOR() ([]byte, error)
func (*LiftedShare[E, FE]) ToAdditive ¶
func (s *LiftedShare[E, FE]) ToAdditive(qualifiedSet *sharing.MinimalQualifiedAccessStructure) (*additive.Share[E], error)
ToAdditive converts this lifted share to an additive share by exponentiating with the appropriate Lagrange coefficient. For shareholder i in qualified set S, the result is g^{λ_i · f(i)} where λ_i is the Lagrange coefficient. The resulting additive shares can be multiplied together to reconstruct g^s.
func (*LiftedShare[E, FE]) UnmarshalCBOR ¶
func (s *LiftedShare[E, FE]) UnmarshalCBOR(data []byte) error
func (*LiftedShare[E, FE]) Value ¶
func (s *LiftedShare[E, FE]) Value() E
Value returns the group element value g^{f(i)} of this lifted share.
type Scheme ¶
type Scheme[E algebra.PrimeGroupElement[E, FE], FE algebra.PrimeFieldElement[FE]] struct { // contains filtered or unexported fields }
Scheme implements Feldman's verifiable secret sharing.
func NewScheme ¶
func NewScheme[E algebra.PrimeGroupElement[E, FE], FE algebra.PrimeFieldElement[FE]](basePoint E, threshold uint, shareholders ds.Set[sharing.ID]) (*Scheme[E, FE], error)
NewScheme creates a new Feldman VSS scheme.
Parameters:
- basePoint: Generator g of the group used for verification commitments
- threshold: Minimum shares required for reconstruction (must be ≥ 2)
- shareholders: Set of shareholder IDs
func (*Scheme[E, FE]) AccessStructure ¶
func (d *Scheme[E, FE]) AccessStructure() *sharing.ThresholdAccessStructure
AccessStructure returns the threshold access structure.
func (*Scheme[E, FE]) Deal ¶
Deal creates shares for the given secret along with a verification vector.
func (*Scheme[E, FE]) DealAndRevealDealerFunc ¶
func (d *Scheme[E, FE]) DealAndRevealDealerFunc(secret *Secret[FE], prng io.Reader) (*DealerOutput[E, FE], DealerFunc[FE], error)
DealAndRevealDealerFunc creates shares and returns the dealing polynomial. The verification vector is computed as g^{f(x)} where f is the polynomial.
func (*Scheme[E, FE]) DealRandom ¶
DealRandom generates shares for a randomly sampled secret.
func (*Scheme[E, FE]) DealRandomAndRevealDealerFunc ¶
func (d *Scheme[E, FE]) DealRandomAndRevealDealerFunc(prng io.Reader) (output *DealerOutput[E, FE], secret *Secret[FE], dealerFunc DealerFunc[FE], err error)
DealRandomAndRevealDealerFunc generates shares for a random secret and returns the dealing polynomial.
func (*Scheme[E, FE]) Reconstruct ¶
Reconstruct recovers the secret from a set of shares using Lagrange interpolation.
type Secret ¶
type Secret[FE algebra.PrimeFieldElement[FE]] = shamir.Secret[FE]
Secret is a Feldman VSS secret, which is identical to a Shamir secret. This is the value s = f(0) that is shared among the shareholders.
func NewSecret ¶
func NewSecret[FE algebra.PrimeFieldElement[FE]](value FE) *Secret[FE]
NewSecret creates a new secret from a field element.
type Share ¶
type Share[FE algebra.PrimeFieldElement[FE]] = shamir.Share[FE]
Share is a Feldman VSS share, which is identical to a Shamir share. The share value is f(i) where f is the dealing polynomial and i is the shareholder ID.
func NewShare ¶
func NewShare[FE algebra.PrimeFieldElement[FE]](id sharing.ID, v FE, ac *sharing.ThresholdAccessStructure) (*Share[FE], error)
NewShare creates a new Feldman share with the given ID and value. If an access structure is provided, validates that the ID is a valid shareholder.
type SharesInExponent ¶
type SharesInExponent[E algebra.PrimeGroupElement[E, FE], FE algebra.PrimeFieldElement[FE]] []*LiftedShare[E, FE]
SharesInExponent is a collection of lifted shares that can be used to reconstruct the secret in the exponent (i.e., g^s) without revealing s.
func (SharesInExponent[E, FE]) ReconstructAsAdditive ¶
func (s SharesInExponent[E, FE]) ReconstructAsAdditive() (E, error)
ReconstructAsAdditive reconstructs g^s from a set of lifted shares using Lagrange interpolation in the exponent. Each share g^{f(i)} is raised to its Lagrange coefficient λ_i, and the results are multiplied together: g^s = ∏_i (g^{f(i)})^{λ_i} = g^{∑_i λ_i·f(i)} = g^{f(0)} = g^s.
type VerificationVector ¶
type VerificationVector[E algebra.PrimeGroupElement[E, FE], FE algebra.PrimeFieldElement[FE]] = *polynomials.ModuleValuedPolynomial[E, FE]
VerificationVector is the public commitment to the dealing polynomial, where each coefficient is lifted to the exponent: V_j = g^{a_j}.