cpabe

package
v0.0.0-...-f426b49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(cipthertext CipherText, userPrivateKey UserPrivateKey, pk PublicKey) *pbc.Element

func DecryptFile

func DecryptFile(input_path string, output_path string, M *pbc.Element)

func EncryptFile

func EncryptFile(input_path string, output_path string, pairing *pbc.Pairing) *pbc.Element

func ExportCipherText

func ExportCipherText(cipher CipherText, path string)

func ExportMasterSecretKey

func ExportMasterSecretKey(msk MasterSecretKey, path string)

func ExportPublicKey

func ExportPublicKey(pk PublicKey, path string)

func ExportUserPrivateKey

func ExportUserPrivateKey(upk UserPrivateKey, path string)

func ImportAttributes

func ImportAttributes(path string) []string

func Setup

func Setup() (PublicKey, MasterSecretKey)

Generate public and master secret keys

Types

type AccesPolicy

type AccesPolicy struct {
	ElemType  NodeType
	Attribute string
	Children  []*AccesPolicy
}

func ImportAccessPolicy

func ImportAccessPolicy(path string) AccesPolicy

type CipherText

type CipherText struct {
	RootNode *Node
	Ctilda   *pbc.Element
	C        *pbc.Element
}

func Encrypt

func Encrypt(pk PublicKey, M *pbc.Element, accesPolicy *AccesPolicy) CipherText

func ImportCiphertext

func ImportCiphertext(path string, pairing *pbc.Pairing) CipherText

type CipherTextExport

type CipherTextExport struct {
	RootNode *NodeExport
	Ctilda   []byte
	C        []byte
}

type MasterSecretKey

type MasterSecretKey struct {
	Beta   *pbc.Element
	Galpha *pbc.Element
}

Structure to represent the master secret key

func ImportMasterSecretKey

func ImportMasterSecretKey(path string, pairing *pbc.Pairing) MasterSecretKey

type MasterSecretKeyExport

type MasterSecretKeyExport struct {
	Beta   []byte
	Galpha []byte
}

type Node

type Node struct {
	Type       NodeType
	Attribute  string
	Children   []*Node
	Index      *pbc.Element
	Polynomial []*pbc.Element
	LeafCy     [2]*pbc.Element //\forall y\in Y C_y =g^(q_y(0)), C'_y = H(att(y))^(q_y(0))
}

type NodeExport

type NodeExport struct {
	Type       NodeType
	Attribute  string
	Children   []*NodeExport
	Index      []byte
	Polynomial [][]byte
	LeafCy     [2][]byte //\forall y\in Y C_y =g^(q_y(0)), C'_y = H(att(y))^(q_y(0))
}

type NodeType

type NodeType string
const (
	AndNode  NodeType = "AndNode"
	OrNode   NodeType = "OrNode"
	LeafNode NodeType = "LeafNode"
)

type PublicKey

type PublicKey struct {
	Params   *pbc.Params
	Pairing  *pbc.Pairing
	G        *pbc.Element
	H        *pbc.Element
	F        *pbc.Element
	EggAlpha *pbc.Element
}

Structure to represent the public key

func ImportPublicKey

func ImportPublicKey(path string) PublicKey

type PublicKeyExport

type PublicKeyExport struct {
	Params   string
	G        []byte
	H        []byte
	F        []byte
	EggAlpha []byte
}

type UserPrivateKey

type UserPrivateKey struct {
	Attributes []string
	D          *pbc.Element
	Dj         map[string][]*pbc.Element
}

Structure to represent the user's private key

func ImportUserPrivateKey

func ImportUserPrivateKey(path string, pairing *pbc.Pairing) UserPrivateKey

func KeyGen

func KeyGen(pk PublicKey, msk MasterSecretKey, attributes []string) UserPrivateKey

Generate a private key for a user with the specified attributes

type UserPrivateKeyExport

type UserPrivateKeyExport struct {
	Attributes []string
	D          []byte
	Dj         map[string][][]byte
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL