mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-22 13:50:49 +01:00
feat: specific error if certificate is invalid
This commit is contained in:
parent
4b60557518
commit
79f22fb722
1 changed files with 4 additions and 1 deletions
5
sime.go
5
sime.go
|
@ -16,6 +16,9 @@ var (
|
||||||
// ErrInvalidKeyPair should be used if key pair is invalid
|
// ErrInvalidKeyPair should be used if key pair is invalid
|
||||||
ErrInvalidKeyPair = errors.New("invalid key pair")
|
ErrInvalidKeyPair = errors.New("invalid key pair")
|
||||||
|
|
||||||
|
// ErrInvalidCertificate should be used if a certificate is invalid
|
||||||
|
ErrInvalidCertificate = errors.New("invalid certificate")
|
||||||
|
|
||||||
// ErrCouldNotInitialize should be used if the signed data could not initialize
|
// ErrCouldNotInitialize should be used if the signed data could not initialize
|
||||||
ErrCouldNotInitialize = errors.New("could not initialize signed data")
|
ErrCouldNotInitialize = errors.New("could not initialize signed data")
|
||||||
|
|
||||||
|
@ -46,7 +49,7 @@ func newSMime(keyPair *tls.Certificate) (*SMime, error) {
|
||||||
for _, cert := range keyPair.Certificate[1:] {
|
for _, cert := range keyPair.Certificate[1:] {
|
||||||
c, err := x509.ParseCertificate(cert)
|
c, err := x509.ParseCertificate(cert)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, ErrInvalidCertificate
|
||||||
}
|
}
|
||||||
parentCertificates = append(parentCertificates, c)
|
parentCertificates = append(parentCertificates, c)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue