func (u *Update) VerifySignatureWithPEM(publicKeyPEM []byte) (*Update, error) {
	block, _ := pem.Decode(publicKeyPEM)
	if block == nil {
		return u, fmt.Errorf("Couldn't parse PEM data")
	}
	pub, err := x509.ParsePKIXPublicKey(block.Bytes)
	if err != nil {
		return u, err
	}
	var ok bool
	u.PublicKey, ok = pub.(*rsa.PublicKey)
	if !ok {
		return u, fmt.Errorf("Public key isn't an RSA public key")
	}
	return u, nil
}
VerifySignatureWithPEM configures the update to use the given PEM-formatted
RSA public key to verify the update's signature. You must also call
VerifySignature() with a signature to check.

A PEM formatted public key typically begins with
-----BEGIN PUBLIC KEY-----
package update
import (
	"github.com/kardianos/osext"
	"bytes"
	"crypto"
	"crypto/rsa"
	"crypto/sha256"
	_ "crypto/sha512"  
	"crypto/x509"
	"encoding/pem"
	"fmt"
	"github.com/getlantern/go-update/download"
	"github.com/kr/binarydist"
	"io"
	"io/ioutil"
	"net/http"
	"os"
	"path/filepath"
)
type PatchType string
const (
	PATCHTYPE_BSDIFF PatchType = "bsdiff"
	PATCHTYPE_NONE             = ""
)
var HTTPClient = &http.Client{}
type Update struct {
	TargetPath string
	PatchType
	Checksum []byte
	PublicKey *rsa.PublicKey
	Signature []byte
}
func (u *Update) getPath() (string, error) {
	if u.TargetPath == "" {
		return osext.Executable()
	} else {
		return u.TargetPath, nil
	}
}
func New() *Update {
	return &Update{
		TargetPath: "",
		PatchType:  PATCHTYPE_NONE,
	}
}
func (u *Update) Target(path string) *Update {
	u.TargetPath = path
	return u
}
func (u *Update) ApplyPatch(patchType PatchType) *Update {
	u.PatchType = patchType
	return u
}
func (u *Update) VerifyChecksum(checksum []byte) *Update {
	u.Checksum = checksum
	return u
}
func (u *Update) VerifySignature(signature []byte) *Update {
	u.Signature = signature
	return u
}
func (u *Update) VerifySignatureWith(publicKey *rsa.PublicKey) *Update {
	u.PublicKey = publicKey
	return u
}