mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-26 00:25:17 +00:00
fix: openssl-specific verification of digest
This commit is contained in:
parent
048b6459c3
commit
22e9398dd6
@ -102,6 +102,7 @@ type Signature struct {
|
|||||||
PublicKeyHex string `json:"publicKeyHex"`
|
PublicKeyHex string `json:"publicKeyHex"`
|
||||||
SignatureHex string `json:"signatureHex"`
|
SignatureHex string `json:"signatureHex"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SignedGenesisUnlock struct {
|
type SignedGenesisUnlock struct {
|
||||||
GenesisSeedHex string `json:"genesisSeedHex"`
|
GenesisSeedHex string `json:"genesisSeedHex"`
|
||||||
Signatures []Signature `json:"signatures"`
|
Signatures []Signature `json:"signatures"`
|
||||||
@ -167,7 +168,7 @@ func DownloadAndVerifyGenesis() (*SignedGenesisUnlock, error) {
|
|||||||
checksig := ""
|
checksig := ""
|
||||||
for _, sig := range checkUnlock.Signatures {
|
for _, sig := range checkUnlock.Signatures {
|
||||||
if sig.PublicKeyHex == Signatories[i-1] {
|
if sig.PublicKeyHex == Signatories[i-1] {
|
||||||
checksig = sig.PublicKeyHex
|
checksig = sig.SignatureHex
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,12 +177,13 @@ func DownloadAndVerifyGenesis() (*SignedGenesisUnlock, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
sig, err := hex.DecodeString(Signatories[i-1])
|
sig, err := hex.DecodeString(checksig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ed448.Verify(pubkey, digest[:], sig, "") {
|
opensslMsg := "SHA3-256(genesis)= " + hex.EncodeToString(digest[:])
|
||||||
|
if !ed448.Verify(pubkey, append([]byte(opensslMsg), 0x0a), sig, "") {
|
||||||
fmt.Printf("Failed signature check for signatory #%d\n", i)
|
fmt.Printf("Failed signature check for signatory #%d\n", i)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -36,5 +36,5 @@ func FormatVersion(version []byte) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetPatchNumber() byte {
|
func GetPatchNumber() byte {
|
||||||
return 0x03
|
return 0x04
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user