-
Notifications
You must be signed in to change notification settings - Fork 68
/
errors.go
165 lines (151 loc) · 5 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
package dongle
import (
"fmt"
)
var (
// returns an invalid aes src error
// 返回无效的 aes 明文错误
invalidAesSrcError = func() error {
return fmt.Errorf("aes: invalid src, the src is not full blocks")
}
// returns an invalid aes key error
// 返回无效的 aes 密钥错误
invalidAesKeyError = func() error {
return fmt.Errorf("aes: invalid key, the key must be 16, 24 or 32 bytes")
}
// returns an invalid aes iv error、
// 返回无效的 aes 偏移量错误
invalidAesIVError = func() error {
return fmt.Errorf("aes: invalid iv, the iv size must be 16 bytes")
}
)
var (
// returns an invalid blowfish src error
// 返回无效的 blowfish 明文错误
invalidBlowfishSrcError = func() error {
return fmt.Errorf("blowfish: invalid src, the src is not full blocks")
}
// returns an invalid blowfish key error
// 返回无效的 blowfish 密钥错误
invalidBlowfishKeyError = func() error {
return fmt.Errorf("blowfish: invalid key, the key must from 1 to 56 bytes")
}
// returns an invalid blowfish iv error、
// 返回无效的 blowfish 偏移量错误
invalidBlowfishIVError = func() error {
return fmt.Errorf("blowfish: invalid iv, the iv size must be 8 bytes")
}
)
var (
// returns an invalid des src error
// 返回无效的 des 明文错误
invalidDesSrcError = func() error {
return fmt.Errorf("des: invalid src, the src is not full blocks")
}
// returns an invalid des key error
// 返回无效的 des 密钥错误
invalidDesKeyError = func() error {
return fmt.Errorf("des: invalid key, the key must be 8 bytes")
}
// returns an invalid des iv error、
// 返回无效的 des 偏移量错误
invalidDesIVError = func() error {
return fmt.Errorf("des: invalid iv, the iv size must be 8 bytes")
}
)
var (
// returns an invalid 3des src error
// 返回无效的 3des 明文错误
invalid3DesSrcError = func() error {
return fmt.Errorf("3des: invalid src, the src is not full blocks")
}
// returns an invalid 3des key error
// 返回无效的 3des 密钥错误
invalid3DesKeyError = func() error {
return fmt.Errorf("3des: invalids key, the key must be 24 bytes")
}
// returns an invalid 3des iv error、
// 返回无效的 3des 偏移量错误
invalid3DesIVError = func() error {
return fmt.Errorf("3des: invalid iv, the iv size must be 8 bytes")
}
)
var (
// returns an invalid rsa public key error
// 返回无效的 rsa 公钥错误
invalidRsaPublicKeyError = func() error {
return fmt.Errorf("rsa: invalid public key, please make sure the public key is valid")
}
// returns an invalid rsa private key error
// 返回无效的 rsa 私钥错误
invalidRsaPrivateKeyError = func() error {
return fmt.Errorf("rsa: invalid private key, please make sure the private key is valid")
}
)
var (
// returns an invalid ed25519 private key error
// 返回无效的 ed25519 私钥错误
invalidEd25519PrivateKeyError = func() error {
return fmt.Errorf("ed25519: invalid private key, please make sure the private key is valid")
}
// returns an invalid ed25519 public key error
// 返回无效的 ed25519 公钥错误
invalidEd25519PublicKeyError = func() error {
return fmt.Errorf("ed25519: invalid public key, please make sure the public key is valid")
}
// returns an invalid ed25519 signature error
// 返回无效的 ed25519 签名错误
invalidEd25519SignatureError = func() error {
return fmt.Errorf("ed25519: invalid signature, please make sure the signature is valid")
}
)
var (
// returns an invalid tea round error
// 返回无效的 tea 迭代轮数错误
invalidTeaRoundsError = func() error {
return fmt.Errorf("tea: invalid rounds, the rounds must be even")
}
// returns an invalid tea key error
// 返回无效的 tea 密钥错误
invalidTeaKeyError = func() error {
return fmt.Errorf("tea: invalid key, the key must be 16 bytes")
}
)
var (
// returns an invalid morse src error
// 返回无效的 morse 明文错误
invalidMorseSrcError = func() error {
return fmt.Errorf("morse: invalid src, the src can't contain spaces")
}
// returns a morse decoding error
// 返回 morse 解码错误
morseDecodingError = func() error {
return fmt.Errorf("morse: invalid decoding, the src can't be decoded")
}
)
var (
// returns an invalid bcrypt rounds error
// 返回无效的 bcrypt 迭代轮数错误
invalidBcryptRoundsError = func() error {
return fmt.Errorf("bcrypt: invalid rounds, the rounds is outside allowed range (4,31)")
}
)
var (
// returns an invalid rc4 key error
// 返回无效的 rc4 密钥错误
invalidRc4KeyError = func() error {
return fmt.Errorf("rc4: invalid key, the key at least 1 byte and at most 256 bytes")
}
)
var (
// returns an invalid hash size error
// 返回无效的哈希大小错误
invalidHashSizeError = func() error {
return fmt.Errorf("hash: invalid size, the size is unsupported")
}
// returns an invalid decoding error
// 返回无效的解码方式错误
invalidDecodingError = func(mode string) error {
return fmt.Errorf("decode: invalid decoding, the src can't be decoded by %s", mode)
}
)