You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

73 regels
1.8 KiB

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