Skip to content

Commit

Permalink
adds output type control
Browse files Browse the repository at this point in the history
  • Loading branch information
RafPe committed Dec 2, 2018
1 parent 811e103 commit 1e19d88
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ func main() {
Name: "url",
Usage: "URL from which details should be retrived",
},
cli.StringFlag{
Name: "out",
Value: "RSA",
Usage: "Output type ( RSA | PUBLIC )",
},
cli.BoolFlag{
Name: "show-kid",
Usage: "Show kid",
Expand Down Expand Up @@ -153,8 +158,17 @@ func cmdRetrievePublicKey(c *cli.Context) error {
log.Fatal(err)
}

// Define the output type of our key
outputType := ""
switch c.String("out") {
case "RSA":
outputType = "RSA PUBLIC KEY"
case "PUBLIC":
outputType = "PUBLIC KEY"
}

block := &pem.Block{
Type: "RSA PUBLIC KEY",
Type: outputType,
Bytes: der,
}

Expand Down

0 comments on commit 1e19d88

Please sign in to comment.