Documentation ¶
Index ¶
- Constants
- func CreateDevPEM(dns ...string) ([]byte, any, error)
- func DERBytesToPEMBlocks(der []byte, priv any, opt ...Option) ([]byte, []byte, error)
- func DevPEMFile(name string, dns ...string) ([]byte, []byte, error)
- func LoadPEMFromFile(path string, opt ...Option) ([]byte, []byte, error)
- func LoadPEMFromReader(r io.Reader, opt ...Option) ([]byte, []byte, error)
- func LoadTLSCertificate(cert, key []byte) (*tls.Certificate, error)
- func ParseTLSCertificateFromFile(path string, opt ...Option) (*tls.Certificate, error)
- func ParseTLSCertificateFromReader(r io.Reader, opt ...Option) (*tls.Certificate, error)
- type Option
- type Password
Constants ¶
const ( PEMBlockRSAPrivateKey = "RSA PRIVATE KEY" PEMBlockECPrivateKey = "EC PRIVATE KEY" PEMBlockEncryptedPrivateKey = "ENCRYPTED PRIVATE KEY" PEMBlockPrivateKey = "PRIVATE KEY" PEMBlockCertificate = "CERTIFICATE" )
Variables ¶
This section is empty.
Functions ¶
func CreateDevPEM ¶ added in v0.8.0
CreateDevPEM creates a self-signed certificate for development. Returns certificate DER bytes and private key.
func DERBytesToPEMBlocks ¶
DERBytesToPEMBlocks converts certificate DER bytes and optional private key to PEM blocks. Returns certificate PEM block and private key PEM block.
func DevPEMFile ¶ added in v0.8.0
DevPEMFile loads or generates new TLS certificate for development.
func LoadPEMFromFile ¶ added in v0.8.0
LoadPEMFromFile loads a PEM-encoded certificate and private key from the specified file.
func LoadPEMFromReader ¶ added in v0.8.0
LoadPEMFromReader loads a PEM-encoded certificate and private key from the io.Reader.
func LoadTLSCertificate ¶
func LoadTLSCertificate(cert, key []byte) (*tls.Certificate, error)
LoadTLSCertificate parses a public/private key pair from a pair of PEM encoded data.
func ParseTLSCertificateFromFile ¶ added in v0.8.0
func ParseTLSCertificateFromFile(path string, opt ...Option) (*tls.Certificate, error)
ParseTLSCertificateFromReader parses a public/private key pair from a PEM encoded file.
func ParseTLSCertificateFromReader ¶ added in v0.8.0
ParseTLSCertificateFromReader parses a public/private key pair from a PEM encoded data io.Reader source.