Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCertificate ¶
GenerateCertificate generates an unsigned certificate with a random key pair.
If duration <= 0, then duration is assigned 365 days.
func SignCertificate ¶
SignCertificate uses a parent certificate to sign the given certificate.
To self-sign a certificate pass parentCertFile == "". The behavior is undefined if certFile and parentCertFile point to the same file in the file system.
func UpgradeListener ¶
func UpgradeListener(l net.Listener, u *ConnUpgrader) net.Listener
UpgradeListener upgrades a net.Listener for Accept()ing secure connections.
Types ¶
type ConnUpgrader ¶
type ConnUpgrader struct {
// contains filtered or unexported fields
}
ConnUpgrader provides an interface for upgrading insecure connections into secure ones.
func NewConnUpgrader ¶
func NewConnUpgrader( trustedCertFiles []string, certFile, keyFile string, handshakeReadTimeout time.Duration, ) (*ConnUpgrader, error)
NewConnUpgrader loads the trusted root certificates for authenticating peers and a (cert, key) pair of files for self-authentication and returns a factory for upgrading insecure connections into secure ones.
If an empty set of trusted root certificates is passed, any certificate chain with all signatures valid will be trusted.
If handshakeReadTimeout <= 0, then reading handshake messages will not timeout.