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

Function fingerprint

command/ssh/fingerprint.go:54–88  ·  view source on GitHub ↗
(ctx *cli.Context)

Source from the content-addressed store, hash-verified

52}
53
54func fingerprint(ctx *cli.Context) error {
55 if err := errs.MinMaxNumberOfArguments(ctx, 0, 1); err != nil {
56 return err
57 }
58
59 format, err := flags.ParseFingerprintFormat(ctx.String("format"))
60 if err != nil {
61 return err
62 }
63
64 certificateMode := ctx.Bool("certificate")
65
66 name := ctx.Args().First()
67 if name == "" {
68 name = "-"
69 }
70
71 b, err := utils.ReadFile(name)
72 if err != nil {
73 return err
74 }
75
76 var fingerprint string
77 if certificateMode {
78 fingerprint, err = sshutil.FormatCertificateFingerprint(b, format)
79 } else {
80 fingerprint, err = sshutil.FormatFingerprint(b, format)
81 }
82 if err != nil {
83 return err
84 }
85
86 fmt.Println(fingerprint)
87 return nil
88}

Callers

nothing calls this directly

Calls 3

ParseFingerprintFormatFunction · 0.92
ReadFileFunction · 0.92
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…