1
0
Fork 0
mirror of https://github.com/Mic92/sops-nix.git synced 2025-04-08 09:54:35 +00:00

avoid partial writes with ascii armor

Sill not perfect because it still prints the header
This commit is contained in:
Jörg Thalheim 2020-07-13 06:23:16 +01:00
parent 5aa953c287
commit dfedaea239
No known key found for this signature in database
GPG key ID: 003F2096411B5F92

View file

@ -85,7 +85,6 @@ func convertKeys(args []string) error {
if err != nil {
return fmt.Errorf("failed to encode armor writer")
}
defer writer.Close()
}
if opts.publicKey != "" {
@ -93,13 +92,16 @@ func convertKeys(args []string) error {
if err != nil {
return err
}
gpgKey.Serialize(writer)
err = gpgKey.Serialize(writer)
} else {
gpgKey, err := sshkeys.SSHPrivateKeyToPGP(sshKey)
if err != nil {
return err
}
gpgKey.SerializePrivate(writer, nil)
err = gpgKey.SerializePrivate(writer, nil)
}
if err == nil && opts.format == "armor" {
writer.Close()
}
return err
}