FromP12File loads a PKCS#12 certificate from a local file and returns a tls.Certificate. Use "" as the password argument if the PKCS#12 certificate is not password protected.
(filename string, password string)
| 29 | // Use "" as the password argument if the PKCS#12 certificate is not password |
| 30 | // protected. |
| 31 | func FromP12File(filename string, password string) (tls.Certificate, error) { |
| 32 | p12bytes, err := os.ReadFile(filename) |
| 33 | if err != nil { |
| 34 | return tls.Certificate{}, err |
| 35 | } |
| 36 | return FromP12Bytes(p12bytes, password) |
| 37 | } |
| 38 | |
| 39 | // FromP12Bytes loads a PKCS#12 certificate from an in memory byte array and |
| 40 | // returns a tls.Certificate. |