2024-09-18 14:13:24 +02:00
|
|
|
package mail
|
|
|
|
|
|
|
|
import (
|
2024-09-26 16:43:58 +02:00
|
|
|
"crypto/tls"
|
2024-09-26 17:08:38 +02:00
|
|
|
"crypto/x509"
|
2024-09-18 14:13:24 +02:00
|
|
|
)
|
|
|
|
|
2024-09-26 16:43:58 +02:00
|
|
|
const (
|
2024-09-26 17:08:38 +02:00
|
|
|
certFilePath = "dummy-chain-cert.pem"
|
|
|
|
keyFilePath = "dummy-child-key.pem"
|
2024-09-26 16:43:58 +02:00
|
|
|
)
|
2024-09-18 14:13:24 +02:00
|
|
|
|
2024-09-26 16:43:58 +02:00
|
|
|
func getDummyCertificate() (*tls.Certificate, error) {
|
|
|
|
keyPair, err := tls.LoadX509KeyPair(certFilePath, keyFilePath)
|
2024-09-18 14:13:24 +02:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2024-09-26 17:08:38 +02:00
|
|
|
keyPair.Leaf, err = x509.ParseCertificate(keyPair.Certificate[0])
|
|
|
|
|
2024-09-26 16:43:58 +02:00
|
|
|
return &keyPair, nil
|
2024-09-18 14:13:24 +02:00
|
|
|
}
|