types

package
v0.0.0-...-30b4a77 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2016 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package types implements types shared between client and server(s).

Index

Constants

View Source
const (
	// CallTypeReissue identifies a Reissue call.
	CallTypeReissue = iota
	// CallTypeSpend identifies a Spend call.
	CallTypeSpend
)

Variables

View Source
var (
	// ErrSignerNeeded signals that a packet verification failed because no
	// public key was present but the packet was signed.
	ErrSignerNeeded = errors.New("types: signer needed for verification")
	// ErrBadSignature signals that a packet signature did not verify.
	ErrBadSignature = errors.New("types: bad signature")
	// ErrWrongSigner signals that the signer to be verified is not the signer
	// of the packet.
	ErrWrongSigner = errors.New("types: wrong signer")
)

Functions

func UnmarshalParams

func UnmarshalParams(d []byte) (pubKey *signkeys.PublicKey, pubParams *jjm.BlindingParamClient, privateParams []byte, canReissue bool, err error)

UnmarshalParams converts the output of GetParams into usable types.

Types

type Backend

type Backend struct {
	Type  string
	Value interface{}
}

Backend describes a backend. Type is filename/dburl, Value is the content itself.

type Params

type Params struct {
	PublicKey     []byte
	PublicParams  jjm.BlindingParamClient
	PrivateParams []byte
	CanReissue    bool
}

Params contains the public parameters, encrypted private parameters, and PublicKey.

func (Params) Marshal

func (p Params) Marshal() ([]byte, error)

Marshal a parameter set.

type ReissuePacket

type ReissuePacket struct {
	CallType   int32
	Token      []byte // The old token
	BlindToken []byte // The new token (blind)
	Params     []byte // The server-supplied blinding parameters
	Signature  []byte // Signature by owner of Token (or 0x00 if no owner)
}

ReissuePacket is a packet sent to the service guard to reissue a token.

func (ReissuePacket) Hash

func (p ReissuePacket) Hash() [sha256.Size]byte

Hash returns the hash of the packet excluding Signature.

func (ReissuePacket) Image

func (p ReissuePacket) Image() []byte

Image returns the signature image for a packet. The image are the hashes of the entries, appened. This allows proof from journal without recording too much data.

func (ReissuePacket) Marshal

func (p ReissuePacket) Marshal() ([]byte, error)

Marshal the packet into a byte slice.

func (*ReissuePacket) Sign

func (p *ReissuePacket) Sign(privkey *[ed25519.PrivateKeySize]byte)

Sign a ReissuePacket.

func (*ReissuePacket) Unmarshal

func (p *ReissuePacket) Unmarshal(d []byte) (*ReissuePacket, error)

Unmarshal a byte slice into a packet.

func (ReissuePacket) Verify

func (p ReissuePacket) Verify(pubkey *[ed25519.PublicKeySize]byte) error

Verify a packet signature using pubkey.

type ReissuePacketPrivate

type ReissuePacketPrivate struct {
	PublicKey   []byte // The public key of the issuer as contained in params.
	Factors     []byte // The blinding factors. Needed for unblinding after signature.
	Token       []byte // The token. Needed for reconstruction after signature.
	RequestHash []byte // The hash of the ReissuePacket (as returned by p.Hash()). Used in caching.
	Request     []byte // The content of the request. Used in caching.
	CanReissue  bool   // Will a further reissue be possible?
}

ReissuePacketPrivate contains the private elements of a reissue request.

func (ReissuePacketPrivate) Marshal

func (r ReissuePacketPrivate) Marshal() ([]byte, error)

Marshal struct into []byte.

func (*ReissuePacketPrivate) Unmarshal

func (r *ReissuePacketPrivate) Unmarshal(d []byte) (*ReissuePacketPrivate, error)

Unmarshal []byte into ReissuePacketPrivate.

type SpendPacket

type SpendPacket struct {
	CallType  int32
	Token     []byte // The old token
	Signature []byte // Signature by owner of Token (or 0x00 if no owner)
}

SpendPacket is a packet for issuing a spend call.

func (*SpendPacket) Image

func (s *SpendPacket) Image() []byte

Image returns the image of the SpendPacket for signing.

func (SpendPacket) Marshal

func (s SpendPacket) Marshal() ([]byte, error)

Marshal struct into []byte.

func (*SpendPacket) Sign

func (s *SpendPacket) Sign(privkey *[ed25519.PrivateKeySize]byte)

Sign a SpendPacket.

func (*SpendPacket) Unmarshal

func (s *SpendPacket) Unmarshal(d []byte) (*SpendPacket, error)

Unmarshal []byte into SpendPacket.

func (*SpendPacket) Verify

func (s *SpendPacket) Verify(pubkey *[ed25519.PublicKeySize]byte) error

Verify a SpendPacket.

Jump to

Keyboard shortcuts

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