Documentation ¶
Index ¶
- func CertPoolFromFile(filename string) (*x509.CertPool, error)
- func CertsFromPEM(pemCerts []byte) ([]*x509.Certificate, error)
- func FoundCertOrKey(certPath, keyPath string) bool
- func GenerateSelfSignedCert(host, certPath, keyPath string, alternateIPs []net.IP, alternateDNS []string) error
- func WriteCertToPath(certPath string, data []byte) error
- func WriteKeyToPath(keyPath string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CertPoolFromFile ¶
CertPoolFromFile returns an x509.CertPool containing the certificates in the given PEM-encoded file. Returns an error if the file could not be read, a certificate could not be parsed, or if the file does not contain any certificates
func CertsFromPEM ¶
func CertsFromPEM(pemCerts []byte) ([]*x509.Certificate, error)
CertsFromPEM returns the x509.Certificates contained in the given PEM-encoded byte array Returns an error if a certificate could not be parsed, or if the data does not contain any certificates
func FoundCertOrKey ¶
FoundCertOrKey returns true if the certificate or key files already exists, otherwise returns false.
func GenerateSelfSignedCert ¶
func GenerateSelfSignedCert(host, certPath, keyPath string, alternateIPs []net.IP, alternateDNS []string) error
GenerateSelfSignedCert creates a self-signed certificate and key for the given host. Host may be an IP or a DNS name You may also specify additional subject alt names (either ip or dns names) for the certificate The certificate will be created with file mode 0644. The key will be created with file mode 0600. If the certificate or key files already exist, they will be overwritten. Any parent directories of the certPath or keyPath will be created as needed with file mode 0755.
func WriteCertToPath ¶
WriteCertToPath writes the pem-encoded certificate data to certPath. The certificate file will be created with file mode 0644. If the certificate file already exists, it will be overwritten. The parent directory of the certPath will be created as needed with file mode 0755.
func WriteKeyToPath ¶
WriteKeyToPath writes the pem-encoded key data to keyPath. The key file will be created with file mode 0600. If the key file already exists, it will be overwritten. The parent directory of the keyPath will be created as needed with file mode 0755.
Types ¶
This section is empty.