utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootCaPath  = "root.crt"
	RootKeyPath = "root.key"
)

Variables

This section is empty.

Functions

func ISFileExists

func ISFileExists(path string) bool

ISFileExists check file exists

Types

type Certificate

type Certificate struct {
	RootKey    *rsa.PrivateKey
	RootCa     *x509.Certificate
	RootCaStr  []byte
	RootKeyStr []byte
	RootPath   string
}

func NewCertificate

func NewCertificate(rootPath string) (*Certificate, error)

func (*Certificate) GenerateKey

func (c *Certificate) GenerateKey() (*rsa.PrivateKey, error)

func (*Certificate) GeneratePem

func (c *Certificate) GeneratePem(host string, subject pkix.Name, isRoot ...bool) (*pem.Block, *pem.Block, error)

GeneratePem generate pem By default, a child certificate is generated. If you need to generate a root certificate, please pass in the third parameter as true, or do not set RootCa and RootKey

Jump to

Keyboard shortcuts

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