Documentation
¶
Overview ¶
Package entanglement implements the cryptographic binding for kMOSAIC.
Index ¶
- Constants
- func ComputeBinding(slssBytes, tddBytes, egrwBytes []byte) []byte
- func DeserializeNIZKProof(data []byte) []byte
- func GenerateNIZKProof(secret []byte, shares [][]byte, ciphertextHashes [][]byte, seed []byte) []byte
- func SecretReconstruct(shares [][]byte) ([]byte, error)
- func SecretShare(secret []byte, n int) ([][]byte, error)
- func SecretShareDeterministic(secret []byte, n int, seed []byte) ([][]byte, error)
- func SerializeNIZKProof(proof []byte) []byte
- func VerifyCommitment(data, commitment, opening []byte) bool
- func VerifyNIZKProof(proof []byte, ciphertextHashes [][]byte, message []byte) bool
- type BindingCommitment
- type NIZKProof
Constants ¶
const ( DomainCommit = "kmosaic-commit-v1" DomainBind = "kmosaic-bind-v1" DomainNIZK = "kmosaic-nizk-v1" )
Variables ¶
This section is empty.
Functions ¶
func ComputeBinding ¶
ComputeBinding computes the cross-component binding hash. It binds the public keys of the three components (SLSS, TDD, EGRW) together. Uses three-layer binding with per-component domain separation for defense-in-depth.
func DeserializeNIZKProof ¶
DeserializeNIZKProof returns the proof bytes; no parsing here (verification parses structure).
func GenerateNIZKProof ¶
func GenerateNIZKProof(secret []byte, shares [][]byte, ciphertextHashes [][]byte, seed []byte) []byte
GenerateNIZKProof generates a Non-Interactive Zero-Knowledge proof of correct construction. In this simplified implementation, it acts as a binding of all inputs. A full implementation would use a Sigma protocol with Fiat-Shamir transform.
func SecretReconstruct ¶
SecretReconstruct reconstructs a secret from n shares. It computes the XOR sum of all shares.
func SecretShare ¶
SecretShare splits a secret into n shares using XOR-based n-of-n sharing. The first n-1 shares are random, and the last share is computed such that the XOR sum of all shares equals the secret.
func SecretShareDeterministic ¶
SecretShareDeterministic creates deterministic shares from a seed. This is used in the KEM to ensure that the encapsulation is deterministic given the randomness.
func SerializeNIZKProof ¶
SerializeNIZKProof returns the serialized proof as-is.
func VerifyCommitment ¶
VerifyCommitment verifies a binding commitment. It checks if H(data || opening) matches the commitment.
Types ¶
type BindingCommitment ¶
BindingCommitment represents a commitment with its opening.
func CreateCommitment ¶
func CreateCommitment(data []byte) (*BindingCommitment, error)
CreateCommitment creates a binding commitment to data. It returns the commitment hash and the opening (randomness).