forked from mutecomm/mute
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
60 lines (42 loc) · 2.53 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) 2015 Mute Communications Ltd.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package msg
import (
"errors"
)
// ErrNotPreHeader is raised when a message doesn't start with a pre-header.
var ErrNotPreHeader = errors.New("msg: message doesn't start with pre-header")
// ErrNoPreHeaderKey is raised when the key to decrypt the pre-header could
// not be found.
var ErrNoPreHeaderKey = errors.New("msg: could not find key to decrypt pre-header")
// ErrNotEncryptedHeader is raised when a message doesn't has an encrypted
// header after the pre-header.
var ErrNotEncryptedHeader = errors.New("msg: message doesn't have encrypted header")
// ErrNotCryptoSetup is raised when a message doesn't has a crypto setup
// header after the encrypted header.
var ErrNotCryptoSetup = errors.New("msg: message doesn't have crypto setup header")
// ErrWrongCryptoSetup is raised when a crypto setup header has the wrong length.
var ErrWrongCryptoSetup = errors.New("msg: crypto setup header has the wrong length")
// ErrNotEncryptedPacket is raised when an encrypted packet was expected.
var ErrNotEncryptedPacket = errors.New("msg: expected encrypted packet")
// ErrNotPaddingPacket is raised when a padding packet was expected.
var ErrNotPaddingPacket = errors.New("msg: expected padding packet")
// ErrNotSignaturePacket is raised when a signature packet was expected.
var ErrNotSignaturePacket = errors.New("msg: expected signature packet")
// ErrWrongSignatureLength is raised when a signature has the wrong length.
var ErrWrongSignatureLength = errors.New("msg: wrong signature length")
// ErrInvalidSignature is raised when a signature verification failed.
var ErrInvalidSignature = errors.New("msg: signature invalid")
// ErrNotHMACPacket is raised when an HMAC packet was expected.
var ErrNotHMACPacket = errors.New("msg: expected HMAC packet")
// ErrHMACsDiffer is raised when the HMACs differ.
var ErrHMACsDiffer = errors.New("msg: HMACs differ")
// ErrWrongCount is raised when an outer header count is wrong.
var ErrWrongCount = errors.New("msg: wrong outer header count")
// ErrNotData is raised when an inner data header was expected.
var ErrNotData = errors.New("msg: expected inner data header")
// ErrReflection is raised when a possible reflection attack has been detected.
var ErrReflection = errors.New("msg: reflection attack detected")
// ErrStatusError is raised when a decryption operation lead to a StatusCode StatusError.
var ErrStatusError = errors.New("msg: StatusCode == StatusError")