forked from enceve/crypto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crypto.go
33 lines (25 loc) · 898 Bytes
/
crypto.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
// Use of this source code is governed by a license
// that can be found in the LICENSE file.
// Package crypto contains commen and general useful
// cryptographic functions and types.
package crypto
import "strconv"
// A KeySizeError indicates, that the size of a given key
// does not match the expected size.
type KeySizeError int
func (k KeySizeError) Error() string {
return "invalid key size " + strconv.Itoa(int(k))
}
// A NonceSizeError indicates, that the size of a given nonce
// does not match the expected size.
type NonceSizeError int
func (n NonceSizeError) Error() string {
return "invalid nonce size " + strconv.Itoa(int(n))
}
// A AuthenticationError indicates, that an authentication
// process failed. E.g. the message authentication of a AEAD
// cipher.
type AuthenticationError struct{}
func (a AuthenticationError) Error() string {
return "authentication failed"
}