readCAFile reads the CA cert file from disk.
(f string)
| 1002 | |
| 1003 | // readCAFile reads the CA cert file from disk. |
| 1004 | func readCAFile(f string) ([]byte, error) { |
| 1005 | data, err := os.ReadFile(f) |
| 1006 | if err != nil { |
| 1007 | return nil, fmt.Errorf("unable to load specified CA cert %s: %w", f, err) |
| 1008 | } |
| 1009 | return data, nil |
| 1010 | } |
| 1011 | |
| 1012 | // updateRootCA parses the given byte slice as a series of PEM encoded certificates and updates tls.Config.RootCAs. |
| 1013 | func updateRootCA(cfg *tls.Config, b []byte) bool { |