https://github.com/toorop/go-dkim
DKIM package for golang
https://github.com/toorop/go-dkim
Last synced: 8 months ago
JSON representation
DKIM package for golang
- Host: GitHub
- URL: https://github.com/toorop/go-dkim
- Owner: toorop
- License: mit
- Created: 2015-04-29T15:38:27.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-01-03T09:29:56.000Z (almost 2 years ago)
- Last Synced: 2024-10-25T04:10:11.947Z (about 1 year ago)
- Language: Go
- Size: 61.5 KB
- Stars: 98
- Watchers: 6
- Forks: 39
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go-cn - go-dkim - dkim) (电子邮件 / 检索及分析资料库)
- awesome-go-plus - go-dkim - DKIM library, to sign & verify email.  (Email / Search and Analytic Databases)
- awesome-go - go-dkim - DKIM library, to sign & verify email. (Email / Search and Analytic Databases)
- fucking-awesome-go - :octocat: go-dkim - A DKIM library, to sign & verify email. :star: 16 :fork_and_knife: 5 (Email / Advanced Console UIs)
- fucking-awesome-go - go-dkim - DKIM library, to sign & verify email. (Email / Search and Analytic Databases)
- awesome-go - go-dkim - | - | - | (Email / Advanced Console UIs)
- awesome-go - go-dkim - DKIM library, to sign & verify email. - :arrow_down:9 - :star:20 (Email / Advanced Console UIs)
- awesome-go - go-dkim - DKIM package for golang - ★ 45 (Email)
- awesome-go - go-dkim - DKIM library, to sign & verify email. (Email / Search and Analytic Databases)
- awesome-go - go-dkim - DKIM library, to sign & verify email. (Email / Search and Analytic Databases)
- awesome-go-cn - go-dkim - dkim) (电子邮件 / 检索及分析资料库)
- awesome-go-cn - go-dkim
- awesome-go - go-dkim - DKIM library, to sign & verify email. (Email / Search and Analytic Databases)
- awesome-go-extra - go-dkim - 04-29T15:38:27Z|2020-11-03T13:16:31Z| (Email / Advanced Console UIs)
- awesome-go - go-dkim - DKIM库,签署和验证电子邮件。 (<span id="电子邮件-email">电子邮件 Email</span> / <span id="高级控制台用户界面-advanced-console-uis">高级控制台用户界面 Advanced Console UIs</span>)
- awesome-go-cn - go-dkim
- awesome-go - go-dkim - DKIM library, to sign & verify email. (Email / Advanced Console UIs)
- awesome-go-with-stars - go-dkim - DKIM library, to sign & verify email. (Email / Search and Analytic Databases)
- awesome-go - toorop/go-dkim
- awesome-go - go-dkim - DKIM library, to sign & verify email. (Email / Search and Analytic Databases)
- awesome-Char - go-dkim - DKIM library, to sign & verify email. (Email / Advanced Console UIs)
- awesome-go - go-dkim - DKIM library, to sign & verify email. (Email / Advanced Console UIs)
README
# go-dkim
DKIM package for Golang
[](https://godoc.org/github.com/toorop/go-dkim)
## Getting started
### Install
```
go get github.com/toorop/go-dkim
```
Warning: you need to use Go 1.4.2-master or 1.4.3 (when it will be available)
see https://github.com/golang/go/issues/10482 fro more info.
### Sign email
```go
import (
dkim "github.com/toorop/go-dkim"
)
func main(){
// email is the email to sign (byte slice)
// privateKey the private key (pem encoded, byte slice )
options := dkim.NewSigOptions()
options.PrivateKey = privateKey
options.Domain = "mydomain.tld"
options.Selector = "myselector"
options.SignatureExpireIn = 3600
options.BodyLength = 50
options.Headers = []string{"from", "date", "mime-version", "received", "received"}
options.AddSignatureTimestamp = true
options.Canonicalization = "relaxed/relaxed"
err := dkim.Sign(&email, options)
// handle err..
// And... that's it, 'email' is signed ! Amazing© !!!
}
```
### Verify
```go
import (
dkim "github.com/toorop/go-dkim"
)
func main(){
// email is the email to verify (byte slice)
status, err := Verify(&email)
// handle status, err (see godoc for status)
}
```
## Todo
- [ ] handle z tag (copied header fields used for diagnostic use)