You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: main.go
+12-7Lines changed: 12 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
package main
2
2
3
3
import (
4
+
"encoding/base64"
4
5
"flag"
5
6
"fmt"
6
7
"io"
@@ -11,13 +12,14 @@ import (
11
12
)
12
13
13
14
const (
14
-
defaultEnvEncryptKey="ENCRYPT_KEY"
15
+
defaultEnvEncryptKey="ENCRYPT_KEY"
16
+
defaultEnvEncryptKeyBase64="ENCRYPT_KEY_BASE64"
15
17
)
16
18
17
19
var (
18
20
inputFile=flag.String("f", "-", `The file name to decrypt. Use '-' for stdin.`)
19
21
outputFile=flag.String("o", "-", `The file to write the result to. Use '-' for stdout.`)
20
-
keyFile=flag.String("k", "", fmt.Sprintf("The file with RSA private key. If empty the key is read from environment variable %s ", defaultEnvEncryptKey))
22
+
keyFile=flag.String("k", "", fmt.Sprintf("The file with RSA private key. If empty the key is read from environment variable %s / %s", defaultEnvEncryptKey, defaultEnvEncryptKeyBase64))
21
23
)
22
24
23
25
funcmain() {
@@ -33,12 +35,15 @@ func main() {
33
35
iferr!=nil {
34
36
exitOnError("key file reading error: %v", err)
35
37
}
36
-
} else {
37
-
value:=os.Getenv(defaultEnvEncryptKey)
38
-
ifvalue=="" {
39
-
exitOnError("missing private key error, provide key in the env variable %s or use -k flag", defaultEnvEncryptKey)
0 commit comments