Andres Erbsen 2cf1158195 readme
2015-08-18 12:24:19 -07:00
2015-04-29 17:38:27 +02:00
2015-08-18 12:21:46 -07:00
2015-08-18 12:09:42 -07:00
2015-08-18 11:48:00 -07:00
2015-08-18 11:48:00 -07:00
2015-04-29 17:38:27 +02:00
2015-08-18 12:09:42 -07:00
2015-08-18 12:24:19 -07:00
2015-05-11 07:54:13 +02:00

go-dkim

Fork of toorop's DKIM with non-pointer API and bugfixes.

GoDoc

Getting started

Install

 	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.

Sign email

import (
	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 )	
	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..
}

Verify

import (
	dkim "github.com/toorop/go-dkim"
)

func main(){
	// email is the email to verify (byte slice)
	_, err := Verify(email, nil, nil)
}

Todo

  • handle z tag (copied header fields used for diagnostic use)
  • handle multiple dns records
Description
No description provided
Readme MIT 96 KiB
Languages
Go 100%