Documentation ¶
Index ¶
- func AuthPubsOfPolicyJson(policy string) string
- func Decode(x string) string
- func DecryptJson(ctJson string, userattrsJson string) string
- func DecryptJson1(ctJson string, userattrsJson string) string
- func DecryptJson2(ctJson string, userattrsJson string) string
- func Encode(x string) string
- func EncryptJson(secretJson string, policy string, authpubsJson string) string
- func EncryptJson1(secretJson string, secretJson1 string, policy string, authpubsJson string) string
- func JsonObjToEncStr(x interface{}) string
- func JsonObjToStr(x interface{}) string
- func NewRandomAuthJson(orgJson string) string
- func NewRandomOrgJson(curveJson string) string
- func NewRandomSecretJson(orgJson string) string
- func NewRandomUserkeyJson(user string, attr string, authprvJson string) string
- func PolicyOfCiphertext(ct *Ciphertext) string
- func PolicyOfCiphertextJson(ctJson string) string
- func SecretHash(secret Point) string
- func SelectUserAttrsJson(user string, policy string, userattrsJson string) string
- type AccessPolicy
- type AuthKeys
- type AuthPrv
- type AuthPub
- type AuthPubs
- type Ciphertext
- type Curve
- type Org
- type Point
- type UserAttrs
- type Userkey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthPubsOfPolicyJson ¶
Json API for AuthPubsOfPolicy
func DecryptJson ¶
Json API for Decrypt
func DecryptJson1 ¶
Json API for Decrypt
func DecryptJson2 ¶
Json API for Decrypt
func EncryptJson ¶
Json API for Encrypt
func EncryptJson1 ¶
Json API for Encrypt
func JsonObjToEncStr ¶
func JsonObjToEncStr(x interface{}) string
func JsonObjToStr ¶
func JsonObjToStr(x interface{}) string
func NewRandomSecretJson ¶
Json API for NewRandomSecret
func NewRandomUserkeyJson ¶
Json API for NewRandomUserkey
func PolicyOfCiphertext ¶
func PolicyOfCiphertext(ct *Ciphertext) string
func PolicyOfCiphertextJson ¶
Json API extracting policy from ciphertexts
func SecretHash ¶
Types ¶
type AccessPolicy ¶
type AccessPolicy struct { M [][]int // access policy matrix Vars []string // attribute list Row map[string][]int // attribute -> access policy matrix rows index }
attributes in a given policy
type AuthKeys ¶
type AuthKeys struct { AuthPub *AuthPub `json:"-"` AuthPub_ string `json:"authpub"` // public key of the authority AuthPrv *AuthPrv `json:"-"` AuthPrv_ string `json:"authprv"` // private key of the authority }
authority public and private keys
func NewAuthKeysOfJsonStr ¶
type AuthPrv ¶
type AuthPrv struct { Org *Org `json:"-"` Org_ string `json:"org"` Alpha *big.Int `json:"-"` Alpha_ string `json:"alpha"` Y *big.Int `json:"-"` Y_ string `json:"y"` }
authority private params
func NewAuthPrvOfJsonStr ¶
type AuthPub ¶
type AuthPub struct { Org *Org `json:"-"` Org_ string `json:"org"` Ealpha Point `json:"-"` Ealpha_ string `json:"ealpha"` G1y Point `json:"-"` G1y_ string `json:"g1y"` }
authority public params
func NewAuthPubOfJsonStr ¶
type AuthPubs ¶
type AuthPubs struct { AuthPub map[string]*AuthPub `json:"-"` AuthPub_ map[string]string `json:"authpub"` // authority -> corresponding public key }
map of authorities public keys
func AuthPubsOfPolicy ¶
extracts authorities from a policy string
func NewAuthPubsOfJsonStr ¶
type Ciphertext ¶
type Ciphertext struct { Org *Org `json:"-"` Org_ string `json:"org"` Policy string `json:"-"` Policy_ string `json:"policy"` C0 Point `json:"-"` C0_ string `json:"c0"` C1 Point `json:"-"` C1_ string `json:"c0"` C map[string][][]Point `json:"-"` C_ map[string][][]string `json:"c"` }
ciphertext encrypting the msg
func Encrypt ¶
func Encrypt(secret Point, policy string, authpubs *AuthPubs) (ct *Ciphertext)
encrypt a secret according to a given policy the function requires the public keys of the authorities mentioned in the policy
func Encrypt1 ¶
func Encrypt1(secret Point, secret2 Point, policy string, authpubs *AuthPubs) (ct *Ciphertext)
this is a test
func NewCiphertextOfJsonStr ¶
func NewCiphertextOfJsonStr(xJson string) (x *Ciphertext)
func (*Ciphertext) OfJsonObj ¶
func (ct *Ciphertext) OfJsonObj() *Ciphertext
Ciphertext type from its json representation
func (*Ciphertext) ToJsonObj ¶
func (ct *Ciphertext) ToJsonObj() *Ciphertext
Ciphertext type to its json representation
type Curve ¶
type Curve interface { ToJsonObj() Curve OfJsonObj() Curve SetSeed(seed string) Curve InitRng() 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
func NewCurveOfJsonStr ¶
type Org ¶
type Org struct { Crv Curve `json:"-"` Crv_ string `json:"crv"` G1 Point `json:"-"` G1_ string `json:"g1"` G2 Point `json:"-"` G2_ string `json:"g2"` E Point `json:"-"` E_ string `json:"e"` }
organization
func GetOrgFromAuthPubs ¶
func NewOrgOfJsonStr ¶
type Point ¶
type Point interface { ToJsonObj() Point OfJsonObj(curve Curve) Point GetP() string GetGroup() string // contains filtered or unexported methods }
point interface
func Decrypt ¶
func Decrypt(ct *Ciphertext, userattrs *UserAttrs) (secret Point)
decrypt a ciphertext the function requires the list of user attributes to use and the corresponding collection of userkey
func Decrypt1 ¶
func Decrypt1(ct *Ciphertext, userattrs *UserAttrs) (secret Point)
func Decrypt2 ¶
func Decrypt2(ct *Ciphertext, userattrs *UserAttrs) (secret Point)
func NewPointOfJsonStr ¶
type UserAttrs ¶
type UserAttrs struct { User string `json:"user"` // user Coeff map[string][]int `json:"coeff"` // attribute -> its coefficients Coeff2 map[string][]int `json:"coeff"` // attribute -> its coefficients Userkey map[string]*Userkey `json:"-"` Userkey_ map[string]string `json:"userkey"` // attribute -> corresponding userkey }
map of user attributes
func NewRandomUserkey ¶
new random userkey
func NewUserAttrsOfJsonStr ¶
func (*UserAttrs) SelectUserAttrs ¶
select user attrs relevant for a given policy string