MCPcopy Create free account
hub / github.com/XTLS/REALITY / LoadX509KeyPair

Function LoadX509KeyPair

tls.go:707–717  ·  view source on GitHub ↗

LoadX509KeyPair reads and parses a public/private key pair from a pair of files. The files must contain PEM encoded data. The certificate file may contain intermediate certificates following the leaf certificate to form a certificate chain. On successful return, Certificate.Leaf will be populated.

(certFile, keyFile string)

Source from the content-addressed store, hash-verified

705// discarded. This behavior can be re-enabled by setting "x509keypairleaf=0"
706// in the GODEBUG environment variable.
707func LoadX509KeyPair(certFile, keyFile string) (Certificate, error) {
708 certPEMBlock, err := os.ReadFile(certFile)
709 if err != nil {
710 return Certificate{}, err
711 }
712 keyPEMBlock, err := os.ReadFile(keyFile)
713 if err != nil {
714 return Certificate{}, err
715 }
716 return X509KeyPair(certPEMBlock, keyPEMBlock)
717}
718
719// X509KeyPair parses a public/private key pair from a pair of
720// PEM encoded data. On successful return, Certificate.Leaf will be populated.

Callers

nothing calls this directly

Calls 1

X509KeyPairFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…