package common
import "go.dedis.ch/dela/crypto/common"
Package common implements the factories of the crypto primitives to allow the use of multiple algorithms over the same communication channel.
Documentation Last Review: 05.10.2020
Index ¶
- func RegisterAlgorithmFormat(c serde.Format, f serde.FormatEngine)
- type Algorithm
- func NewAlgorithm(name string) Algorithm
- func (alg Algorithm) GetName() string
- func (alg Algorithm) Serialize(ctx serde.Context) ([]byte, error)
- type PublicKeyFac
- func NewPublicKeyFactory() PublicKeyFac
- func (f PublicKeyFac) Deserialize(ctx serde.Context, data []byte) (serde.Message, error)
- func (f PublicKeyFac) PublicKeyOf(ctx serde.Context, data []byte) (crypto.PublicKey, error)
- func (f PublicKeyFac) RegisterAlgorithm(algo string, factory crypto.PublicKeyFactory)
- type PublicKeyFactory
- type SignatureFactory
- func NewSignatureFactory() SignatureFactory
- func (f SignatureFactory) Deserialize(ctx serde.Context, data []byte) (serde.Message, error)
- func (f SignatureFactory) RegisterAlgorithm(name string, factory crypto.SignatureFactory)
- func (f SignatureFactory) SignatureOf(ctx serde.Context, data []byte) (crypto.Signature, error)
Functions ¶
func RegisterAlgorithmFormat ¶
func RegisterAlgorithmFormat(c serde.Format, f serde.FormatEngine)
RegisterAlgorithmFormat registers the engine for the provided format.
Types ¶
type Algorithm ¶
type Algorithm struct {
// contains filtered or unexported fields
}
Algorithm contains information about a signature algorithm.
- implements serde.Message
func NewAlgorithm ¶
NewAlgorithm returns a new algorithm from the provided name.
func (Algorithm) GetName ¶
GetName returns the name of the algorithm.
func (Algorithm) Serialize ¶
Serialize implements serde.Message. It returns the serialized for the algorithm.
type PublicKeyFac ¶
type PublicKeyFac struct {
// contains filtered or unexported fields
}
PublicKeyFac is a public key factory for commonly known algorithms.
- implements common.PublicKeyFactory
func NewPublicKeyFactory ¶
func NewPublicKeyFactory() PublicKeyFac
NewPublicKeyFactory returns a new instance of the common public key factory.
func (PublicKeyFac) Deserialize ¶
Deserialize implements serde.Factory. It looks up the format and returns the public key of the data if appropriate, otherwise an error.
func (PublicKeyFac) PublicKeyOf ¶
PublicKeyOf implements crypto.PublicKeyFactory. It returns the public key of the data if appropriate, otherwise an error.
func (PublicKeyFac) RegisterAlgorithm ¶
func (f PublicKeyFac) RegisterAlgorithm(algo string, factory crypto.PublicKeyFactory)
RegisterAlgorithm registers the factory for the algorithm. It will override an already existing key.
type PublicKeyFactory ¶
type PublicKeyFactory interface { serde.Factory // PublicKeyOf returns the public key associated to the data if appropriate, // otherwise an error. PublicKeyOf(serde.Context, []byte) (crypto.PublicKey, error) }
PublicKeyFactory is a redefinition of the crypto public key factory to exclude some functions that are incompatible with the logic of a common factory which requires specific serialization.
type SignatureFactory ¶
type SignatureFactory struct {
// contains filtered or unexported fields
}
SignatureFactory is a factory for commonly known algorithms.
- implements crypto.SignatureFactory
func NewSignatureFactory ¶
func NewSignatureFactory() SignatureFactory
NewSignatureFactory returns a new instance of the common signature factory. It registers the BLS algorithm by default.
func (SignatureFactory) Deserialize ¶
Deserialize implements serde.Factory. It returns the signature associated to the data if appropriate, otherwise it returns an error.
func (SignatureFactory) RegisterAlgorithm ¶
func (f SignatureFactory) RegisterAlgorithm(name string, factory crypto.SignatureFactory)
RegisterAlgorithm register the factory for the algorithm.
func (SignatureFactory) SignatureOf ¶
SignatureOf implements crypto.SignatureFactory. It returns the signature associated to the data if appropriate, otherwise it returns an error.
Source Files ¶
common.go
Directories ¶
Path | Synopsis |
---|---|
crypto/common/json |
- Version
- v0.1.0 (latest)
- Published
- Apr 10, 2024
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 1 month ago –
Tools for package owners.