Documentation ¶
Overview ¶
Package cryptutils implements functionality that may be useful to users of the other packages in this library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Encryptable ¶
Encryptable represents a message that can be encrypted with WKD-IBE. The intended usage is to choose a random message, encrypt that message, and then hash the message to obtain a symmetric key.
func GenerateKey ¶
func GenerateKey(sk []byte) ([]byte, *Encryptable)
GenerateKey generates a random key, and an Encryptable that hashes to that key. The key is written to the provided slice, and that same slice is returned. Note that, while the slice can be of any length, there are only 32 bytes of entropy in the Encryptable
func (*Encryptable) Bytes ¶
func (m *Encryptable) Bytes() []byte
Bytes returns a slice of bytes representing the value of the message. It is a copy of the underlying C memory, so it can be safely mutated. It can be passed to a hash function to hash the message to a symmetric key.
func (*Encryptable) HashToSymmetricKey ¶
func (m *Encryptable) HashToSymmetricKey(sk []byte) []byte
HashToSymmetricKey hashes the encryptable to get a symmetric key. The symmetric key fills the provided slice (which can be of any length, but remember that there are only 32 bytes of entropy in the underlying group element). Returns sthe provided slice.
func (*Encryptable) Marshal ¶
func (m *Encryptable) Marshal() []byte
Marshal does the same thing as Bytes.
func (*Encryptable) Random ¶
func (m *Encryptable) Random() *Encryptable
Random sets the message to a random valid message and returns a pointer to the message on which it was invoked.
func (*Encryptable) Set ¶
func (m *Encryptable) Set(data []byte) bool
Set sets the value of an encryptable to the provided byte slice.
func (*Encryptable) Unmarshal ¶
func (m *Encryptable) Unmarshal(marshalled []byte) bool
Unmarshal does the same thing as Set.
type Signable ¶
type Signable struct {
Data C.embedded_pairing_core_bigint_256_t
}
Signable represents a message that is signable with WKD-IBE. The intended usage is to hash the message to sign to a Signable, and then pass the Signable to the Sign function.