certgen

package module
v0.0.0-...-ea75db1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2016 License: MIT Imports: 15 Imported by: 2

Documentation

Overview

Package certgen provides high level functionality to generate X509 certificate pairs to use with TLS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToFile

func GenerateToFile(cp *CertParams, certFile string, keyFile string) error

GenerateToFile generates a ceritificate and writes it to files

func GenerateToMemory

func GenerateToMemory(cp *CertParams) (cert []byte, key []byte, err error)

GenerateToMemory generates a certificate as []byte from the params.

func GenerateToWriter

func GenerateToWriter(cp *CertParams, certWriter io.Writer, keyWriter io.Writer) error

GenerateToWriter generates a certificate and writes then to the 2 given Writers.

Types

type CertParams

type CertParams struct {
	Hosts      string
	ValidFrom  time.Time
	ValidFor   time.Duration
	IsCA       bool
	Rsa        bool
	RsaBits    int
	EcdsaCurve ECDSACurve
}

CertParams collects all the parameters for generaeting a X509 Certifice

func NewDefaultParams

func NewDefaultParams() *CertParams

NewDefaultParams returns params to generate a certificate with: RSA2048, Valid from now, valid for one year

type ECDSACurve

type ECDSACurve int

ECDSACurve represents the supported ECDSA curves for the certificate generation

const (
	// P224 to select the P-224 (FIPS 186-3, section D.2.2) elliptic curve
	P224 ECDSACurve = iota
	// P256 to select the P-256 (FIPS 186-3, section D.2.3) elliptic curve
	P256
	// P384 to select the P-384 (FIPS 186-3, section D.2.4) elliptic curve
	P384
	// P521 to select the P-521 (FIPS 186-3, section D.2.5) elliptic curve
	P521
)

func ECDSACurveFromString

func ECDSACurveFromString(s string) (ECDSACurve, error)

ECDSACurveFromString maps from a string to the ECDSACurve constant or returns an error

func (ECDSACurve) String

func (e ECDSACurve) String() string

Directories

Path Synopsis
cmd
Package server wraps http.ListenAndServeTLS such that it generates self signed certificates on the fly automatically
Package server wraps http.ListenAndServeTLS such that it generates self signed certificates on the fly automatically

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL