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 Hex32
- type Pairing
- type Params
- type PrivateKey
- type PublicKey
- type Signature
- type System
- func (system System) Free()
- func (system System) PrivKeyFromBytes(bytes []byte) (PrivateKey, error)
- func (system System) PrivKeyToBytes(privKey PrivateKey) []byte
- func (system System) PrivSigFromBytes(bytes []byte) (Signature, error)
- func (system System) PrivSigToBytes(signature Signature) []byte
- func (system System) PubKeyFromBytes(bytes []byte) (PublicKey, error)
- func (system System) PubKeyToBytes(pubKey PublicKey) []byte
- func (system System) SigFromBytes(bytes []byte) (Signature, error)
- func (system System) SigToBytes(signature Signature) []byte
- func (system System) ToBytes() []byte
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
}
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.
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
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) ToString ¶
func (secret PrivateKey) ToString() string
Below function receives PrivateKey object and formats it according to the %x format specifier and returns the resulting string.
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
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 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.
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 (System) Free ¶
func (system System) Free()
Free the memory occupied by the cryptosystem. The cryptosystem cannot be used after calling this function.
func (System) PrivKeyFromBytes ¶
func (system System) PrivKeyFromBytes(bytes []byte) (PrivateKey, error)
Convert a byte slice to a PivateKey.
func (System) PrivKeyToBytes ¶
func (system System) PrivKeyToBytes(privKey PrivateKey) []byte
Convert a PrivateKey to a byte slice
func (System) PrivSigFromBytes ¶
Convert a byte slice to a signature.
func (System) PrivSigToBytes ¶
Convert a signature to a byte slice.
func (System) PubKeyFromBytes ¶
Convert a byte slice to a PublicKey.
func (System) PubKeyToBytes ¶
Convert a PublicKey to a byte slice.
func (System) SigFromBytes ¶
Convert a byte slice to a signature.
func (System) SigToBytes ¶
Convert a signature to a byte slice.