Sign with BLS12-381 using G2 signatures. This matches the Go implementation using kyber's bdn.Scheme. Uses BasicSchemeMPL which uses DST: BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_
(private_key_hex: str, message: bytes)
| 149 | |
| 150 | |
| 151 | def sign_bls(private_key_hex: str, message: bytes) -> bytes: |
| 152 | """ |
| 153 | Sign with BLS12-381 using G2 signatures. |
| 154 | This matches the Go implementation using kyber's bdn.Scheme. |
| 155 | Uses BasicSchemeMPL which uses DST: BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_ |
| 156 | """ |
| 157 | private_key_bytes = hex_to_bytes(private_key_hex) |
| 158 | |
| 159 | # Create private key from bytes |
| 160 | sk = PrivateKey.from_bytes(private_key_bytes) |
| 161 | |
| 162 | # Sign using BasicSchemeMPL (standard BLS without public key augmentation) |
| 163 | signature = BasicSchemeMPL.sign(sk, message) |
| 164 | |
| 165 | return bytes(signature) |
| 166 | |
| 167 | |
| 168 | def get_sign_bytes( |
no test coverage detected