Documentation ¶
Index ¶
- func Exists(files ...string) bool
- func Expired(certPath string, pool *x509.CertPool, days int) bool
- func GenerateCertKey(regen bool, commonName string, organization []string, ...) (bool, error)
- func GenerateClientCertKey(regen bool, commonName string, organization []string, ...) (bool, error)
- func GenerateRSAKeyPair(regen bool, keyFie string) (bool, error)
- func GenerateServerCertKey(regen bool, commonName string, organization []string, ...) (bool, error)
- func GenerateSigningCertKey(regen bool, prefix, certFile, keyFile string) (bool, error)
- func LoadCertPool(caCertPath string) (*x509.CertPool, error)
- func LoadCertificate(certPath string) (*x509.Certificate, error)
- func LoadCertificateAsBase64(certPath string) (string, error)
- func LoadCertificates(certPath string) ([]*x509.Certificate, error)
- func LoadFileAsBase64(filePath string) (string, error)
- func NotExists(files ...string) bool
- func ValidateCA(certPath string, caCertPath string) bool
- func ValidateExpired(certPath string, caCertPath string, days int) bool
- func ValidateIssuer(child *x509.Certificate, issuer *x509.Certificate) bool
- func ValidateRSAKeyFile(keyFie string) bool
- func ValidateTLSPair(certPath string, keyPath string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCertKey ¶
func GenerateCertKey(regen bool, commonName string, organization []string, altNames *certutil.AltNames, extKeyUsage []x509.ExtKeyUsage, caCertPath, caKeyPath, certPath, keyPath string) (bool, error)
set regen=true to force gen new cert, CA certificate will be written as second certificate in $certPath
func GenerateClientCertKey ¶
func GenerateClientCertKey(regen bool, commonName string, organization []string, caCertPath, caKeyPath, certPath, keyPath string) (bool, error)
set regen=true to force gen new cert, CA certificate will be written as second certificate in $certPath
func GenerateServerCertKey ¶
func GenerateServerCertKey(regen bool, commonName string, organization []string, altNames *certutil.AltNames, caCertPath, caKeyPath, certPath, keyPath string) (bool, error)
set regen=true to force gen new cert, CA certificate will be written as second certificate in $certPath
func GenerateSigningCertKey ¶
write signing Certkey with `CN: {prefix}-ca@{time.Now().Unix()}` to certFile if keyFile valid, it will be use, or generate. if generate new ,then return (true,nil); or return (false,nil)
func LoadCertificate ¶
func LoadCertificate(certPath string) (*x509.Certificate, error)
func LoadCertificateAsBase64 ¶
func LoadCertificates ¶
func LoadCertificates(certPath string) ([]*x509.Certificate, error)
if client/server certificate generate by this package, return[0] is client/server certificate, return[1] is CA certificate
func LoadFileAsBase64 ¶
func ValidateCA ¶
validate if cert is valid to this ca
func ValidateExpired ¶
less than {days} days will be treat as exired
func ValidateIssuer ¶
func ValidateIssuer(child *x509.Certificate, issuer *x509.Certificate) bool
verifies that the signature on cert is a valid signature from issuer.
func ValidateRSAKeyFile ¶
func ValidateTLSPair ¶
check if certificate and key are one pair
Types ¶
This section is empty.