OSDN Git Service

ceeb05419488b2274625d222ba7f151c28a8dc62
[pf3gnuchains/gcc-fork.git] / libgo / go / crypto / openpgp / error / error.go
1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Package error contains common error types for the OpenPGP packages.
6 package error
7
8 import (
9         "strconv"
10 )
11
12 // A StructuralError is returned when OpenPGP data is found to be syntactically
13 // invalid.
14 type StructuralError string
15
16 func (s StructuralError) Error() string {
17         return "OpenPGP data invalid: " + string(s)
18 }
19
20 // UnsupportedError indicates that, although the OpenPGP data is valid, it
21 // makes use of currently unimplemented features.
22 type UnsupportedError string
23
24 func (s UnsupportedError) Error() string {
25         return "OpenPGP feature unsupported: " + string(s)
26 }
27
28 // InvalidArgumentError indicates that the caller is in error and passed an
29 // incorrect value.
30 type InvalidArgumentError string
31
32 func (i InvalidArgumentError) Error() string {
33         return "OpenPGP argument invalid: " + string(i)
34 }
35
36 // SignatureError indicates that a syntactically valid signature failed to
37 // validate.
38 type SignatureError string
39
40 func (b SignatureError) Error() string {
41         return "OpenPGP signature invalid: " + string(b)
42 }
43
44 type keyIncorrectError int
45
46 func (ki keyIncorrectError) Error() string {
47         return "the given key was incorrect"
48 }
49
50 var KeyIncorrectError = keyIncorrectError(0)
51
52 type unknownIssuerError int
53
54 func (unknownIssuerError) Error() string {
55         return "signature make by unknown entity"
56 }
57
58 var UnknownIssuerError = unknownIssuerError(0)
59
60 type UnknownPacketTypeError uint8
61
62 func (upte UnknownPacketTypeError) Error() string {
63         return "unknown OpenPGP packet type: " + strconv.Itoa(int(upte))
64 }