Documentation ¶
Overview ¶
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 ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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.
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.