LoadClientCertificate load key/certificate from pem files
(certFile string, keyFile string)
| 509 | |
| 510 | // LoadClientCertificate load key/certificate from pem files |
| 511 | func LoadClientCertificate(certFile string, keyFile string) (*tls.Certificate, error) { |
| 512 | if certFile != "" && keyFile != "" { |
| 513 | cert, err := tls.LoadX509KeyPair(certFile, keyFile) |
| 514 | if err != nil { |
| 515 | log.Criticalf("Unable to read client certificate from file: %s or key from file: %s", certFile, keyFile) |
| 516 | return nil, err |
| 517 | } |
| 518 | log.Debug("Client certificate loaded ") |
| 519 | return &cert, nil |
| 520 | } |
| 521 | return nil, nil |
| 522 | } |
| 523 | |
| 524 | // CreateTLSConfig creates a tls.Config object from certs and roots |
| 525 | func CreateTLSConfig(remoteCAs *x509.CertPool, cert *tls.Certificate) *tls.Config { |
searching dependent graphs…