Documentation ¶
Index ¶
- func CheckPolicy(policy string, userattrsJson string) string
- func Decode(x string) []byte
- func Decrypt(ctJson string, userattrsJson string) string
- func Encode(x []byte) string
- func Encrypt(secret string, policy string, authpubsJson string) string
- func ExtractAttrsFromPolicy(policy string) string
- func ExtractAuthsFromPolicy(policy string) string
- func ExtractPolicyFromCiphertext(ctJson string) string
- func ExtractVarsFromUserAttrs(userattrsJson string) map[string]int
- func GetCurve(curveStr string) string
- func JsonObj2Str(x interface{}) string
- func NewRandomAuth(orgJson string) string
- func NewRandomOrg(lib string, curveJson string) string
- func NewRandomSecret(orgJson string, seed string) string
- func NewRandomUserkey(user string, attr string, authprvJson string) string
- func RewritePolicy(policy string) string
- func SelectUserAttrs(user string, policy string, userattrsJson string) string
- func SolvePolicy(policy string, userattrsJson string) map[string]int
- type AuthKeys
- type AuthPrv
- type AuthPub
- type AuthPubs
- type Ciphertext
- type Curve
- type Org
- type PbcCurve
- func (curve *PbcCurve) Decode() Curve
- func (curve *PbcCurve) Div(g1 Point, g2 Point) Point
- func (curve *PbcCurve) Encode() Curve
- func (curve *PbcCurve) HashToGroup(x string, group string) Point
- func (curve *PbcCurve) HashToPow(x string, g Point) Point
- func (curve *PbcCurve) Inv(g1 Point) Point
- func (curve *PbcCurve) Mul(g1 Point, g2 Point) Point
- func (curve *PbcCurve) NewPointOn(group string) Point
- func (curve *PbcCurve) NewRandomExp() *big.Int
- func (curve *PbcCurve) NewRandomPointOn(group string) Point
- func (curve *PbcCurve) NewRandomSecret(n int, zerosecret bool) []*big.Int
- func (curve *PbcCurve) Pair(g1 Point, g2 Point) Point
- func (curve *PbcCurve) Pow(g1 Point, e1 *big.Int) Point
- func (curve *PbcCurve) Pow2(g1 Point, e1 *big.Int, g2 Point, e2 *big.Int) Point
- func (curve *PbcCurve) Pow3(g1 Point, e1 *big.Int, g2 Point, e2 *big.Int, g3 Point, e3 *big.Int) Point
- func (curve *PbcCurve) ProdPair(g1 []Point, g2 []Point) Point
- func (curve *PbcCurve) UnitOnGroup(group string) Point
- type PbcPoint
- type Point
- type PolicyAttrs
- type UserAttrs
- type Userkey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPolicy ¶
checks satisfiability of a policy
func Decrypt ¶
decrypt a ciphertext the function requires the list of user attributes to use and the corresponding collection of userkey
func Encrypt ¶
encrypt a secret according to a given policy the function requires the public keys of the authorities mentioned in the policy
func ExtractAttrsFromPolicy ¶
extracts attributes from policy string
func ExtractAuthsFromPolicy ¶
extracts authorities from a policy string
func ExtractPolicyFromCiphertext ¶
extracts policy embedded in a ciphertext
func JsonObj2Str ¶
func JsonObj2Str(x interface{}) string
func NewRandomUserkey ¶
new random userkey
func RewritePolicy ¶
rewrites a policy in a simplified form
func SelectUserAttrs ¶
select user attrs relevant for a given policy string
Types ¶
type AuthKeys ¶
type AuthKeys struct { AuthPub string `json:"authpub"` // public key of the authority AuthPrv string `json:"authprv"` // private key of the authority }
authority public and private keys
type AuthPrv ¶
type AuthPrv struct { Org string `json:"org"` Alpha string `json:"alpha"` Y string `json:"y"` // contains filtered or unexported fields }
authority private params
type AuthPub ¶
type AuthPub struct { Org string `json:"org"` Ealpha string `json:"ealpha"` G1y string `json:"g1y"` // contains filtered or unexported fields }
authority public params
type AuthPubs ¶
type AuthPubs struct {
AuthPub map[string]string `json:"authpub"` // authority -> corresponding public key
}
map of authorities public keys
type Ciphertext ¶
type Ciphertext struct { Org string `json:"org"` Policy string `json:"policy"` C0 string `json:"C0"` C map[string][][]string `json:"C"` // contains filtered or unexported fields }
ciphertext encrypting the msg
func (*Ciphertext) Decode ¶
func (ct *Ciphertext) Decode() *Ciphertext
Ciphertext type from its json representation
func (*Ciphertext) Encode ¶
func (ct *Ciphertext) Encode() *Ciphertext
Ciphertext type to its json representation
type Curve ¶
type Curve interface { Encode() Curve Decode() Curve NewPointOn(group string) Point NewRandomExp() *big.Int NewRandomSecret(n int, zerosecret bool) []*big.Int NewRandomPointOn(group string) Point UnitOnGroup(group string) Point HashToGroup(x string, group string) Point HashToPow(x string, g Point) Point Inv(g1 Point) Point Mul(g1 Point, g2 Point) Point Div(g1 Point, g2 Point) Point Pow(g1 Point, e1 *big.Int) Point Pow2(g1 Point, e1 *big.Int, g2 Point, e2 *big.Int) Point Pow3(g1 Point, e1 *big.Int, g2 Point, e2 *big.Int, g3 Point, e3 *big.Int) Point Pair(g1 Point, g2 Point) Point ProdPair(g1 []Point, g2 []Point) Point // contains filtered or unexported methods }
curve interface
type Org ¶
type Org struct { Lib string `json:"lib"` Curve string `json:"curve"` G1 string `json:"g1"` G2 string `json:"g2"` E string `json:"e"` // contains filtered or unexported fields }
organization
type PbcCurve ¶
type PbcCurve struct { Params string `json:"params"` Maxrndexp string `json:"maxrndexp"` // contains filtered or unexported fields }
curve on pbc library
func (*PbcCurve) HashToGroup ¶
hash to group ("G1", "G2", "GT") in the bilinear pairing
func (*PbcCurve) NewPointOn ¶
new point instance on a curve
func (*PbcCurve) NewRandomPointOn ¶
new random point on a group ("G1", "G2", "GT") in the bilinear pairing
func (*PbcCurve) NewRandomSecret ¶
new random secret vector of length n if zerosecret is true, the first component of the vector is zero
func (*PbcCurve) Pow3 ¶
func (curve *PbcCurve) Pow3(g1 Point, e1 *big.Int, g2 Point, e2 *big.Int, g3 Point, e3 *big.Int) Point
group operation
func (*PbcCurve) UnitOnGroup ¶
unit on group ("G1", "G2", "GT") in the bilinear pairing
type PbcPoint ¶
type PbcPoint struct { P string `json:"p"` Group string `json:"group"` // contains filtered or unexported fields }
point on pbc library
type Point ¶
type Point interface { Encode() Point Decode(curve Curve) Point GetP() string GetGroup() string // contains filtered or unexported methods }
point interface
type PolicyAttrs ¶
type PolicyAttrs struct {
Row map[string][]int `json:"row"` // attribute -> access policy matrix rows index
}
attributes in a given policy
type UserAttrs ¶
type UserAttrs struct { User string `json:"user"` // user Coeff map[string][]int `json:"coeff"` // attribute -> its coefficients Userkey map[string]string `json:"userkey"` // attribute -> corresponding userkey }
map of user attributes