Documentation ¶
Overview ¶
Package wkdibe provides a Go interface to an implementation of WKD-IBE. See https://eprint.iacr.org/2007/221.pdf for more information about WKD-IBE. The implementation uses the construction of WKD-IBE based on BBG HIBE.
Index ¶
- func AdjustNonDelegable(sk *SecretKey, parent *SecretKey, from AttributeList, to AttributeList)
- func AdjustPreparedAttributeList(prepared *PreparedAttributeList, params *Params, from AttributeList, ...)
- func CiphertextMarshalledLength(compressed bool) int
- func Decrypt(ciphertext *Ciphertext, sk *SecretKey) *cryptutils.Encryptable
- func DecryptWithMaster(ciphertext *Ciphertext, msk *MasterKey) *cryptutils.Encryptable
- func Setup(l int, supportSignatures bool) (*Params, *MasterKey)
- func SignatureMarshalledLength(compressed bool) int
- func Verify(params *Params, attrs AttributeList, signature *Signature, ...) bool
- func VerifyPrepared(params *Params, prepared *PreparedAttributeList, signature *Signature, ...) bool
- type AttributeIndex
- type AttributeList
- type Ciphertext
- type MasterKey
- type Params
- type PreparedAttributeList
- type SecretKey
- func KeyGen(params *Params, msk *MasterKey, attrs AttributeList) *SecretKey
- func NonDelegableKeyGen(params *Params, msk *MasterKey, attrs AttributeList) *SecretKey
- func NonDelegableQualifyKey(params *Params, qualify *SecretKey, attrs AttributeList) *SecretKey
- func QualifyKey(params *Params, qualify *SecretKey, attrs AttributeList) *SecretKey
- func ResampleKey(params *Params, precomputed *PreparedAttributeList, key *SecretKey, ...) *SecretKey
- type Signature
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdjustNonDelegable ¶
func AdjustNonDelegable(sk *SecretKey, parent *SecretKey, from AttributeList, to AttributeList)
AdjustNonDelegable takes in a non-delegable key and the parent from which it was generated, and cheaply converts it into a non-delegable key for a different attribute set that could also be generated from the parent.
func AdjustPreparedAttributeList ¶
func AdjustPreparedAttributeList(prepared *PreparedAttributeList, params *Params, from AttributeList, to AttributeList)
AdjustPreparedAttributeList takes as input a prepared attribute list, and modifies it to correspond to a different attribute list.
func CiphertextMarshalledLength ¶
CiphertextMarshalledLength returns the length, in bytes, of a marshalled ciphertext.
func Decrypt ¶
func Decrypt(ciphertext *Ciphertext, sk *SecretKey) *cryptutils.Encryptable
Decrypt recovers the original message from the provided ciphertext, using the provided secret key.
func DecryptWithMaster ¶
func DecryptWithMaster(ciphertext *Ciphertext, msk *MasterKey) *cryptutils.Encryptable
DecryptWithMaster is the same as Decrypt, but requires the master key to be provided. It is substantially more efficient than generating a private key and then calling Decrypt.
func Setup ¶
Setup generates the system parameters, which may be made visible to an adversary. The parameter "l" is the total number of attributes supported (indexed from 0 to l - 1).
func SignatureMarshalledLength ¶
SignatureMarshalledLength returns the length, in bytes, of a marshalled signature.
func Verify ¶
func Verify(params *Params, attrs AttributeList, signature *Signature, message *cryptutils.Signable) bool
Verify verifies that the provided signature was produced using a secret key corresponding to the provided attribute set.
func VerifyPrepared ¶
func VerifyPrepared(params *Params, prepared *PreparedAttributeList, signature *Signature, message *cryptutils.Signable) bool
VerifyPrepared verifies the provided signature, using the provided prepared attribute list to speed up the process.
Types ¶
type AttributeIndex ¶
type AttributeIndex int
AttributeIndex represents an attribute --- specifically, its index in the array of attributes.
type AttributeList ¶
type AttributeList map[AttributeIndex]*big.Int
AttributeList represents a list of attributes. It is map from each set attribute (by its index) to the value of that attribute.
type Ciphertext ¶
type Ciphertext struct {
Data C.embedded_pairing_wkdibe_ciphertext_t
}
Ciphertext represents a WKD-IBE ciphertext.
func Encrypt ¶
func Encrypt(message *cryptutils.Encryptable, params *Params, attrs AttributeList) *Ciphertext
Encrypt converts the provided message to ciphertext, using the provided Attribute List and public parameters.
func EncryptPrepared ¶
func EncryptPrepared(message *cryptutils.Encryptable, params *Params, prepared *PreparedAttributeList) *Ciphertext
EncryptPrepared encrypts the provided message, using the provided prepared attribute list to speed up the process.
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 on 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_wkdibe_masterkey_t
}
MasterKey represents a WKD-IBE master key.
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 on 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_wkdibe_params_t
}
Params represents public parameters for a WKD-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) NumAttributes ¶
NumAttributes returns the number of attributes supported. This was specified via the "l" argument when Setup was called.
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 PreparedAttributeList ¶
type PreparedAttributeList struct {
Data C.embedded_pairing_wkdibe_precomputed_t
}
PreparedAttributeList represents precomputation for a specific attribute list to accelerate e.g., repeated encryption for that attribute list with the same public parameters.
func PrepareAttributeList ¶
func PrepareAttributeList(params *Params, attrs AttributeList) *PreparedAttributeList
PrepareAttributeList performs precomputation for the provided attribute list, to speed up future encryption or verification with that attribute list. The returned precomputed result can be safely reused multiple times. This can be useful if you are repeatedly encrypting messages or verifying signatures with the same attribute list and want to speed things up.
type SecretKey ¶
type SecretKey struct {
Data C.embedded_pairing_wkdibe_secretkey_t
}
SecretKey represents a WKD-IBE secret key.
func KeyGen ¶
func KeyGen(params *Params, msk *MasterKey, attrs AttributeList) *SecretKey
KeyGen generates a key for an attribute list using the master key. The attrs argument is a mapping from attribute to its value; attributes not in the map are not set.
If a slot is mapped to nil in the attribute set, that slot is free in the new private key, but cannot be filled in.
func NonDelegableKeyGen ¶
func NonDelegableKeyGen(params *Params, msk *MasterKey, attrs AttributeList) *SecretKey
NonDelegableKeyGen is like KeyGen, except that the resulting key should only be used for decryption or signing. This is significantly faster than the regular KeyGen. However, the output should _not_ be delegated to another entity, as it is not properly re-randomized and could leak the master key.
If a slot is mapped to nil in the attribute set, that slot is free in the new private key, but cannot be filled in.
func NonDelegableQualifyKey ¶
func NonDelegableQualifyKey(params *Params, qualify *SecretKey, attrs AttributeList) *SecretKey
NonDelegableQualifyKey is like QualifyKey, except that the resulting key should only be used for decryption or signing. This is significantly faster than the QualifyKey function. However, the output should _not_ be delegated to another entity, as it is not properly re-randomized and could leak information about the parent key.
If a slot is mapped to nil in the attribute set, that slot is free in the new private key, but cannot be filled in.
func QualifyKey ¶
func QualifyKey(params *Params, qualify *SecretKey, attrs AttributeList) *SecretKey
QualifyKey uses a key to generate a new key with restricted permissions, by adding the the specified attributes. Remember that adding new attributes restricts the permissions. Furthermore, attributes are immutable once set, so the attrs map must contain mappings for attributes that are already set. The attrs argument is a mapping from attribute to its value; attributes not in the map are not set.
If a slot is mapped to nil in the attribute set, that slot is free in the new private key, but cannot be filled in.
func ResampleKey ¶
func ResampleKey(params *Params, precomputed *PreparedAttributeList, key *SecretKey, supportFurtherQualification bool) *SecretKey
ResampleKey uses the provided private key to sample a new private key with the same capability, using the provided randomness t. If delegable is true, then the new private key can be qualified via QualifyKey or NonDelegableKey, but this function takes longer to execute. If delegable is false, the resulting private key cannot be used with QualifyKey or NonDelegableKey, but resampling is faster.
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 on 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 Signature ¶
type Signature struct {
Data C.embedded_pairing_wkdibe_signature_t
}
Signature represents a WKD-IBE signature.
func Sign ¶
func Sign(params *Params, sk *SecretKey, attrs AttributeList, message *cryptutils.Signable) *Signature
Sign produces a signature for the provided message hash, using the provided secret key. The signature may be produced on a more specialized attribute list than the key; alternatively, ATTRS may be left a nil if this is not needed.
func SignPrepared ¶
func SignPrepared(params *Params, sk *SecretKey, attrs AttributeList, prepared *PreparedAttributeList, message *cryptutils.Signable) *Signature
SignPrepared produces a signature for the provided message hash, using the provided prepared attribute list to speed up the process. The signature may be produced on a more specialized attribute list than the key; alternatively, ATTRS may be left a nil if this is not needed.
func (*Signature) Marshal ¶
Marshal encodes a Signature object into a byte slice in either compressed or uncompressed form, depending on the argument.
func (*Signature) Unmarshal ¶
Unmarshal recovers a Signature object from a byte slice, which must encode either its compressed on 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.