tls

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 20 Imported by: 0

README

tls

产生自签TLS证书

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertificateInfo

func CertificateInfo(certPath string) (*x509.Certificate, error)

func FormatIp

func FormatIp(ipStr string) (string, error)

func GenerateKey

func GenerateKey(root bool) (*rsa.PrivateKey, error)

func GenerateRoot

func GenerateRoot() (*x509.Certificate, *rsa.PrivateKey, error)

GenerateRoot return cert, privDER, nil

func IsIP

func IsIP(host string) bool

func IsIPv4

func IsIPv4(ip string) bool

func IsIPv6

func IsIPv6(ip string) bool

func IsSameIP

func IsSameIP(ipFirst, ipSecond string) bool

func Pkcs12Encode added in v1.3.2

func Pkcs12Encode(cert, key []byte, password string) (string, error)

func ReadPrivKey

func ReadPrivKey(key []byte) (*rsa.PrivateKey, error)

func ReadPrivKeyFile

func ReadPrivKeyFile(filename string) (*rsa.PrivateKey, error)

func ReadRootCert

func ReadRootCert(cert []byte) (*x509.Certificate, error)

func ReadRootCertFile

func ReadRootCertFile(filename string) (*x509.Certificate, error)

func WritePEM

func WritePEM(filepath string, pem []byte) error

Types

type CACert

type CACert struct {
	Cert *x509.Certificate
	Key  crypto.PrivateKey
}

func (*CACert) GenerateServer

func (c *CACert) GenerateServer(hosts []string) ([]byte, []byte, error)

GenerateServer return certPEM, privPEM, nil

Jump to

Keyboard shortcuts

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