Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cli.Command{ Name: "pubkeyhash", Usage: "Dump pubkeyhash of the specified public key/certificate", Aliases: []string{"hash"}, Flags: []cli.Flag{ &cli.StringFlag{ Name: "output", Aliases: []string{"o"}, Usage: "Output format. (full, hashonly)", Value: "full", }, &cli.PathFlag{ Name: "file", Aliases: []string{"f"}, Usage: "PEM file containing public key/certificates", Value: "-", }, }, Action: func(c *cli.Context) error { env := action.GlobalEnvironment ftstr := c.String("output") ft, err := FormatTypeFromString(ftstr) if err != nil { return err } var r io.Reader path := c.String("file") if path == "-" { r = os.Stdin } else { f, err := os.Open(path) if err != nil { return err } defer f.Close() r = f } bs, err := ioutil.ReadAll(r) if err != nil { return err } khs, err := ExtractPublicKeyHashesFromPem(bs, env.Logger) if err != nil { return err } for _, e := range khs { if ft.ShouldOutputLabel() { fmt.Printf("# %s\n", e.Label) } fmt.Printf("%s\n", e.Hash) } return nil }, }
Functions ¶
This section is empty.
Types ¶
type FormatType ¶ added in v0.2.2
type FormatType int
const ( FormatFull FormatType = iota FormatHashOnly )
func FormatTypeFromString ¶ added in v0.2.2
func FormatTypeFromString(s string) (FormatType, error)
func (FormatType) ShouldOutputLabel ¶ added in v0.2.2
func (ft FormatType) ShouldOutputLabel() bool
Click to show internal directories.
Click to hide internal directories.