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 errors contains common error types for the OpenPGP packages. 6package errors // import "golang.org/x/crypto/openpgp/errors" 7 8import ( 9 "strconv" 10) 11 12// A StructuralError is returned when OpenPGP data is found to be syntactically 13// invalid. 14type StructuralError string 15 16func (s StructuralError) Error() string { 17 return "openpgp: invalid data: " + string(s) 18} 19 20// UnsupportedError indicates that, although the OpenPGP data is valid, it 21// makes use of currently unimplemented features. 22type UnsupportedError string 23 24func (s UnsupportedError) Error() string { 25 return "openpgp: unsupported feature: " + string(s) 26} 27 28// InvalidArgumentError indicates that the caller is in error and passed an 29// incorrect value. 30type InvalidArgumentError string 31 32func (i InvalidArgumentError) Error() string { 33 return "openpgp: invalid argument: " + string(i) 34} 35 36// SignatureError indicates that a syntactically valid signature failed to 37// validate. 38type SignatureError string 39 40func (b SignatureError) Error() string { 41 return "openpgp: invalid signature: " + string(b) 42} 43 44type keyIncorrectError int 45 46func (ki keyIncorrectError) Error() string { 47 return "openpgp: incorrect key" 48} 49 50var ErrKeyIncorrect error = keyIncorrectError(0) 51 52type unknownIssuerError int 53 54func (unknownIssuerError) Error() string { 55 return "openpgp: signature made by unknown entity" 56} 57 58var ErrUnknownIssuer error = unknownIssuerError(0) 59 60type keyRevokedError int 61 62func (keyRevokedError) Error() string { 63 return "openpgp: signature made by revoked key" 64} 65 66var ErrKeyRevoked error = keyRevokedError(0) 67 68type UnknownPacketTypeError uint8 69 70func (upte UnknownPacketTypeError) Error() string { 71 return "openpgp: unknown packet type: " + strconv.Itoa(int(upte)) 72} 73