object: implement SignedData() and AddSignKey() methods on IntegrityHeader
This commit is contained in:
parent
ab796b81d2
commit
96a6bb4842
4 changed files with 64 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
package object
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"encoding/binary"
|
||||
"io"
|
||||
|
||||
|
@ -259,3 +260,13 @@ func addressSize(addr Address) int {
|
|||
func addressBytes(addr Address) []byte {
|
||||
return append(addr.CID.Bytes(), addr.ObjectID.Bytes()...)
|
||||
}
|
||||
|
||||
// SignedData returns the result of the ChecksumSignature field getter.
|
||||
func (m IntegrityHeader) SignedData() ([]byte, error) {
|
||||
return m.GetHeadersChecksum(), nil
|
||||
}
|
||||
|
||||
// AddSignKey calls the ChecksumSignature field setter with signature argument.
|
||||
func (m *IntegrityHeader) AddSignKey(sign []byte, _ *ecdsa.PublicKey) {
|
||||
m.SetSignature(sign)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue