Documentation
¶
Index ¶
- Constants
- func Encapsulate(r io.Reader, params *Params, id string) (*SessionKey, *Ciphertext, error)
- func HashToZp(bytestring []byte) *big.Int
- func HashToZpStar(bytestring []byte) *big.Int
- func IsAncestor(testing, n string) bool
- func IsDescendant(testing, n string) bool
- func PunctureTree(params *Params, nodeset []*PrivateKey, n string) ([]*PrivateKey, []*PrivateKey)
- func Setup(r io.Reader, l int) (*Params, *PrivateKey, error)
- type Ciphertext
- type Params
- type PrivateKey
- type SessionKey
Constants ¶
View Source
const ( G1Count = 1 << 1 //g1: *2 G2Count = 1 << 2 //g2: *4 GTCount = 1<<2 + 1<<3 //gt: *12 )
Variables ¶
This section is empty.
Functions ¶
func Encapsulate ¶
func Encapsulate(r io.Reader, params *Params, id string) (*SessionKey, *Ciphertext, error)
Encapsulate generates a symmetric key under the provided ID
func HashToZpStar ¶
HashToZp hashes a byte slice to an integer in Zp*.
func PunctureTree ¶
func PunctureTree(params *Params, nodeset []*PrivateKey, n string) ([]*PrivateKey, []*PrivateKey)
puncture tree
Types ¶
type Ciphertext ¶
Ciphertext
func (*Ciphertext) Marshal ¶
func (ct *Ciphertext) Marshal() []byte
Marshal encodes the ct as a byte slice.
func (*Ciphertext) Unmarshal ¶
func (ct *Ciphertext) Unmarshal(ret []byte) (*Ciphertext, error)
Unmarshal recovers the ct from an encoded byte slice.
type Params ¶
type Params struct {
G *bn256.G2
G1 *bn256.G2
G2 *bn256.G1
G3 *bn256.G1
H []*bn256.G1
//in this implementation, it will be set to an empty string
// todo: using bigint
RootID string
// pre-computed generator, e(g_1, g_2)
Pairing *bn256.GT
}
Public parameters
type PrivateKey ¶
Private key for an ID in a hierarchy If this is the master key, then A1 = nil, B is empty
func KeyGen ¶
func KeyGen(r io.Reader, params *Params, ancestor *PrivateKey, id string) (*PrivateKey, error)
KeyGen generates a scecret key for an ID using its ancestor's private key including the matster secret key. WARNING: Using a ill-structed ancestor will result in UNDIFINED behavior.
type SessionKey ¶
symmetric key
func Decapsulate ¶
func Decapsulate(key *PrivateKey, ciphertext *Ciphertext) *SessionKey
Decapsulate recovers the sysmetric key from the provided ciphertext
Click to show internal directories.
Click to hide internal directories.