From 37423989c812e9a7972b6f272128e5f1e64c2827 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Mon, 30 Mar 2015 21:52:39 +0200 Subject: 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. --- main.go | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index a4eec3f..9b9ab0a 100644 --- a/main.go +++ b/main.go @@ -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...) -- cgit v1.2.3-70-g09d2