hibe

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(key *PrivateKey, ciphertext *Ciphertext) *bn256.GT

Decrypt recovers the original message from the provided ciphertext, using the provided private key.

func DecryptHibeMsg

func DecryptHibeMsg(localId string, hibeParams *Params, prvKey *PrivateKey,
	hibeMsgMap map[string]string, symKeyType crypto.KeyType) ([]byte, error)

DecryptHibeMsg is used to decrypt the HIBE message constructed by EncryptHibeMsg localId: hibe Id hibeParams: HIBE parameters of the HIBE system to which ID belongs prvKey: the localId's hibe private Key hibeMsgMap: HIBE message encrypt by EncryptHibeMsg symKeyType: symmetric key type (aes or sm4), used to symmetric encrypt the plain text first

func EncryptHibeMsg

func EncryptHibeMsg(plaintext []byte, receiverIds []string, paramsList []*Params,
	symKeyType crypto.KeyType) (map[string]string, error)

EncryptHibeMsg is used to encrypt plainText by receiverIds and their paramsList plaintext: plain text bytes receiverIds: message receivers' id list, using "/" to separate hierarchy identity in each id string paramsList: HIBE parameters list of the message receiver, len(paramsList) should be equal to len(receiverIds),

paramsList[i] are the HIBE parameters of receiverIds[i]

symKeyType: symmetric key type (aes or sm4), used to symmetric encrypt the plain text first

func IdStr2HibeId

func IdStr2HibeId(id string) ([]string, []*big.Int)

IdStr2HibeId construct HibeId according to id

func Setup

func Setup(random io.Reader, l int) (*Params, MasterKey, error)

Setup generates the system parameters, (hich may be made visible to an adversary. The parameter "l" is the maximum depth that the hierarchy will support.

func ValidateId

func ValidateId(id string) error

ValidateId is used to validate id format

Types

type Ciphertext

type Ciphertext = hibe.Ciphertext

Ciphertext represents an encrypted message.

func Encrypt

func Encrypt(random io.Reader, params *Params, id []*big.Int, message *bn256.GT) (*Ciphertext, error)

Encrypt converts the provided message to ciphertext, using the provided ID as the public key.

type G1

type G1 = bn256.G1

G1 is an abstract cyclic group. The zero value is suitable for use as the output of an operation, but cannot be used as an input.

type MasterKey

type MasterKey = hibe.MasterKey

MasterKey represents the key for a hierarchy that can create a key for any element.

type Params

type Params = hibe.Params

Params represents the system parameters for a hierarchy.

type PrivateKey

type PrivateKey = hibe.PrivateKey

PrivateKey represents a key for an ID in a hierarchy that can decrypt messages encrypted with that ID and issue keys for children of that ID in the hierarchy.

func KeyGenFromMaster

func KeyGenFromMaster(random io.Reader, params *Params, master MasterKey, id []*big.Int) (*PrivateKey, error)

KeyGenFromMaster generates a key for an ID using the master key.

func KeyGenFromParent

func KeyGenFromParent(random io.Reader, params *Params, parent *PrivateKey, id []*big.Int) (*PrivateKey, error)

KeyGenFromParent generates a key for an ID using the private key of the parent of ID in the hierarchy. Using a different parent will result in undefined behavior.

Directories

Path Synopsis
hibe
Package hibe implements the cryptosystem described in the paper "Hierarchical Identity Based Encyprtion with Constant Size Ciphertext" by Boneh, Boyen, and Goh.
Package hibe implements the cryptosystem described in the paper "Hierarchical Identity Based Encyprtion with Constant Size Ciphertext" by Boneh, Boyen, and Goh.
hibe/bn256
Package bn256 implements a particular bilinear group at the 128-bit security level.
Package bn256 implements a particular bilinear group at the 128-bit security level.
hibe
Package hibe implements the cryptosystem described in the paper "Hierarchical Identity Based Encyprtion with Constant Size Ciphertext" by Boneh, Boyen, and Goh.
Package hibe implements the cryptosystem described in the paper "Hierarchical Identity Based Encyprtion with Constant Size Ciphertext" by Boneh, Boyen, and Goh.
hibe/bn256
Package bn256 implements a particular bilinear group.
Package bn256 implements a particular bilinear group.

Jump to

Keyboard shortcuts

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