signing

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2019 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Error = errs.Class("signing")

Error is the default error class for signing package.

Functions

func EncodeOrder

func EncodeOrder(order *pb.Order2) ([]byte, error)

EncodeOrder encodes order into bytes for signing.

func EncodeOrderLimit

func EncodeOrderLimit(limit *pb.OrderLimit2) ([]byte, error)

EncodeOrderLimit encodes order limit into bytes for signing.

func EncodePieceHash

func EncodePieceHash(hash *pb.PieceHash) ([]byte, error)

EncodePieceHash encodes piece hash into bytes for signing.

func SignOrder

func SignOrder(uplink Signer, unsigned *pb.Order2) (*pb.Order2, error)

SignOrder signs the order using the specified signer. Signer is an uplink.

func SignOrderLimit

func SignOrderLimit(satellite Signer, unsigned *pb.OrderLimit2) (*pb.OrderLimit2, error)

SignOrderLimit signs the order limit using the specified signer. Signer is a satellite.

func SignPieceHash

func SignPieceHash(signer Signer, unsigned *pb.PieceHash) (*pb.PieceHash, error)

SignPieceHash signs the piece hash using the specified signer. Signer is either uplink or storage node.

func VerifyOrderLimitSignature

func VerifyOrderLimitSignature(satellite Signee, signed *pb.OrderLimit2) error

VerifyOrderLimitSignature verifies that the signature inside order limit belongs to the satellite.

func VerifyOrderSignature

func VerifyOrderSignature(uplink Signee, signed *pb.Order2) error

VerifyOrderSignature verifies that the signature inside order belongs to the uplink.

func VerifyPieceHashSignature

func VerifyPieceHashSignature(signee Signee, signed *pb.PieceHash) error

VerifyPieceHashSignature verifies that the signature inside piece hash belongs to the signer, which is either uplink or storage node.

Types

type PrivateKey

type PrivateKey struct {
	Self storj.NodeID
	Key  crypto.PrivateKey
}

PrivateKey implements a signer and signee using a crypto.PrivateKey.

func (*PrivateKey) HashAndSign

func (private *PrivateKey) HashAndSign(data []byte) ([]byte, error)

HashAndSign hashes the data and signs with the used key.

func (*PrivateKey) HashAndVerifySignature

func (private *PrivateKey) HashAndVerifySignature(data, signature []byte) error

HashAndVerifySignature hashes the data and verifies that the signature belongs to the PrivateKey.

func (*PrivateKey) ID

func (private *PrivateKey) ID() storj.NodeID

ID returns node id associated with PrivateKey.

type PublicKey

type PublicKey struct {
	Self storj.NodeID
	Key  crypto.PublicKey
}

PublicKey implements a signee using crypto.PublicKey.

func (*PublicKey) HashAndVerifySignature

func (public *PublicKey) HashAndVerifySignature(data, signature []byte) error

HashAndVerifySignature hashes the data and verifies that the signature belongs to the PublicKey.

func (*PublicKey) ID

func (public *PublicKey) ID() storj.NodeID

ID returns node id associated with this PublicKey.

type Signee

type Signee interface {
	ID() storj.NodeID
	HashAndVerifySignature(data, signature []byte) error
}

Signee is able to verify that the data signature belongs to the signee.

func SigneeFromPeerIdentity

func SigneeFromPeerIdentity(identity *identity.PeerIdentity) Signee

SigneeFromPeerIdentity returns signee based on peer identity.

type Signer

type Signer interface {
	ID() storj.NodeID
	HashAndSign(data []byte) ([]byte, error)
	HashAndVerifySignature(data, signature []byte) error
}

Signer is able to sign data and verify own signature belongs.

func SignerFromFullIdentity

func SignerFromFullIdentity(identity *identity.FullIdentity) Signer

SignerFromFullIdentity returns signer based on full identity.

Jump to

Keyboard shortcuts

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