Documentation ¶
Overview ¶
This package is a copy of <https://github.com/Wollac/async.go/tree/main/pkg/acss/crypto>
Index ¶
- Constants
- Variables
- func CheckImplicate(g kyber.Group, dealerPublic, peerPublic kyber.Point, data []byte) ([]byte, error)
- func DealLen(g kyber.Group, n int) int
- func DecryptShare(g kyber.Group, deal *Deal, index int, secret []byte) (*share.PriShare, error)
- func Implicate(suite suites.Suite, dealerPublic kyber.Point, ownPrivate kyber.Scalar) []byte
- func ImplicateLen(g kyber.Group) int
- func PointUnmarshalFrom(P kyber.Point, r io.Reader) (int, error)
- func ScalarUnmarshalFrom(s kyber.Scalar, r io.Reader) (int, error)
- func Secret(g kyber.Group, remotePublic kyber.Point, ownPrivate kyber.Scalar) []byte
- func SecretLen(g kyber.Group) int
- func ShareLen(g kyber.Group) int
- type Commits
- type Deal
- type Share
Constants ¶
const ( // AEADKeySize denotes the size of the AEAD keys in bytes. AEADKeySize = chacha20poly1305.KeySize // AEADOverhead denotes the number of additional bytes required. AEADOverhead = chacha20poly1305.Overhead )
Variables ¶
var ( ErrNotCanonical = errors.New("not canonical") ErrSmallOrder = errors.New("small order") ErrInvalidInputLength = errors.New("invalid input length") ErrDecryptionFailed = errors.New("decryption failed") ErrVerificationFailed = errors.New("verification failed") )
errors returned by the package
Functions ¶
func CheckImplicate ¶
func CheckImplicate(g kyber.Group, dealerPublic, peerPublic kyber.Point, data []byte) ([]byte, error)
CheckImplicate verifies whether data is a correct implicate from peer. It returns the secret which can then be used to decrypt the corresponding share.
func DecryptShare ¶
DecryptShare decrypts and validates the encrypted share with the given index using the given secret. An error is returned if no valid share could be decrypted.
func Implicate ¶
Implicate returns the secret as well as a proof of correctness. The proof is a NIZK that sk∗G=pk ∧ sk∗pk_d=secret.
func ImplicateLen ¶
func ImplicateLen(g kyber.Group) int
ImplicateLen returns the length of Implicate in bytes.
func PointUnmarshalFrom ¶
PointUnmarshalFrom decodes the content of the point P by reading from an io.Reader. It performs all additional sanity checks, if present.
func ScalarUnmarshalFrom ¶
ScalarUnmarshalFrom decodes the content of the scalar s by reading from an io.Reader. It performs all additional sanity checks, if present.
Types ¶
type Commits ¶
type Commits []kyber.Point
Commits represents the Feldman VSS commitments.
func (Commits) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler.
type Deal ¶
type Deal struct { Commits Commits // Feldman VSS commitments PubKey kyber.Point // ephemeral public key used to encrypt the shares }
Deal contains the information distributed by the dealer.
func DealUnmarshalBinary ¶
DealUnmarshalBinary parses and verifies a deal. If an error is returned, the data is invalid and cannot be used by any peer. Otherwise, it returns the commitments C, public key pk_d and the encrypted shares.
func NewDeal ¶
NewDeal creates data necessary to distribute scalar to the peers. It returns the commitments C, public key pk_d and the encrypted shares Z.
func (*Deal) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler.