gosh_bls.rs

Overview

This file implements a BLS (Boneh–Lynn–Shacham) signature scheme abstraction named GoshBLS using the gosh_blst cryptographic library. It provides core functionalities for signing, verifying, and aggregating BLS signatures within the system. The file defines wrapper types for public keys, secret keys, and signatures, enhancing serialization, deserialization, and debugging capabilities.

The BLS signature scheme implemented here follows the minimal-pubkey-size variant (min_pk) from gosh_blst, using the BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_ domain separation tag (DST). This DST ensures signature domain separation for security and interoperability.

Entities and Their Functionalities

Struct: GoshBLS

A zero-sized struct serving as the main entry point implementing the BLSSignatureScheme trait.

Struct: Signature

A wrapper around gosh_blst::min_pk::Signature, enabling serialization, deserialization, hashing, equality, and debug output.

Struct: PubKey

A wrapper around gosh_blst::min_pk::PublicKey, supporting serialization, deserialization, hashing, equality, and debug output with abbreviated formatting.

Struct: Secret

A wrapper around gosh_blst::min_pk::SecretKey, supporting serialization, deserialization, and debug output.

Trait Implementation: BLSSignatureScheme for GoshBLS

Implements the core BLS signature scheme interface:

Important Implementation Details and Algorithms

Interactions With Other Components

Visual Diagram: Structure and Relationships of Main Types and Methods

classDiagram
class GoshBLS {
+merge_all(signatures)
}
class Signature {
+empty()
}
class PubKey {
+from_bytes()
+from_str()
}
class Secret {
+take_as_seed()
}
class BLSSignatureScheme {
+sign(secret, data)
+verify(signature, pubkeys, data)
+merge(one, another)
}
GoshBLS ..|> BLSSignatureScheme
GoshBLS o-- Signature
GoshBLS o-- PubKey
GoshBLS o-- Secret

This diagram illustrates the primary types (GoshBLS, Signature, PubKey, Secret) and their relationship to the BLSSignatureScheme trait, showing how GoshBLS implements the trait and composes the key and signature types.