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 ¶
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