Check timestamps for files

This commit is contained in:
Alexander Neumann
2014-11-30 22:34:21 +01:00
parent 4246e7602f
commit 3325fa07ea
8 changed files with 229 additions and 17 deletions

View File

@@ -8,6 +8,8 @@ import (
"github.com/fd0/khepri/backend"
)
var ErrWrongData = errors.New("wrong data decrypt, checksum does not match")
type ContentHandler struct {
be backend.Server
key *Key
@@ -173,6 +175,11 @@ func (ch *ContentHandler) Load(t backend.Type, id backend.ID) ([]byte, error) {
return nil, errors.New("Invalid length")
}
// check SHA256 sum
if !id.Equal(backend.Hash(buf)) {
return nil, ErrWrongData
}
return buf, nil
}