2017-05-30 19:01:32 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
|
2021-08-23 15:05:15 +02:00
|
|
|
"github.com/rfjakob/gocryptfs/v2/internal/configfile"
|
|
|
|
"github.com/rfjakob/gocryptfs/v2/internal/exitcodes"
|
2017-05-30 19:01:32 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// info pretty-prints the contents of the config file at "filename" for human
|
|
|
|
// consumption, stripping out sensitive data.
|
|
|
|
// This is called when you pass the "-info" option.
|
|
|
|
func info(filename string) {
|
2021-09-28 17:52:21 +02:00
|
|
|
cf, err := configfile.Load(filename)
|
2017-05-30 19:01:32 +02:00
|
|
|
if err != nil {
|
2021-09-28 17:52:21 +02:00
|
|
|
fmt.Printf("Loading config file failed: %v\n", err)
|
2017-05-30 19:01:32 +02:00
|
|
|
os.Exit(exitcodes.LoadConf)
|
|
|
|
}
|
|
|
|
s := cf.ScryptObject
|
2021-09-28 17:52:21 +02:00
|
|
|
algo, _ := cf.ContentEncryption()
|
|
|
|
// Pretty-print
|
|
|
|
fmt.Printf("Creator: %s\n", cf.Creator)
|
|
|
|
fmt.Printf("FeatureFlags: %s\n", strings.Join(cf.FeatureFlags, " "))
|
|
|
|
fmt.Printf("EncryptedKey: %dB\n", len(cf.EncryptedKey))
|
|
|
|
fmt.Printf("ScryptObject: Salt=%dB N=%d R=%d P=%d KeyLen=%d\n",
|
2017-05-30 19:01:32 +02:00
|
|
|
len(s.Salt), s.N, s.R, s.P, s.KeyLen)
|
2021-09-28 17:52:21 +02:00
|
|
|
fmt.Printf("contentEncryption: %s\n", algo.Algo) // lowercase because not in JSON
|
2017-05-30 19:01:32 +02:00
|
|
|
}
|