sig

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Verify

func Verify(message []byte, bundle Bundle) bool

Verify takes a message and a signature Bundle and attempts to verify the bundle based on bundle's implemented Alg, the sig, and the pubkey. Verify returns a simple true or false.

func VerifyNaclSign

func VerifyNaclSign(msg []byte, b Bundle) bool

VerifyNaclSign takes a message and a Bundle and bool indicating if the message is verified ny the signature.

func VerifyXMSS10

func VerifyXMSS10(msg []byte, b Bundle) bool

VerifyXMSS10 takes a message and a Bundle and bool indicating if the message is verified ny the signature.

Types

type Alg

type Alg int32

Alg type is used for setting the Algorithm in a Signature Set

const (

	// AlgNaClSign is meant for Nacl Sign implementations
	AlgNaClSign Alg
	// AlgXMSS10 is meant for xmss sha2_10_256
	AlgXMSS10
)

type Bundle

type Bundle struct {
	Alg Alg
	Pub []byte
	Sig []byte
}

Bundle is used to encapsulate an Algorithm implementation, A Public Key, and a Signature. A Bundle is designed to be used to verify the integrity of the Payload.

type NaClSign

type NaClSign struct {
	PrivateKey [64]byte
}

NaClSign holds a pointer to a 64 byte array used by NaCl Sign. It implements the Signer interface.

func GenNaclSign

func GenNaclSign() *NaClSign

GenNaclSign returns a randomly generated ed25519 private key in a NaClSign

func NewNaClSign

func NewNaClSign(privateKey []byte) *NaClSign

NewNaClSign takes a ed25519 private key as a byte array and returns a NaClSign

func (*NaClSign) Sign

func (s *NaClSign) Sign(message []byte) (Bundle, error)

Sign takes a message and returns a Bundle signed with a private key using NaCl Sign.

type Signer

type Signer interface {
	Sign(message []byte) (Bundle, error)
}

Signer is an interface for signing messages and generating a SigSet.

type XMSS10

type XMSS10 struct {
	PrivateKey [132]byte
	// contains filtered or unexported fields
}

XMSS10 holds a pointer to a 132 byte array used by XMSS. It implements the Signer interface.

func GenXMSS10

func GenXMSS10() *XMSS10

GenXMSS10 returns a randomly generated XMSS SHA2_10_256 private key in a NaClSign

func NewXMSS10

func NewXMSS10(privateKey []byte) *XMSS10

NewXMSS10 takes an XMSS private key as a byte array and returns a NaClSign

func (*XMSS10) Sign

func (s *XMSS10) Sign(message []byte) (Bundle, error)

Sign takes a message and returns a Bundle signed with a private key using XMSS SHA2_10_256.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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