Fix broken error message on invalid MAC.

Fixes #13.
This commit is contained in:
Kamil Kisiel 2015-02-02 22:33:18 -08:00
parent f0559d009e
commit 5f171f4232

View file

@ -196,7 +196,7 @@ func (s *SecureCookie) Decode(name, value string, dst interface{}) error {
// 3. Verify MAC. Value is "date|value|mac".
parts := bytes.SplitN(b, []byte("|"), 3)
if len(parts) != 3 {
return errors.New("securecookie: invalid value %v")
return ErrMacInvalid
}
h := hmac.New(s.hashFunc, s.hashKey)
b = append([]byte(name+"|"), b[:len(b)-len(parts[2])-1]...)