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 nil because
(certFile, keyFile string)
| 228 | // form a certificate chain. On successful return, Certificate.Leaf will |
| 229 | // be nil because the parsed form of the certificate is not retained. |
| 230 | func LoadX509KeyPair(certFile, keyFile string) (Certificate, error) { |
| 231 | certPEMBlock, err := os.ReadFile(certFile) |
| 232 | if err != nil { |
| 233 | return Certificate{}, err |
| 234 | } |
| 235 | keyPEMBlock, err := os.ReadFile(keyFile) |
| 236 | if err != nil { |
| 237 | return Certificate{}, err |
| 238 | } |
| 239 | return X509KeyPair(certPEMBlock, keyPEMBlock) |
| 240 | } |
| 241 | |
| 242 | // X509KeyPair parses a public/private key pair from a pair of |
| 243 | // PEM encoded data. On successful return, Certificate.Leaf will be nil because |
nothing calls this directly
no test coverage detected
searching dependent graphs…