Help us shape the future of Go! Take the 2026 Go Developer Survey

certs

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

README

certs

X.509 certificate generation and management code.

Documentation

Index

Constants

View Source
const (
	OperatorCA = iota + 1
	ListenerCA
	ImplantCA
	RootCA
)
View Source
const (
	// RSAKey - Namespace for RSA keys
	RSAKey     = "rsa"
	RootName   = "Root"
	RootCert   = "root_ca.pem"
	RootKey    = "root_key.pem"
	ServerCert = "server_crt.pem"
	ServerKey  = "server_key.pem"

	RootNamespace     = "root"
	ListenerNamespace = "listener" // Listener servers
	ClientNamespace   = "client"
)
View Source
const (
	Acme       = "acme"
	SelfSigned = "self_signed"
	Imported   = "imported"
)

Variables

View Source
var CertTypes = []string{
	Acme, SelfSigned, Imported,
}

Functions

func ExtractCertificateSubject added in v0.1.1

func ExtractCertificateSubject(certPEM string) (*pkix.Name, error)

ExtractCertificateSubject - 从证书PEM中提取subject信息

func FormatSubject added in v0.1.1

func FormatSubject(name, certType, certPEM string) (string, error)

func GenerateCACert

func GenerateCACert(commonName string, subject *pkix.Name) ([]byte, []byte, error)

func GenerateChildCert

func GenerateChildCert(commonName string, isClient bool, caCert *x509.Certificate, caKey *rsa.PrivateKey) ([]byte, []byte, error)

func RandomSubject

func RandomSubject(commonName string) *pkix.Name

func RsaKeySize

func RsaKeySize() int

func SaveToPEMFile

func SaveToPEMFile(filename string, pemData []byte) error

SaveToPEMFile save to PEM file

Types

This section is empty.

Jump to

Keyboard shortcuts

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