cert

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 21 Imported by: 0

README

Alternative to using code when on Mac or Linux

###generate a private key and self-signed certificate for localhost is with this openssl command

openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")

Documentation

Overview

some parts from https://github.com/jsha/minica/blob/master/main.go

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyPath  = ""
	CertPath = ""
)

Functions

func ExampleUsage

func ExampleUsage()

func LECerts

func LECerts(host, email string) autocert.Manager

Types

type Cert

type Cert struct {
	// contains filtered or unexported fields
}

func New

func New(path, organization, domainIPCombo, validFrom, ecdsaCurve string, validFor *time.Duration, isCA bool, rsaBits int) *Cert

New Certificate/Key

path...			where to store once created
organization...	"Acme Co"
domainIPCombo..	"localhost/127.0.0.1"
validFrom...	"Jan 1 15:04:05 2011"
ecdsaCurve...	empty for RSA otherwise P256 recommended
validFor...		some time.X Duration
isCA...			become it's own certificate authority
rsaBits...		default 2048, ignored if using ecdsaCurve instead of RSA

func (*Cert) CreateCert

func (c *Cert) CreateCert(override bool)

CreateCert used to create self signed certificates domain Comma-separated hostnames and IPs to generate a certificate for (default localhost/127.0.0.1) certValidFrom Creation date formatted as Jan 1 15:04:05 2011 (default time.now() ) certValidFor Duration that certificate is valid for (default 1 yr) rsaBits Size of RSA key to generate. Ignored if --ecdsa-curve is set (default 2048) ecdsaCurve ECDSA curve to use to generate a key. Valid values are P224, P256 (recommended), P384, P521 isCA whether this cert should be its own Certificate Authority (default false)

Jump to

Keyboard shortcuts

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