Documentation ¶
Index ¶
- func CalculateSigmaI(param CalculateSigmaIParams) (*bls12_381_ecc.G1Affine, error)
- func G1FromByte(sigma []byte) (*bls12_381_ecc.G1Affine, error)
- func G1ToByte(sigma *bls12_381_ecc.G1Affine) []byte
- func G1sFromBytes(gs [][]byte) ([]*bls12_381_ecc.G1Affine, error)
- func GenKeyPair() (*PrivateKey, *PublicKey, error)
- func GenerateChallenge(indexList []int, round int64, privkey *PrivateKey) ([]*big.Int, []*big.Int, []byte, error)
- func IntListFromBytes(intList [][]byte) []*big.Int
- func IntListToBytes(intList []*big.Int) [][]byte
- func PrivateKeyToByte(privkey *PrivateKey) []byte
- func Prove(param ProofParams) (*bls12_381_ecc.G1Affine, *bls12_381_ecc.G1Affine, error)
- func PublicKeyToByte(pubkey *PublicKey) []byte
- func RandomWithinOrder() (*big.Int, error)
- func Verify(param VerifyParams) (bool, error)
- type CalculateSigmaIParams
- type PrivateKey
- type ProofParams
- type PublicKey
- type VerifyParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateSigmaI ¶
func CalculateSigmaI(param CalculateSigmaIParams) (*bls12_381_ecc.G1Affine, error)
CalculateSigmaI calculate sigma_i using each segment and private key sigma_i = sk * ( H(v||i) + SHA256(mi||r_j)*u*g1 )
func G1FromByte ¶
func G1FromByte(sigma []byte) (*bls12_381_ecc.G1Affine, error)
G1FromByte retrieve G1 point from bytes
func G1ToByte ¶
func G1ToByte(sigma *bls12_381_ecc.G1Affine) []byte
G1ToByte convert G1 point to byes
func G1sFromBytes ¶
func G1sFromBytes(gs [][]byte) ([]*bls12_381_ecc.G1Affine, error)
G1sFromBytes retrieve G1 point list from bytes
func GenKeyPair ¶
func GenKeyPair() (*PrivateKey, *PublicKey, error)
GenKeyPair generate a random private/public key pair for client
func GenerateChallenge ¶
func GenerateChallenge(indexList []int, round int64, privkey *PrivateKey) ([]*big.Int, []*big.Int, []byte, error)
GenerateChallenge generate a random challenge using index numbers for a specified round challenge = {index}, {vi}, randNum
func IntListFromBytes ¶
IntListFromBytes retrieve bit int list from bytes
func IntListToBytes ¶
IntListToBytes convert bit int list to bytes
func PrivateKeyToByte ¶
func PrivateKeyToByte(privkey *PrivateKey) []byte
PrivateKeyToByte convert private key to byes
func Prove ¶
func Prove(param ProofParams) (*bls12_381_ecc.G1Affine, *bls12_381_ecc.G1Affine, error)
Prove generate a proof by challenge material sigma = v1*sigma1 + ... + vc*sigmac mu = (v1*SHA(m1||r_j) + ... + vc*SHA256(mc||r_j)) * g1 proof = {sigma, mu}
func PublicKeyToByte ¶
PublicKeyToByte convert public key to byes
func RandomWithinOrder ¶
RandomWithinOrder generate a random number smaller than the order of G1/G2
func Verify ¶
func Verify(param VerifyParams) (bool, error)
Verify verify the proof e(sigma, g2) = e( (v1*H(v||index_1) + ... + vc*H(v||index_c)) + u*mu, pk)
Types ¶
type CalculateSigmaIParams ¶
type CalculateSigmaIParams struct { Content []byte // file content Index *big.Int // file segment index RandomV *big.Int // a random V RandomU *big.Int // a random U Privkey *PrivateKey // client private key Round int64 // challenge round }
CalculateSigmaIParams parameters required to calculate sigma_i for each segment
func CalculateSigmaIParamsFromBytes ¶
func CalculateSigmaIParamsFromBytes(content, index, randomV, randomU, privkey []byte, round int64) CalculateSigmaIParams
CalculateSigmaIParamsFromBytes retrieve CalculateSigmaIParams from bytes
type PrivateKey ¶
PrivateKey pairing based challenge private key
func PrivateKeyFromByte ¶
func PrivateKeyFromByte(privkey []byte) *PrivateKey
PrivateKeyFromByte retrieve private key from byes
type ProofParams ¶
type ProofParams struct { Content [][]byte // file contents Indices []*big.Int // {i} index list RandomVs []*big.Int // {v_i} random challenge number list Sigmas []*bls12_381_ecc.G1Affine // {sigma_i} list in storage RandThisRound []byte // random number for this challenge round }
ProofParams parameters required to generate proof
func ProofParamsFromBytes ¶
func ProofParamsFromBytes(content, indices, randVs, sigmas [][]byte, rand []byte) (ProofParams, error)
ProofParamsFromBytes retrieve ProofParams from bytes
type PublicKey ¶
type PublicKey struct {
P *bls12_381_ecc.G2Affine
}
PublicKey pairing based challenge public key
func PublicKeyFromByte ¶
PublicKeyFromByte retrieve public key from byes
type VerifyParams ¶
type VerifyParams struct { Sigma *bls12_381_ecc.G1Affine // sigma in proof Mu *bls12_381_ecc.G1Affine // mu in proof RandomV *big.Int // a random V RandomU *big.Int // a random U Indices []*big.Int // {i} index list RandomVs []*big.Int // {v_i} random challenge number list Pubkey *PublicKey // client public key }
VerifyParams parameters required to verify a proof
func VerifyParamsFromBytes ¶
func VerifyParamsFromBytes(sigma, mu, randV, randU, pubkey []byte, indices, randVs [][]byte) (VerifyParams, error)
VerifyParamsFromBytes retrieve VerifyParams from bytes