mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
upgrade go-dkim
This commit is contained in:
parent
008416e4dd
commit
4f9d406b93
4 changed files with 15 additions and 6 deletions
15
vendor/github.com/toorop/go-dkim/dkim.go
generated
vendored
15
vendor/github.com/toorop/go-dkim/dkim.go
generated
vendored
|
|
@ -100,6 +100,7 @@ func NewSigOptions() SigOptions {
|
|||
// Sign signs an email
|
||||
func Sign(email *[]byte, options SigOptions) error {
|
||||
var privateKey *rsa.PrivateKey
|
||||
var err error
|
||||
|
||||
// PrivateKey
|
||||
if len(options.PrivateKey) == 0 {
|
||||
|
|
@ -109,11 +110,17 @@ func Sign(email *[]byte, options SigOptions) error {
|
|||
if d == nil {
|
||||
return ErrCandNotParsePrivateKey
|
||||
}
|
||||
key, err := x509.ParsePKCS1PrivateKey(d.Bytes)
|
||||
if err != nil {
|
||||
return ErrCandNotParsePrivateKey
|
||||
|
||||
// try to parse it as PKCS1 otherwise try PKCS8
|
||||
if key, err := x509.ParsePKCS1PrivateKey(d.Bytes); err != nil {
|
||||
if key, err := x509.ParsePKCS8PrivateKey(d.Bytes); err != nil {
|
||||
return ErrCandNotParsePrivateKey
|
||||
} else {
|
||||
privateKey = key.(*rsa.PrivateKey)
|
||||
}
|
||||
} else {
|
||||
privateKey = key
|
||||
}
|
||||
privateKey = key
|
||||
|
||||
// Domain required
|
||||
if options.Domain == "" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue