lqibe

package
v0.0.0-...-c4bf151 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package lqibe provides a Go interface to an implementation of Identity-Based Encryption (IBE). The construction used is due to Libert and Quisquater; see http://cseweb.ucsd.edu/~mihir/cse208-06/libert-quisquater-ibe-acns-05.pdf for information about LQ-IBE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CiphertextMarshalledSize

func CiphertextMarshalledSize(compressed bool) int

CiphertextMarshalledSize returns the size of a marshalled Ciphertext object, in bytes.

func Decrypt

func Decrypt(ciphertext *Ciphertext, sk *SecretKey, id *ID, symmetric []byte) []byte

Decrypt fills the specified buffer with the symmetric key encoded in the provided ciphertext. It returns the same buffer passed in as an argument.

func IDMarshalledSize

func IDMarshalledSize(compressed bool) int

IDMarshalledSize returns the size of a marshalled ID object, in bytes.

func MasterKeyMarshalledSize

func MasterKeyMarshalledSize(compressed bool) int

MasterKeyMarshalledSize returns the size of a marshalled MasterKey object, in bytes.

func ParamsMarshalledSize

func ParamsMarshalledSize(compressed bool) int

ParamsMarshalledSize returns the size of a marshalled Params object in bytes.

func SecretKeyMarshalledSize

func SecretKeyMarshalledSize(compressed bool) int

SecretKeyMarshalledSize returns the size of a marshalled SecretKey object, in bytes.

func Setup

func Setup() (*Params, *MasterKey)

Setup generates a new LQ IBE system. It returns the new system's public parameters and master secret key.

Types

type Ciphertext

type Ciphertext struct {
	Data C.embedded_pairing_lqibe_ciphertext_t
}

Ciphertext represents a ciphertext in an LQ IBE system.

func Encrypt

func Encrypt(symmetric []byte, params *Params, id *ID) *Ciphertext

Encrypt fills the specified buffer with a symmetric key and returns a ciphertext encoding the encrypted symmetric key. The symmetric key buffer can be of any length, but the underlying entropy is only 256 bits.

func (*Ciphertext) Marshal

func (c *Ciphertext) Marshal(compressed bool) []byte

Marshal encodes a Ciphertext object into a byte slice in either compressed or uncompressed form, depending on the argument.

func (*Ciphertext) Unmarshal

func (c *Ciphertext) Unmarshal(marshalled []byte, compressed bool, checked bool) bool

Unmarshal recovers a Ciphertext object from a byte slice, which must encode either its compressed or uncompressed form, depending on the argument. If CHECKED is set to false, then unmarshalling is faster (some checks on the result are skipped), but the function will not detect if the group elements are not valid.

type ID

type ID struct {
	Data C.embedded_pairing_lqibe_id_t
}

ID represents a prepared ID in an LQ IBE system.

func (*ID) Hash

func (id *ID) Hash(data []byte) *ID

Hash hashes a byte slice to an ID.

func (*ID) Marshal

func (id *ID) Marshal(compressed bool) []byte

Marshal encodes an ID object into a byte slice in either compressed or uncompressed form, depending on the argument.

func (*ID) Unmarshal

func (id *ID) Unmarshal(marshalled []byte, compressed bool, checked bool) bool

Unmarshal recovers an ID object from a byte slice, which must encode either its compressed or uncompressed form, depending on the argument. If CHECKED is set to false, then unmarshalling is faster (some checks on the result are skipped), but the function will not detect if the group elements are not valid.

type MasterKey

type MasterKey struct {
	Data C.embedded_pairing_lqibe_masterkey_t
}

MasterKey represents the master secret key in an LQ IBE system.

func (*MasterKey) Marshal

func (msk *MasterKey) Marshal(compressed bool) []byte

Marshal encodes a MasterKey object into a byte slice in either compressed or uncompressed form, depending on the argument.

func (*MasterKey) Unmarshal

func (msk *MasterKey) Unmarshal(marshalled []byte, compressed bool, checked bool) bool

Unmarshal recovers a MasterKey object from a byte slice, which must encode either its compressed or uncompressed form, depending on the argument. If CHECKED is set to false, then unmarshalling is faster (some checks on the result are skipped), but the function will not detect if the group elements are not valid.

type Params

type Params struct {
	Data C.embedded_pairing_lqibe_params_t
}

Params represents public parameters for an LQ IBE system.

func (*Params) Marshal

func (p *Params) Marshal(compressed bool) []byte

Marshal encodes a Params object into a byte slice in either compressed or uncompressed form, depending on the argument.

func (*Params) Unmarshal

func (p *Params) Unmarshal(marshalled []byte, compressed bool, checked bool) bool

Unmarshal recovers a Params object from a byte slice, which must encode either its compressed or uncompressed form, depending on the argument. If CHECKED is set to false, then unmarshalling is faster (some checks on the result are skipped), but the function will not detect if the group elements are not valid.

type SecretKey

type SecretKey struct {
	Data C.embedded_pairing_lqibe_secretkey_t
}

SecretKey represents a secret key in an LQ IBE system.

func KeyGen

func KeyGen(params *Params, msk *MasterKey, id *ID) *SecretKey

KeyGen generates a secretkey for an ID in the LQ IBE system corresponding to the provided public parameters and master secret key.

func (*SecretKey) Marshal

func (sk *SecretKey) Marshal(compressed bool) []byte

Marshal encodes a SecretKey object into a byte slice in either compressed or uncompressed form, depending on the argument.

func (*SecretKey) Unmarshal

func (sk *SecretKey) Unmarshal(marshalled []byte, compressed bool, checked bool) bool

Unmarshal recovers a SecretKey object from a byte slice, which must encode either its compressed or uncompressed form, depending on the argument. If CHECKED is set to false, then unmarshalling is faster (some checks on the result are skipped), but the function will not detect if the group elements are not valid.

Jump to

Keyboard shortcuts

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