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 ¶
- func CiphertextMarshalledSize(compressed bool) int
- func Decrypt(ciphertext *Ciphertext, sk *SecretKey, id *ID, symmetric []byte) []byte
- func IDMarshalledSize(compressed bool) int
- func MasterKeyMarshalledSize(compressed bool) int
- func ParamsMarshalledSize(compressed bool) int
- func SecretKeyMarshalledSize(compressed bool) int
- func Setup() (*Params, *MasterKey)
- type Ciphertext
- type ID
- type MasterKey
- type Params
- type SecretKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CiphertextMarshalledSize ¶
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 ¶
IDMarshalledSize returns the size of a marshalled ID object, in bytes.
func MasterKeyMarshalledSize ¶
MasterKeyMarshalledSize returns the size of a marshalled MasterKey object, in bytes.
func ParamsMarshalledSize ¶
ParamsMarshalledSize returns the size of a marshalled Params object in bytes.
func SecretKeyMarshalledSize ¶
SecretKeyMarshalledSize returns the size of a marshalled SecretKey object, in bytes.
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) Marshal ¶
Marshal encodes an ID object into a byte slice in either compressed or uncompressed form, depending on the argument.
func (*ID) Unmarshal ¶
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 ¶
Marshal encodes a MasterKey object into a byte slice in either compressed or uncompressed form, depending on the argument.
func (*MasterKey) Unmarshal ¶
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 ¶
Marshal encodes a Params object into a byte slice in either compressed or uncompressed form, depending on the argument.
func (*Params) Unmarshal ¶
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 ¶
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 ¶
Marshal encodes a SecretKey object into a byte slice in either compressed or uncompressed form, depending on the argument.
func (*SecretKey) Unmarshal ¶
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.