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:
@@ -14,7 +14,7 @@ import (
|
|||||||
type StructuralError string
|
type StructuralError string
|
||||||
|
|
||||||
func (s StructuralError) Error() 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
|
// UnsupportedError indicates that, although the OpenPGP data is valid, it
|
||||||
@@ -22,7 +22,7 @@ func (s StructuralError) Error() string {
|
|||||||
type UnsupportedError string
|
type UnsupportedError string
|
||||||
|
|
||||||
func (s UnsupportedError) Error() 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
|
// InvalidArgumentError indicates that the caller is in error and passed an
|
||||||
@@ -30,7 +30,7 @@ func (s UnsupportedError) Error() string {
|
|||||||
type InvalidArgumentError string
|
type InvalidArgumentError string
|
||||||
|
|
||||||
func (i InvalidArgumentError) Error() 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
|
// SignatureError indicates that a syntactically valid signature failed to
|
||||||
@@ -38,13 +38,13 @@ func (i InvalidArgumentError) Error() string {
|
|||||||
type SignatureError string
|
type SignatureError string
|
||||||
|
|
||||||
func (b SignatureError) Error() string {
|
func (b SignatureError) Error() string {
|
||||||
return "OpenPGP signature invalid: " + string(b)
|
return "openpgp: invalid signature: " + string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
type keyIncorrectError int
|
type keyIncorrectError int
|
||||||
|
|
||||||
func (ki keyIncorrectError) Error() string {
|
func (ki keyIncorrectError) Error() string {
|
||||||
return "the given key was incorrect"
|
return "openpgp: incorrect key"
|
||||||
}
|
}
|
||||||
|
|
||||||
var ErrKeyIncorrect error = keyIncorrectError(0)
|
var ErrKeyIncorrect error = keyIncorrectError(0)
|
||||||
@@ -52,7 +52,7 @@ var ErrKeyIncorrect error = keyIncorrectError(0)
|
|||||||
type unknownIssuerError int
|
type unknownIssuerError int
|
||||||
|
|
||||||
func (unknownIssuerError) Error() string {
|
func (unknownIssuerError) Error() string {
|
||||||
return "signature make by unknown entity"
|
return "openpgp: signature made by unknown entity"
|
||||||
}
|
}
|
||||||
|
|
||||||
var ErrUnknownIssuer error = unknownIssuerError(0)
|
var ErrUnknownIssuer error = unknownIssuerError(0)
|
||||||
@@ -60,5 +60,5 @@ var ErrUnknownIssuer error = unknownIssuerError(0)
|
|||||||
type UnknownPacketTypeError uint8
|
type UnknownPacketTypeError uint8
|
||||||
|
|
||||||
func (upte UnknownPacketTypeError) Error() string {
|
func (upte UnknownPacketTypeError) Error() string {
|
||||||
return "unknown OpenPGP packet type: " + strconv.Itoa(int(upte))
|
return "openpgp: unknown packet type: " + strconv.Itoa(int(upte))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Config collects a number of parameters along with sensible defaults.
|
// Config collects a number of parameters along with sensible defaults.
|
||||||
|
// A nil *Config is valid and results in all default values.
|
||||||
// A nil *Config is valid and produces all default values.
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
// Rand provides the source of entropy.
|
// Rand provides the source of entropy.
|
||||||
// If nil, the crypto/rand Reader is used.
|
// If nil, the crypto/rand Reader is used.
|
||||||
|
|||||||
@@ -483,13 +483,14 @@ func (sig *Signature) SignKey(pub *PublicKey, priv *PrivateKey, config *Config)
|
|||||||
return sig.Sign(h, priv, 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) {
|
func (sig *Signature) Serialize(w io.Writer) (err error) {
|
||||||
if len(sig.outSubpackets) == 0 {
|
if len(sig.outSubpackets) == 0 {
|
||||||
sig.outSubpackets = sig.rawSubpackets
|
sig.outSubpackets = sig.rawSubpackets
|
||||||
}
|
}
|
||||||
if sig.RSASignature.bytes == nil && sig.DSASigR.bytes == nil {
|
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
|
sigLength := 0
|
||||||
|
|||||||
Reference in New Issue
Block a user