MCPcopy
hub / github.com/smallstep/cli / ReadPasswordFromFile

Function ReadPasswordFromFile

utils/read.go:55–62  ·  view source on GitHub ↗

ReadPasswordFromFile reads and returns the password from the given filename. The contents of the file will be trimmed at the right.

(filename string)

Source from the content-addressed store, hash-verified

53// ReadPasswordFromFile reads and returns the password from the given filename.
54// The contents of the file will be trimmed at the right.
55func ReadPasswordFromFile(filename string) ([]byte, error) {
56 password, err := os.ReadFile(filename) // #nosec G703 -- file intended to be provided by user
57 if err != nil {
58 return nil, errs.FileError(err, filename)
59 }
60 password = bytes.TrimRightFunc(password, unicode.IsSpace)
61 return password, nil
62}
63
64// ReadStringPasswordFromFile reads and returns the password from the given filename.
65// The contents of the file will be trimmed at the right.

Callers 7

NewOfflineCAFunction · 0.92
savePrivateKeyFunction · 0.92
initActionFunction · 0.92
updateSCEPDetailsFunction · 0.92
createSCEPDetailsFunction · 0.92
TestReadPasswordFromFileFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestReadPasswordFromFileFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…