bugfix check returns of pem.Decode
This commit is contained in:
3
dkim.go
3
dkim.go
@@ -106,6 +106,9 @@ func Sign(email *[]byte, options SigOptions) error {
|
|||||||
return ErrSignPrivateKeyRequired
|
return ErrSignPrivateKeyRequired
|
||||||
}
|
}
|
||||||
d, _ := pem.Decode(options.PrivateKey)
|
d, _ := pem.Decode(options.PrivateKey)
|
||||||
|
if d == nil {
|
||||||
|
return ErrCandNotParsePrivateKey
|
||||||
|
}
|
||||||
key, err := x509.ParsePKCS1PrivateKey(d.Bytes)
|
key, err := x509.ParsePKCS1PrivateKey(d.Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ErrCandNotParsePrivateKey
|
return ErrCandNotParsePrivateKey
|
||||||
|
|||||||
Reference in New Issue
Block a user