Documentation ¶
Index ¶
- func AggregateVerify(signature Signature, hashes [][sha256.Size]byte, keys []PublicKey) (bool, error)
- func GenKeyShares(t int, n int, system System) (PublicKey, []PublicKey, PrivateKey, []PrivateKey, error)
- func GenKeys(system System) (PublicKey, PrivateKey, error)
- func Verify(signature Signature, hash [sha256.Size]byte, key PublicKey) bool
- type Element
- type Pairing
- type Params
- type PrivateKey
- type PublicKey
- type Signature
- type System
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AggregateVerify ¶
func AggregateVerify(signature Signature, hashes [][sha256.Size]byte, keys []PublicKey) (bool, error)
Verify an aggregate signature on the message digests using the public keys of the signers.
func GenKeyShares ¶
func GenKeyShares(t int, n int, system System) (PublicKey, []PublicKey, PrivateKey, []PrivateKey, error)
Generate a key pair from the given cryptosystem and divide each key into n shares such that t shares can combine signatures to recover a threshold signature. This function allocates C structures on the C heap using malloc. It is the responsibility of the caller to prevent memory leaks by arranging for the C structures to be freed.
Types ¶
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
func PKElementFormString ¶
func SKElementFormString ¶
func (Element) Free ¶
func (element Element) Free()
Free the memory occupied by the element. The element cannot be used after calling this function.
func (Element) GetPKElementString ¶
func (Element) GetSKElementString ¶
type Pairing ¶
type Pairing struct {
// contains filtered or unexported fields
}
func GenPairing ¶
Generate a pairing from the given parameters. This function allocates C structures on the C heap using malloc. It is the responsibility of the caller to prevent memory leaks by arranging for the C structures to be freed.
type Params ¶
type Params struct {
// contains filtered or unexported fields
}
func GenParamsTypeA ¶
Generate type A pairing parameters. This function allocates C structures on the C heap using malloc. It is the responsibility of the caller to prevent memory leaks by arranging for the C structures to be freed. More information about type A pairing parameters can be found in the PBC library manual: https://crypto.stanford.edu/pbc/manual/ch08s03.html.
func GenParamsTypeD ¶
Generate type D pairing parameters. This function allocates C structures on the C heap using malloc. It is the responsibility of the caller to prevent memory leaks by arranging for the C structures to be freed. More information about type D pairing parameters can be found in the PBC library manual: https://crypto.stanford.edu/pbc/manual/ch08s06.html.
func GenParamsTypeF ¶
Generate type F pairing parameters. This function allocates C structures on the C heap using malloc. It is the responsibility of the caller to prevent memory leaks by arranging for the C structures to be freed. More information about type F pairing parameters can be found in the PBC library manual: https://crypto.stanford.edu/pbc/manual/ch08s08.html.
func ParamsFromBytes ¶
ParamsFromBytes imports Params from the provided byte slice. It expects the data format exported by ToBytes. An example of Type A params of this form can be found in param/a.param
This function allocates C structures on the C heap using malloc. It is the responsibility of the caller to prevent memory leaks by arranging for the C structures to be freed.
func ParamsFromString ¶
func (Params) Free ¶
func (params Params) Free()
Free the memory occupied by the pairing parameters. The parameters cannot be used after calling this function.
func (Params) GetParamsString ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func SKFromString ¶
func SKFromString(SKString string, pairing Pairing) PrivateKey
func (PrivateKey) Free ¶
func (secret PrivateKey) Free()
Free the memory occupied by the private key. The private key cannot be used after calling this function.
func (PrivateKey) GetSKString ¶
func (sk PrivateKey) GetSKString() string
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func PKFromString ¶
func (PublicKey) Free ¶
func (key PublicKey) Free()
Free the memory occupied by the public key. The public key cannot be used after calling this function.
func (PublicKey) GetPKString ¶
type Signature ¶
type Signature = Element
func Aggregate ¶
Aggregate signatures using the cryptosystem. This function allocates C structures on the C heap using malloc. It is the responsibility of the caller to prevent memory leaks by arranging for the C structures to be freed.
func Sign ¶
func Sign(hash [sha256.Size]byte, secret PrivateKey) Signature
Sign a message digest using a private key. This function allocates C structures on the C heap using malloc. It is the responsibility of the caller to prevent memory leaks by arranging for the C structures to be freed.
func SignatureFromString ¶
func Threshold ¶
Recover a threshold signature from the signature shares provided by the group members using the cryptosystem. This function allocates C structures on the C heap using malloc. It is the responsibility of the caller to prevent memory leaks by arranging for the C structures to be freed.
func (Signature) GetSignatureString ¶
type System ¶
type System struct {
// contains filtered or unexported fields
}
func GenSystem ¶
Generate a cryptosystem from the given pairing. This function allocates C structures on the C heap using malloc. It is the responsibility of the caller to prevent memory leaks by arranging for the C structures to be freed.
func SystemFromBytes ¶
SystemFromBytes imports a System from the provided byte slice.
This function allocates C structures on the C heap using malloc. It is the responsibility of the caller to prevent memory leaks by arranging for the C structures to be freed.
func SystemFromString ¶
func (System) Free ¶
func (system System) Free()
Free the memory occupied by the cryptosystem. The cryptosystem cannot be used after calling this function.
func (System) GetSystemString ¶
func (System) SigFromBytes ¶
Convert a byte slice to a signature.
func (System) SigToBytes ¶
Convert a signature to a byte slice.