signature

package
v3.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SignatureSize is the size, in bytes, of signatures generated and verified by this package.
	SignatureSize = 64
)

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey() (publicKey, privateKey string)

GenerateKey generates a public/private key pair using entropy from rand. the keys is encoded by base64.RawURLEncoding

func Sign

func Sign(secretKey, message []byte) (sig []byte)

Sign - sign a message with Hmac sha3 512.

func SignPrivate

func SignPrivate(privateKey, message []byte) (sig []byte)

SignPrivate - sign a message with public-key signature ed25519

func Verify

func Verify(secretKey, message, sig []byte) bool

Verify - verify message for Sign

func VerifyPublic

func VerifyPublic(publicKey, message, sig []byte) bool

VerifyPublic - verify message for SignPrivate

Types

type KeyPair

type KeyPair struct {
	// contains filtered or unexported fields
}

KeyPair - struct for Sign and Verify with ed25519

func KeyPairFrom

func KeyPairFrom(publicKey string, privateKey ...string) (*KeyPair, error)

KeyPairFrom converts key encoded by base64.RawURLEncoding to KeyPair. privateKey is used for sign, publicKey is used for verify. if privateKey omits, sign method can't be used.

func (*KeyPair) Sign

func (k *KeyPair) Sign(message []byte) (sig []byte)

Sign - sign a message with public-key signature ed25519

func (*KeyPair) Verify

func (k *KeyPair) Verify(message, sig []byte) bool

Verify - verify message for Sign

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL