mirror of
https://github.com/Mic92/sops-nix.git
synced 2025-12-26 22:24:59 +08:00
avoid partial writes with ascii armor
Sill not perfect because it still prints the header
This commit is contained in:
parent
5aa953c287
commit
dfedaea239
1 changed files with 5 additions and 3 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue