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)
| 705 | // discarded. This behavior can be re-enabled by setting "x509keypairleaf=0" |
| 706 | // in the GODEBUG environment variable. |
| 707 | func 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. |
nothing calls this directly
no test coverage detected
searching dependent graphs…