MCPcopy Index your code
hub / github.com/smallstep/cli / readSCEPDecrypterKey

Function readSCEPDecrypterKey

command/ca/provisioner/add.go:1027–1040  ·  view source on GitHub ↗
(filename string)

Source from the content-addressed store, hash-verified

1025}
1026
1027func readSCEPDecrypterKey(filename string) ([]byte, error) {
1028 b, err := os.ReadFile(filename)
1029 if err != nil {
1030 return nil, fmt.Errorf("failed reading %q: %w", filename, err)
1031 }
1032
1033 if err := validateSCEPDecrypterKey(b); err != nil {
1034 return nil, fmt.Errorf("failed decoding %q: %w", filename, err)
1035 }
1036
1037 // TODO(hs): additional validation that this is an (encrypted) private key?
1038
1039 return b, err
1040}
1041
1042func validateSCEPDecrypterKey(data []byte) error {
1043 block, rest := pem.Decode(data)

Callers 2

updateSCEPDetailsFunction · 0.85
createSCEPDetailsFunction · 0.85

Calls 1

validateSCEPDecrypterKeyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…