Conflicts:
	dkim.go
	dkim_test.go
	pubKeyRep.go
This commit is contained in:
Dolf Schimmel (Freeaqingme)
2016-07-19 21:41:17 +02:00
6 changed files with 241 additions and 160 deletions

View File

@@ -1,13 +1,14 @@
# go-dkim
DKIM package for Golang
[![GoDoc](https://godoc.org/github.com/toorop/go-dkim?status.svg)](https://godoc.org/github.com/toorop/go-dkim)
Fork of `toorop`'s DKIM with non-pointer API and bugfixes.
[![GoDoc](https://godoc.org/github.com/andres-erbsen/go-dkim?status.svg)](https://godoc.org/github.com/andres-erbsen/go-dkim)
## Getting started
### Install
```
go get github.com/toorop/go-dkim
go get github.com/andres-erbsen/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.
@@ -16,12 +17,13 @@ see https://github.com/golang/go/issues/10482 fro more info.
```go
import (
dkim "github.com/toorop/go-dkim"
dkim "github.com/andres-erbsen/go-dkim"
)
func main(){
// email is the email to sign (byte slice)
// privateKey the private key (pem encoded, byte slice )
// privateKey the private key (pem encoded, byte slice )
dkim := dkim.NewDkim()
options := dkim.NewSigOptions()
options.PrivateKey = privateKey
options.Domain = "mydomain.tld"
@@ -33,8 +35,6 @@ func main(){
options.Canonicalization = "relaxed/relaxed"
err := dkim.Sign(&email, options)
// handle err..
// And... that's it, 'email' is signed ! Amazing© !!!
}
```
@@ -46,11 +46,12 @@ import (
func main(){
// email is the email to verify (byte slice)
status, err := Verify(&email)
// handle status, err (see godoc for status)
dkim := dkim.NewDkim()
_, err := dkim.Verify(email)
}
```
## Todo
- [ ] handle z tag (copied header fields used for diagnostic use)
- [ ] handle multiple dns records