forked from TrueCloudLab/frostfs-api-go
service: implement a function for creating and storing a signature
This commit is contained in:
parent
0ffb1bd61d
commit
f3e6caf7e7
3 changed files with 59 additions and 0 deletions
|
@ -56,3 +56,17 @@ func DataSignature(src SignedDataSource, key *ecdsa.PrivateKey) ([]byte, error)
|
|||
|
||||
return crypto.Sign(key, data)
|
||||
}
|
||||
|
||||
// AddSignatureWithKey calculates the data signature and adds it to accumulator with public key.
|
||||
//
|
||||
// Returns signing errors only.
|
||||
func AddSignatureWithKey(v SignatureKeyAccumulator, key *ecdsa.PrivateKey) error {
|
||||
sign, err := DataSignature(v, key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
v.AddSignKey(sign, &key.PublicKey)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue