openpgp: fix error strings and typos.

Fixes golang/go#2841.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5688054
This commit is contained in:
Adam Langley
2012-02-21 09:52:37 -05:00
parent ae4d10368a
commit 63736bd2bf
3 changed files with 11 additions and 11 deletions
+7 -7
View File
@@ -14,7 +14,7 @@ import (
type StructuralError string
func (s StructuralError) Error() string {
return "OpenPGP data invalid: " + string(s)
return "openpgp: invalid data: " + string(s)
}
// UnsupportedError indicates that, although the OpenPGP data is valid, it
@@ -22,7 +22,7 @@ func (s StructuralError) Error() string {
type UnsupportedError string
func (s UnsupportedError) Error() string {
return "OpenPGP feature unsupported: " + string(s)
return "openpgp: unsupported feature: " + string(s)
}
// InvalidArgumentError indicates that the caller is in error and passed an
@@ -30,7 +30,7 @@ func (s UnsupportedError) Error() string {
type InvalidArgumentError string
func (i InvalidArgumentError) Error() string {
return "OpenPGP argument invalid: " + string(i)
return "openpgp: invalid argument: " + string(i)
}
// SignatureError indicates that a syntactically valid signature failed to
@@ -38,13 +38,13 @@ func (i InvalidArgumentError) Error() string {
type SignatureError string
func (b SignatureError) Error() string {
return "OpenPGP signature invalid: " + string(b)
return "openpgp: invalid signature: " + string(b)
}
type keyIncorrectError int
func (ki keyIncorrectError) Error() string {
return "the given key was incorrect"
return "openpgp: incorrect key"
}
var ErrKeyIncorrect error = keyIncorrectError(0)
@@ -52,7 +52,7 @@ var ErrKeyIncorrect error = keyIncorrectError(0)
type unknownIssuerError int
func (unknownIssuerError) Error() string {
return "signature make by unknown entity"
return "openpgp: signature made by unknown entity"
}
var ErrUnknownIssuer error = unknownIssuerError(0)
@@ -60,5 +60,5 @@ var ErrUnknownIssuer error = unknownIssuerError(0)
type UnknownPacketTypeError uint8
func (upte UnknownPacketTypeError) Error() string {
return "unknown OpenPGP packet type: " + strconv.Itoa(int(upte))
return "openpgp: unknown packet type: " + strconv.Itoa(int(upte))
}
+1 -2
View File
@@ -12,8 +12,7 @@ import (
)
// Config collects a number of parameters along with sensible defaults.
// A nil *Config is valid and produces all default values.
// A nil *Config is valid and results in all default values.
type Config struct {
// Rand provides the source of entropy.
// If nil, the crypto/rand Reader is used.
+3 -2
View File
@@ -483,13 +483,14 @@ func (sig *Signature) SignKey(pub *PublicKey, priv *PrivateKey, config *Config)
return sig.Sign(h, priv, config)
}
// Serialize marshals sig to w. SignRSA or SignDSA must have been called first.
// Serialize marshals sig to w. Sign, SignUserId or SignKey must have been
// called first.
func (sig *Signature) Serialize(w io.Writer) (err error) {
if len(sig.outSubpackets) == 0 {
sig.outSubpackets = sig.rawSubpackets
}
if sig.RSASignature.bytes == nil && sig.DSASigR.bytes == nil {
return errors.InvalidArgumentError("Signature: need to call SignRSA or SignDSA before Serialize")
return errors.InvalidArgumentError("Signature: need to call Sign, SignUserId or SignKey before Serialize")
}
sigLength := 0