cmd/age-keygen: don't warn about world-readable output for public keys (#268)

Fixes #267
This commit is contained in:
Ryan Castellucci
2021-05-19 01:35:29 +01:00
committed by GitHub
parent 85763d390a
commit 759a88d3e8

View File

@@ -102,12 +102,6 @@ func main() {
out = f
}
if fi, err := out.Stat(); err == nil {
if fi.Mode().IsRegular() && fi.Mode().Perm()&0004 != 0 {
fmt.Fprintf(os.Stderr, "Warning: writing secret key to a world-readable file.\n")
}
}
in := os.Stdin
if inFile := flag.Arg(0); inFile != "" && inFile != "-" {
f, err := os.Open(inFile)
@@ -121,6 +115,9 @@ func main() {
if convertFlag {
convert(in, out)
} else {
if fi, err := out.Stat(); err == nil && fi.Mode().IsRegular() && fi.Mode().Perm()&0004 != 0 {
fmt.Fprintf(os.Stderr, "Warning: writing secret key to a world-readable file.\n")
}
generate(out)
}
}