signature

package
v0.0.0-...-682d07f Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetaData

type MetaData struct {
	keys.PublicKeyID
	//ValidSince defines the time from which on this signature is valid. ValidSince is represented as seconds since the UNIX epoch UTC.
	ValidSince int64
	//ValidUntil defines the time after which this signature is not valid anymore. ValidUntil is represented as seconds since the UNIX epoch UTC.
	ValidUntil int64
}

MetaData contains meta data of the signature

func (MetaData) String

func (sig MetaData) String() string

type Sig

type Sig struct {
	keys.PublicKeyID
	//ValidSince defines the time from which on this signature is valid. ValidSince is represented as seconds since the UNIX epoch UTC.
	ValidSince int64
	//ValidUntil defines the time after which this signature is not valid anymore. ValidUntil is represented as seconds since the UNIX epoch UTC.
	ValidUntil int64
	//Data holds the signature data
	Data interface{}
	// contains filtered or unexported fields
}

Sig contains meta data of the signature and the signature data itself.

func (Sig) MarshalCBOR

func (sig Sig) MarshalCBOR(w *cbor.CBORWriter) error

MarshalCBOR implements a CBORMarshaler.

func (Sig) MetaData

func (sig Sig) MetaData() MetaData

MetaData returns the signatures metaData

func (*Sig) SignData

func (sig *Sig) SignData(privateKey interface{}, encoding []byte) error

SignData adds signature meta data to encoding. It then signs the encoding with privateKey and updates sig.Data field with the generated signature In case of an error an error is returned indicating the cause, otherwise nil is returned

func (Sig) String

func (sig Sig) String() string

String implements Stringer interface

func (*Sig) UnmarshalArray

func (sig *Sig) UnmarshalArray(in []interface{}) error

UnmarshalArray takes in a CBOR decoded aray and populates Sig.

func (*Sig) VerifySignature

func (sig *Sig) VerifySignature(publicKey interface{}, encoding []byte) bool

VerifySignature adds signature meta data to the encoding. It then signs the encoding with privateKey and compares the resulting signature with the sig.Data. Returns true if there exist signatures and they are identical

Jump to

Keyboard shortcuts

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