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 ¶
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.