diff options
author | Gibheer <gibheer@gmail.com> | 2015-03-30 21:52:39 +0200 |
---|---|---|
committer | Gibheer <gibheer@gmail.com> | 2015-03-30 21:52:39 +0200 |
commit | 37423989c812e9a7972b6f272128e5f1e64c2827 (patch) | |
tree | 5f5120db8e7e9c3b2045c20478fe65298d20abda /main.go | |
parent | 9ba6a88449e6297ea925e0c59e923c56e742983f (diff) |
split certificate stuff into own file
This moves the complicated certificate flag handling into its own file
to make it a bit easier to handle.
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 25 |
1 files changed, 0 insertions, 25 deletions
@@ -117,31 +117,6 @@ func create_sign_request(cmd *Command, args []string) { } } -func create_cert(cmd *Command, args []string) { - err := checkFlags(checkPrivateKey, checkOutput, checkCSR, checkCertFlags) - if err != nil { - crash_with_help(cmd, ErrorFlagInput, "Flags invalid: %s", err) - } - - // TODO implement flags for all certificate options - cert, err := FlagCertificateSignRequest.ToCertificate( - FlagPrivateKey, - FlagCertificateGeneration, - nil, - ) - if err != nil { - crash_with_help(cmd, ErrorProgram, "Error generating certificate: %s", err) - } - pem_block, err := cert.MarshalPem() - if err != nil { - crash_with_help(cmd, ErrorProgram, "Error when marshalling to pem: %s", err) - } - _, err = pem_block.WriteTo(FlagOutput) - if err != nil { - crash_with_help(cmd, ErrorProgram, "Could not write to output: %s", err) - } -} - // crash and provide a helpful message func crash_with_help(cmd *Command, code int, message string, args ...interface{}) { fmt.Fprintf(os.Stderr, message+"\n", args...) |