tls

package
v0.0.0-...-6c0425d Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package tls provides helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCert

func GenerateCert(certOut io.Writer, keyOut io.Writer, opts Options) error

GenerateCert generates key.pem, cert.pem file contents and write them through io.Writer interfaces.

opts.Host is a required value. opts.validFor defaults to 1 year, opts.RSABits defaults to 2048.

func GenerateCertToFiles

func GenerateCertToFiles(keyFile string, certFile string, opts Options) error

GenerateCertToFiles generates key and cert using "GenerateCert" function, then writes the content to the files specified with parameters keyFile and certFile

Types

type Options

type Options struct {
	Host string
	//ValidFrom is creation date formatted as Jan 1 15:04:05 2011
	ValidFrom string
	//ValidFor is the duration that certificate is valid for
	ValidFor time.Duration
	//IsCA is whether this cert should be its own Certificate Authority
	IsCA bool
	//RSABits is the size of RSA key to generate. Ignored if EcdsaCurve is set
	RSABits int
	//ECDSA is the ECDSA curve to use to generate a key. Valid values are P224,
	//P256 (recommended), P384, P521
	ECDSACurve string
}

Options is the key and certficate options for generate functions

Jump to

Keyboard shortcuts

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