signing

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: AGPL-3.0 Imports: 9 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(ctx context.Context, order *pb.Order) (_ []byte, err error)

EncodeOrder encodes order into bytes for signing. Removes signature from serialized order.

func EncodeOrderLimit

func EncodeOrderLimit(ctx context.Context, limit *pb.OrderLimit) (_ []byte, err error)

EncodeOrderLimit encodes order limit into bytes for signing. Removes signature from serialized limit.

func EncodePieceHash

func EncodePieceHash(ctx context.Context, hash *pb.PieceHash) (_ []byte, err error)

EncodePieceHash encodes piece hash into bytes for signing. Removes signature from serialized hash.

func EncodeSegmentID

func EncodeSegmentID(ctx context.Context, segmentID *pb.SatSegmentID) (_ []byte, err error)

EncodeSegmentID encodes segment ID into bytes for signing.

func EncodeStreamID

func EncodeStreamID(ctx context.Context, streamID *pb.SatStreamID) (_ []byte, err error)

EncodeStreamID encodes stream ID into bytes for signing.

func EncodeVoucher

func EncodeVoucher(ctx context.Context, voucher *pb.Voucher) (_ []byte, err error)

EncodeVoucher encodes voucher into bytes for signing.

func SignOrderLimit

func SignOrderLimit(ctx context.Context, satellite Signer, unsigned *pb.OrderLimit) (_ *pb.OrderLimit, err error)

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

func SignPieceHash

func SignPieceHash(ctx context.Context, signer Signer, unsigned *pb.PieceHash) (_ *pb.PieceHash, err error)

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

func SignSegmentID

func SignSegmentID(ctx context.Context, signer Signer, unsigned *pb.SatSegmentID) (_ *pb.SatSegmentID, err error)

SignSegmentID signs the segment ID using the specified signer Signer is a satellite

func SignStreamID

func SignStreamID(ctx context.Context, signer Signer, unsigned *pb.SatStreamID) (_ *pb.SatStreamID, err error)

SignStreamID signs the stream ID using the specified signer Signer is a satellite

func SignUplinkOrder

func SignUplinkOrder(ctx context.Context, privateKey storj.PiecePrivateKey, unsigned *pb.Order) (_ *pb.Order, err error)

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

func SignUplinkPieceHash

func SignUplinkPieceHash(ctx context.Context, privateKey storj.PiecePrivateKey, unsigned *pb.PieceHash) (_ *pb.PieceHash, err error)

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

func SignVoucher

func SignVoucher(ctx context.Context, signer Signer, unsigned *pb.Voucher) (_ *pb.Voucher, err error)

SignVoucher signs the voucher using the specified signer Signer is a satellite

func VerifyOrderLimitSignature

func VerifyOrderLimitSignature(ctx context.Context, satellite Signee, signed *pb.OrderLimit) (err error)

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

func VerifyOrderSignature

func VerifyOrderSignature(ctx context.Context, uplink Signee, signed *pb.Order) (err error)

VerifyOrderSignature verifies that the signature inside order is valid and belongs to the uplink.

func VerifyPieceHashSignature

func VerifyPieceHashSignature(ctx context.Context, signee Signee, signed *pb.PieceHash) (err error)

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

func VerifySegmentID

func VerifySegmentID(ctx context.Context, satellite Signee, signed *pb.SatSegmentID) (err error)

VerifySegmentID verifies that the signature inside segment ID belongs to the satellite

func VerifyStreamID

func VerifyStreamID(ctx context.Context, satellite Signee, signed *pb.SatStreamID) (err error)

VerifyStreamID verifies that the signature inside stream ID belongs to the satellite

func VerifyUplinkOrderSignature

func VerifyUplinkOrderSignature(ctx context.Context, publicKey storj.PiecePublicKey, signed *pb.Order) (err error)

VerifyUplinkOrderSignature verifies that the signature inside order is valid and belongs to the uplink.

func VerifyUplinkPieceHashSignature

func VerifyUplinkPieceHashSignature(ctx context.Context, publicKey storj.PiecePublicKey, signed *pb.PieceHash) (err error)

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

func VerifyVoucher

func VerifyVoucher(ctx context.Context, satellite Signee, signed *pb.Voucher) (err error)

VerifyVoucher verifies that the signature inside voucher is valid and belongs to the satellite

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(ctx context.Context, data []byte) (_ []byte, err error)

HashAndSign hashes the data and signs with the used key.

func (*PrivateKey) HashAndVerifySignature

func (private *PrivateKey) HashAndVerifySignature(ctx context.Context, data, signature []byte) (err 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(ctx context.Context, data, signature []byte) (err 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(ctx context.Context, 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(ctx context.Context, data []byte) ([]byte, error)
	HashAndVerifySignature(ctx context.Context, 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