mirror of https://github.com/perkeep/perkeep.git
jsonsign: make sure armored public key ends in a newline
Change-Id: Ia0e52c6e011db295c21eb8b1b6b6534873bf6310
This commit is contained in:
parent
38d138c2dc
commit
a16b1f43ca
|
@ -113,6 +113,8 @@ func EntityFromSecring(keyId, keyFile string) (*openpgp.Entity, os.Error) {
|
|||
return entity, nil
|
||||
}
|
||||
|
||||
var newlineBytes = []byte("\n")
|
||||
|
||||
func ArmoredPublicKey(entity *openpgp.Entity) (string, os.Error) {
|
||||
var buf bytes.Buffer
|
||||
wc, err := armor.Encode(&buf, openpgp.PublicKeyType, nil)
|
||||
|
@ -124,5 +126,8 @@ func ArmoredPublicKey(entity *openpgp.Entity) (string, os.Error) {
|
|||
return "", err
|
||||
}
|
||||
wc.Close()
|
||||
if !bytes.HasSuffix(buf.Bytes(), newlineBytes) {
|
||||
buf.WriteString("\n")
|
||||
}
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue