syncthing: github.com/syncthing/syncthing/lib/signature Index | Files

package signature

import "github.com/syncthing/syncthing/lib/signature"

Package signature provides simple methods to create and verify signatures in PEM format.

Index

Package Files

signature.go

func GenerateKeys Uses

func GenerateKeys() (privKey []byte, pubKey []byte, err error)

GenerateKeys returns a new key pair, with the private and public key encoded in PEM format.

func Sign Uses

func Sign(privKeyPEM []byte, data io.Reader) ([]byte, error)

Sign computes the hash of data and signs it with the private key, returning a signature in PEM format.

func Verify Uses

func Verify(pubKeyPEM []byte, signature []byte, data io.Reader) error

Verify computes the hash of data and compares it to the signature using the given public key. Returns nil if the signature is correct.

Package signature imports 11 packages (graph) and is imported by 4 packages. Updated 2017-10-07. Refresh now. Tools for package owners.