security

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CA

type CA struct {
	// Cert is the parsed x509 root certificate of the Certificate Authority.
	Cert *x509.Certificate
	// PrivateKey is the RSA private key corresponding to the root certificate.
	PrivateKey *rsa.PrivateKey
	// CertPool is a pool containing only the CA's root certificate, which can
	// be used by a client to validate certificates signed by this CA.
	CertPool *x509.CertPool
}

CA encapsulates the components of a dynamically generated Certificate Authority, including its root certificate, private key, and a certificate pool containing the root. This is primarily used for TLS interception (MITM) in a proxy, where the CA is used to sign certificates for hosts on the fly.

func NewCA

func NewCA() (*CA, error)

NewCA generates a new, self-signed Certificate Authority. It creates a 2048-bit RSA private key and a corresponding root certificate configured with the necessary properties to act as a CA. This CA can then be used to sign certificates for other domains, which is a key requirement for TLS interception.

Returns an initialized CA struct or an error if key or certificate generation fails.

Jump to

Keyboard shortcuts

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