pdclcrypto

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package pdclcrypto provides storage signing wrappers and tools for parsing cryptographic keys.

Index

Constants

This section is empty.

Variables

View Source
var (
	// VerificationErr indicates that there was an error during message verification.
	//  It is deliberately vague to avoid adaptive attacks.
	VerificationErr = errors.New("message not verified successfully")

	SignerNotInRegistry = errors.New("signer not found in registry")
)

Functions

func LoadFromPKCSFromPEMFile

func LoadFromPKCSFromPEMFile(privKeyPath string) (crypto.PrivateKey, error)

func ParsePKCSKeyFromPEM

func ParsePKCSKeyFromPEM(pemContent []byte) (crypto.PrivateKey, error)

Types

type MemorySignerRegistry

type MemorySignerRegistry map[string]crypto.PublicKey

func (MemorySignerRegistry) Get

func (m MemorySignerRegistry) Get(signerID string) crypto.PublicKey

type SignedMessageUnwrapper

type SignedMessageUnwrapper struct {
	// contains filtered or unexported fields
}

SignedMessageUnwrapper is a decorator on top of MessageReader that unwraps message from signed envelope. It does not verify signature.

func NewSignedMessageUnwrapper

func NewSignedMessageUnwrapper(base storage.MessageReader, decoder storage.Decoder) *SignedMessageUnwrapper

func (*SignedMessageUnwrapper) Read

func (s *SignedMessageUnwrapper) Read(ctx context.Context, cid cid.Cid) (storage.ProtoDecodable, error)

type SignedMessageVerifyReader

type SignedMessageVerifyReader struct {
	// contains filtered or unexported fields
}

func NewSignedMessageVerifyReader

func NewSignedMessageVerifyReader(base storage.MessageReader, decoder storage.Decoder, registry SignerRegistry) *SignedMessageVerifyReader

func (*SignedMessageVerifyReader) Read

type SignedMessageWriter

type SignedMessageWriter struct {
	// contains filtered or unexported fields
}

SignedMessageWriter is a decorator on top of MessageWriter that puts every message into a signed envelope.

func NewSignedMessageWriter

func NewSignedMessageWriter(base storage.MessageWriter, codec storage.Codec, signerID string, signer crypto.Signer) *SignedMessageWriter

func (*SignedMessageWriter) Write

func (s *SignedMessageWriter) Write(ctx context.Context, message proto.Message) (cid.Cid, error)

type SignerRegistry

type SignerRegistry interface {
	Get(signerID string) crypto.PublicKey
}

Jump to

Keyboard shortcuts

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