Documentation ¶
Index ¶
- type KeyGenStub
- func (keyGen *KeyGenStub) CheckPublicKeyValid(b []byte) error
- func (keyGen *KeyGenStub) GeneratePair() (crypto.PrivateKey, crypto.PublicKey)
- func (keyGen *KeyGenStub) IsInterfaceNil() bool
- func (keyGen *KeyGenStub) PrivateKeyFromByteArray(b []byte) (crypto.PrivateKey, error)
- func (keyGen *KeyGenStub) PublicKeyFromByteArray(b []byte) (crypto.PublicKey, error)
- func (keyGen *KeyGenStub) Suite() crypto.Suite
- type MultisignerMock
- func (mm *MultisignerMock) AggregateSigs(bitmap []byte) ([]byte, error)
- func (mm *MultisignerMock) Create(pubKeys []string, index uint16) (crypto.MultiSigner, error)
- func (mm *MultisignerMock) CreateAndAddSignatureShareForKey(message []byte, privateKey crypto.PrivateKey, pubKeyBytes []byte) ([]byte, error)
- func (mm *MultisignerMock) CreateSignatureShare(msg []byte, bitmap []byte) ([]byte, error)
- func (mm *MultisignerMock) IsInterfaceNil() bool
- func (mm *MultisignerMock) Reset(pubKeys []string, index uint16) error
- func (mm *MultisignerMock) SetAggregatedSig(aggSig []byte) error
- func (mm *MultisignerMock) SignatureShare(index uint16) ([]byte, error)
- func (mm *MultisignerMock) StoreSignatureShare(index uint16, sig []byte) error
- func (mm *MultisignerMock) Verify(msg []byte, bitmap []byte) error
- func (mm *MultisignerMock) VerifySignatureShare(index uint16, sig []byte, msg []byte, bitmap []byte) error
- type MultisignerStub
- func (mss *MultisignerStub) AggregateSigs(bitmap []byte) ([]byte, error)
- func (mss *MultisignerStub) Create(pubKeys []string, index uint16) (crypto.MultiSigner, error)
- func (mss *MultisignerStub) CreateAndAddSignatureShareForKey(message []byte, privateKey crypto.PrivateKey, pubKeyBytes []byte) ([]byte, error)
- func (mss *MultisignerStub) CreateSignatureShare(msg []byte, bitmap []byte) ([]byte, error)
- func (mss *MultisignerStub) IsInterfaceNil() bool
- func (mss *MultisignerStub) Reset(pubKeys []string, index uint16) error
- func (mss *MultisignerStub) SetAggregatedSig(bytes []byte) error
- func (mss *MultisignerStub) SignatureShare(index uint16) ([]byte, error)
- func (mss *MultisignerStub) StoreSignatureShare(index uint16, sig []byte) error
- func (mss *MultisignerStub) Verify(msg []byte, bitmap []byte) error
- func (mss *MultisignerStub) VerifySignatureShare(index uint16, sig []byte, msg []byte, bitmap []byte) error
- type PeerSignatureHandlerStub
- type PointMock
- func (po *PointMock) Add(_ crypto.Point) (crypto.Point, error)
- func (po *PointMock) Base() crypto.Point
- func (po *PointMock) Clone() crypto.Point
- func (po *PointMock) Equal(p crypto.Point) (bool, error)
- func (po *PointMock) GetUnderlyingObj() interface{}
- func (po *PointMock) IsInterfaceNil() bool
- func (po *PointMock) MarshalBinary() ([]byte, error)
- func (po *PointMock) Mul(s crypto.Scalar) (crypto.Point, error)
- func (po *PointMock) Neg() crypto.Point
- func (po *PointMock) Null() crypto.Point
- func (po *PointMock) Pick() (crypto.Point, error)
- func (po *PointMock) Set(_ crypto.Point) error
- func (po *PointMock) Sub(_ crypto.Point) (crypto.Point, error)
- func (po *PointMock) UnmarshalBinary(point []byte) error
- type PrivateKeyStub
- type PublicKeyStub
- type ScalarMock
- func (sm *ScalarMock) Add(_ crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) Clone() crypto.Scalar
- func (sm *ScalarMock) Div(_ crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) Equal(_ crypto.Scalar) (bool, error)
- func (sm *ScalarMock) GetUnderlyingObj() interface{}
- func (sm *ScalarMock) Inv(_ crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) IsInterfaceNil() bool
- func (sm *ScalarMock) MarshalBinary() ([]byte, error)
- func (sm *ScalarMock) Mul(_ crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) Neg() crypto.Scalar
- func (sm *ScalarMock) One() crypto.Scalar
- func (sm *ScalarMock) Pick() (crypto.Scalar, error)
- func (sm *ScalarMock) Set(_ crypto.Scalar) error
- func (sm *ScalarMock) SetBytes([]byte) (crypto.Scalar, error)
- func (sm *ScalarMock) SetInt64(_ int64)
- func (sm *ScalarMock) Sub(_ crypto.Scalar) (crypto.Scalar, error)
- func (sm *ScalarMock) UnmarshalBinary(val []byte) error
- func (sm *ScalarMock) Zero() crypto.Scalar
- type SignerStub
- type SingleSignerStub
- type Streamer
- type SuiteMock
- func (s *SuiteMock) CheckPointValid(pointBytes []byte) error
- func (s *SuiteMock) CreateKeyPair() (crypto.Scalar, crypto.Point)
- func (s *SuiteMock) CreatePoint() crypto.Point
- func (s *SuiteMock) CreatePointForScalar(scalar crypto.Scalar) (crypto.Point, error)
- func (s *SuiteMock) CreateScalar() crypto.Scalar
- func (s *SuiteMock) GetUnderlyingSuite() interface{}
- func (s *SuiteMock) IsInterfaceNil() bool
- func (s *SuiteMock) PointLen() int
- func (s *SuiteMock) RandomStream() cipher.Stream
- func (s *SuiteMock) ScalarLen() int
- func (s *SuiteMock) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyGenStub ¶
type KeyGenStub struct { GeneratePairStub func() (crypto.PrivateKey, crypto.PublicKey) PrivateKeyFromByteArrayStub func(b []byte) (crypto.PrivateKey, error) PublicKeyFromByteArrayStub func(b []byte) (crypto.PublicKey, error) CheckPublicKeyValidStub func(b []byte) error SuiteStub func() crypto.Suite }
KeyGenStub mocks a key generation implementation
func (*KeyGenStub) CheckPublicKeyValid ¶
func (keyGen *KeyGenStub) CheckPublicKeyValid(b []byte) error
CheckPublicKeyValid verifies the validity of the public key
func (*KeyGenStub) GeneratePair ¶
func (keyGen *KeyGenStub) GeneratePair() (crypto.PrivateKey, crypto.PublicKey)
GeneratePair generates a pair of private and public keys
func (*KeyGenStub) IsInterfaceNil ¶
func (keyGen *KeyGenStub) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*KeyGenStub) PrivateKeyFromByteArray ¶
func (keyGen *KeyGenStub) PrivateKeyFromByteArray(b []byte) (crypto.PrivateKey, error)
PrivateKeyFromByteArray generates the private key from it's byte array representation
func (*KeyGenStub) PublicKeyFromByteArray ¶
func (keyGen *KeyGenStub) PublicKeyFromByteArray(b []byte) (crypto.PublicKey, error)
PublicKeyFromByteArray generates a public key from it's byte array representation
type MultisignerMock ¶
type MultisignerMock struct { VerifyCalled func(msg []byte, bitmap []byte) error CommitmentHashCalled func(index uint16) ([]byte, error) AggregateSigsCalled func(bitmap []byte) ([]byte, error) CreateCalled func(pubKeys []string, index uint16) (crypto.MultiSigner, error) ResetCalled func(pubKeys []string, index uint16) error // contains filtered or unexported fields }
MultisignerMock is used to mock the multisignature scheme
func (*MultisignerMock) AggregateSigs ¶
func (mm *MultisignerMock) AggregateSigs(bitmap []byte) ([]byte, error)
AggregateSigs -
func (*MultisignerMock) Create ¶
func (mm *MultisignerMock) Create(pubKeys []string, index uint16) (crypto.MultiSigner, error)
Create -
func (*MultisignerMock) CreateAndAddSignatureShareForKey ¶
func (mm *MultisignerMock) CreateAndAddSignatureShareForKey(message []byte, privateKey crypto.PrivateKey, pubKeyBytes []byte) ([]byte, error)
CreateAndAddSignatureShareForKey -
func (*MultisignerMock) CreateSignatureShare ¶
func (mm *MultisignerMock) CreateSignatureShare(msg []byte, bitmap []byte) ([]byte, error)
CreateSignatureShare creates a partial signature
func (*MultisignerMock) IsInterfaceNil ¶
func (mm *MultisignerMock) IsInterfaceNil() bool
IsInterfaceNil -
func (*MultisignerMock) Reset ¶
func (mm *MultisignerMock) Reset(pubKeys []string, index uint16) error
Reset -
func (*MultisignerMock) SetAggregatedSig ¶
func (mm *MultisignerMock) SetAggregatedSig(aggSig []byte) error
SetAggregatedSig -
func (*MultisignerMock) SignatureShare ¶
func (mm *MultisignerMock) SignatureShare(index uint16) ([]byte, error)
SignatureShare -
func (*MultisignerMock) StoreSignatureShare ¶
func (mm *MultisignerMock) StoreSignatureShare(index uint16, sig []byte) error
StoreSignatureShare -
func (*MultisignerMock) Verify ¶
func (mm *MultisignerMock) Verify(msg []byte, bitmap []byte) error
Verify -
func (*MultisignerMock) VerifySignatureShare ¶
func (mm *MultisignerMock) VerifySignatureShare(index uint16, sig []byte, msg []byte, bitmap []byte) error
VerifySignatureShare -
type MultisignerStub ¶
type MultisignerStub struct { CreateCalled func(pubKeys []string, index uint16) (crypto.MultiSigner, error) SetAggregatedSigCalled func(bytes []byte) error VerifyCalled func(msg []byte, bitmap []byte) error ResetCalled func(pubKeys []string, index uint16) error AggregateSigsCalled func(bitmap []byte) ([]byte, error) }
MultisignerStub -
func (*MultisignerStub) AggregateSigs ¶
func (mss *MultisignerStub) AggregateSigs(bitmap []byte) ([]byte, error)
AggregateSigs -
func (*MultisignerStub) Create ¶
func (mss *MultisignerStub) Create(pubKeys []string, index uint16) (crypto.MultiSigner, error)
Create -
func (*MultisignerStub) CreateAndAddSignatureShareForKey ¶
func (mss *MultisignerStub) CreateAndAddSignatureShareForKey(message []byte, privateKey crypto.PrivateKey, pubKeyBytes []byte) ([]byte, error)
CreateAndAddSignatureShareForKey -
func (*MultisignerStub) CreateSignatureShare ¶
func (mss *MultisignerStub) CreateSignatureShare(msg []byte, bitmap []byte) ([]byte, error)
CreateSignatureShare -
func (*MultisignerStub) IsInterfaceNil ¶
func (mss *MultisignerStub) IsInterfaceNil() bool
IsInterfaceNil -
func (*MultisignerStub) Reset ¶
func (mss *MultisignerStub) Reset(pubKeys []string, index uint16) error
Reset -
func (*MultisignerStub) SetAggregatedSig ¶
func (mss *MultisignerStub) SetAggregatedSig(bytes []byte) error
SetAggregatedSig -
func (*MultisignerStub) SignatureShare ¶
func (mss *MultisignerStub) SignatureShare(index uint16) ([]byte, error)
SignatureShare -
func (*MultisignerStub) StoreSignatureShare ¶
func (mss *MultisignerStub) StoreSignatureShare(index uint16, sig []byte) error
StoreSignatureShare -
func (*MultisignerStub) Verify ¶
func (mss *MultisignerStub) Verify(msg []byte, bitmap []byte) error
Verify -
func (*MultisignerStub) VerifySignatureShare ¶
func (mss *MultisignerStub) VerifySignatureShare(index uint16, sig []byte, msg []byte, bitmap []byte) error
VerifySignatureShare -
type PeerSignatureHandlerStub ¶ added in v1.3.37
type PeerSignatureHandlerStub struct { VerifyPeerSignatureCalled func(pk []byte, pid core.PeerID, signature []byte) error GetPeerSignatureCalled func(key crypto.PrivateKey, pid []byte) ([]byte, error) }
PeerSignatureHandlerStub -
func (*PeerSignatureHandlerStub) GetPeerSignature ¶ added in v1.3.37
func (pshs *PeerSignatureHandlerStub) GetPeerSignature(key crypto.PrivateKey, pid []byte) ([]byte, error)
GetPeerSignature -
func (*PeerSignatureHandlerStub) IsInterfaceNil ¶ added in v1.3.37
func (pshs *PeerSignatureHandlerStub) IsInterfaceNil() bool
IsInterfaceNil -
func (*PeerSignatureHandlerStub) VerifyPeerSignature ¶ added in v1.3.37
func (pshs *PeerSignatureHandlerStub) VerifyPeerSignature(pk []byte, pid core.PeerID, signature []byte) error
VerifyPeerSignature -
type PointMock ¶
type PointMock struct { X int Y int GetUnderlyingObjStub func() interface{} MarshalBinaryStub func(x, y int) ([]byte, error) UnmarshalBinaryStub func([]byte) (x, y int, err error) }
PointMock represents a mock implementation for a Point
func (*PointMock) Add ¶
Add returns the result of adding receiver with Point p given as parameter, so that their scalars add homomorphically
func (*PointMock) Base ¶
func (po *PointMock) Base() crypto.Point
Base returns the Group's base point.
func (*PointMock) Clone ¶
func (po *PointMock) Clone() crypto.Point
Clone returns a clone of the receiver.
func (*PointMock) Equal ¶
Equal tests if receiver is equal with the Point p given as parameter. Both Points need to be derived from the same Group
func (*PointMock) GetUnderlyingObj ¶
func (po *PointMock) GetUnderlyingObj() interface{}
GetUnderlyingObj returns the object the implementation wraps
func (*PointMock) IsInterfaceNil ¶
IsInterfaceNil returns true if there is no value under the interface
func (*PointMock) MarshalBinary ¶
MarshalBinary transforms the Point into a byte array
func (*PointMock) Mul ¶
Mul returns the result of multiplying receiver by the scalar s. Mock multiplies the scalar to both X and Y fields
func (*PointMock) Neg ¶
func (po *PointMock) Neg() crypto.Point
Neg returns the negation of receiver
func (*PointMock) Null ¶
func (po *PointMock) Null() crypto.Point
Null returns the neutral identity element.
func (*PointMock) Sub ¶
Sub returns the result of subtracting from receiver the Point p given as parameter, so that their scalars subtract homomorphically
func (*PointMock) UnmarshalBinary ¶
UnmarshalBinary recreates the Point from a byte array
type PrivateKeyStub ¶
type PrivateKeyStub struct { ToByteArrayStub func() ([]byte, error) GeneratePublicStub func() crypto.PublicKey ScalarStub func() crypto.Scalar SuiteStub func() crypto.Suite }
PrivateKeyStub provides stubs for a PrivateKey implementation
func (*PrivateKeyStub) GeneratePublic ¶
func (privKey *PrivateKeyStub) GeneratePublic() crypto.PublicKey
GeneratePublic builds a public key for the current private key
func (*PrivateKeyStub) IsInterfaceNil ¶
func (privKey *PrivateKeyStub) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PrivateKeyStub) Scalar ¶
func (privKey *PrivateKeyStub) Scalar() crypto.Scalar
Scalar returns the Scalar corresponding to this Private Key
func (*PrivateKeyStub) Suite ¶
func (privKey *PrivateKeyStub) Suite() crypto.Suite
Suite returns the Suite (curve data) used for this private key
func (*PrivateKeyStub) ToByteArray ¶
func (privKey *PrivateKeyStub) ToByteArray() ([]byte, error)
ToByteArray returns the byte array representation of the private key
type PublicKeyStub ¶
type PublicKeyStub struct { ToByteArrayStub func() ([]byte, error) PointStub func() crypto.Point SuiteStub func() crypto.Suite }
PublicKeyStub provides stubs for a PublicKey implementation
func (*PublicKeyStub) IsInterfaceNil ¶
func (pubKey *PublicKeyStub) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PublicKeyStub) Point ¶
func (pubKey *PublicKeyStub) Point() crypto.Point
Point returns the Point corresponding to this Public Key
func (*PublicKeyStub) Suite ¶
func (pubKey *PublicKeyStub) Suite() crypto.Suite
Suite returns the Suite (curve data) used for this private key
func (*PublicKeyStub) ToByteArray ¶
func (pubKey *PublicKeyStub) ToByteArray() ([]byte, error)
ToByteArray returns the byte array representation of the public key
type ScalarMock ¶
type ScalarMock struct { X int MarshalBinaryStub func(x int) ([]byte, error) UnmarshalBinaryStub func([]byte) (int, error) GetUnderlyingObjStub func() interface{} }
ScalarMock represents a mock implementation of a Scalar
func (*ScalarMock) Add ¶
func (sm *ScalarMock) Add(_ crypto.Scalar) (crypto.Scalar, error)
Add returns the modular sum of receiver with scalar s given as parameter
func (*ScalarMock) Clone ¶
func (sm *ScalarMock) Clone() crypto.Scalar
Clone creates a new Scalar with same value as receiver
func (*ScalarMock) Div ¶
func (sm *ScalarMock) Div(_ crypto.Scalar) (crypto.Scalar, error)
Div returns the modular division between receiver and scalar s given as parameter
func (*ScalarMock) Equal ¶
func (sm *ScalarMock) Equal(_ crypto.Scalar) (bool, error)
Equal tests if receiver is equal with the scalar s given as parameter. Both scalars need to be derived from the same Group
func (*ScalarMock) GetUnderlyingObj ¶
func (sm *ScalarMock) GetUnderlyingObj() interface{}
GetUnderlyingObj returns the object the implementation wraps
func (*ScalarMock) Inv ¶
func (sm *ScalarMock) Inv(_ crypto.Scalar) (crypto.Scalar, error)
Inv returns the modular inverse of scalar s given as parameter
func (*ScalarMock) IsInterfaceNil ¶
func (sm *ScalarMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*ScalarMock) MarshalBinary ¶
func (sm *ScalarMock) MarshalBinary() ([]byte, error)
MarshalBinary transforms the Scalar into a byte array
func (*ScalarMock) Mul ¶
func (sm *ScalarMock) Mul(_ crypto.Scalar) (crypto.Scalar, error)
Mul returns the modular product of receiver with scalar s given as parameter
func (*ScalarMock) Neg ¶
func (sm *ScalarMock) Neg() crypto.Scalar
Neg returns the modular negation of receiver
func (*ScalarMock) One ¶
func (sm *ScalarMock) One() crypto.Scalar
One returns the multiplicative identity (1)
func (*ScalarMock) Pick ¶
func (sm *ScalarMock) Pick() (crypto.Scalar, error)
Pick returns a fresh random or pseudo-random scalar For the mock set X to the original scalar.X *2
func (*ScalarMock) Set ¶
func (sm *ScalarMock) Set(_ crypto.Scalar) error
Set sets the receiver to Scalar s given as parameter
func (*ScalarMock) SetBytes ¶
func (sm *ScalarMock) SetBytes([]byte) (crypto.Scalar, error)
SetBytes sets the scalar from a byte-slice, reducing if necessary to the appropriate modulus.
func (*ScalarMock) SetInt64 ¶
func (sm *ScalarMock) SetInt64(_ int64)
SetInt64 sets the receiver to a small integer value v given as parameter
func (*ScalarMock) Sub ¶
func (sm *ScalarMock) Sub(_ crypto.Scalar) (crypto.Scalar, error)
Sub returns the modular difference between receiver and scalar s given as parameter
func (*ScalarMock) UnmarshalBinary ¶
func (sm *ScalarMock) UnmarshalBinary(val []byte) error
UnmarshalBinary recreates the Scalar from a byte array
func (*ScalarMock) Zero ¶
func (sm *ScalarMock) Zero() crypto.Scalar
Zero returns the the additive identity (0)
type SignerStub ¶
type SignerStub struct { SignCalled func(private crypto.PrivateKey, msg []byte) ([]byte, error) VerifyCalled func(public crypto.PublicKey, msg []byte, sig []byte) error }
SignerStub -
func (*SignerStub) IsInterfaceNil ¶
func (s *SignerStub) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
type SingleSignerStub ¶
type SingleSignerStub struct { SignCalled func(private crypto.PrivateKey, msg []byte) ([]byte, error) VerifyCalled func(public crypto.PublicKey, msg []byte, sig []byte) error }
SingleSignerStub -
func (*SingleSignerStub) IsInterfaceNil ¶
func (s *SingleSignerStub) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
type Streamer ¶
type Streamer struct {
// contains filtered or unexported fields
}
Streamer -
func (*Streamer) XORKeyStream ¶
XORKeyStream -
type SuiteMock ¶
type SuiteMock struct { StringStub func() string ScalarLenStub func() int CreateScalarStub func() crypto.Scalar PointLenStub func() int CreatePointStub func() crypto.Point CreatePointForScalarStub func(scalar crypto.Scalar) (crypto.Point, error) RandomStreamStub func() cipher.Stream CreateKeyPairStub func() (crypto.Scalar, crypto.Point) IsPointValidStub func([]byte) error GetUnderlyingSuiteStub func() interface{} }
SuiteMock -
func (*SuiteMock) CheckPointValid ¶
CheckPointValid -
func (*SuiteMock) CreateKeyPair ¶
func (s *SuiteMock) CreateKeyPair() (crypto.Scalar, crypto.Point)
CreateKeyPair -
func (*SuiteMock) CreatePointForScalar ¶
CreatePointForScalar -
func (*SuiteMock) GetUnderlyingSuite ¶
func (s *SuiteMock) GetUnderlyingSuite() interface{}
GetUnderlyingSuite -
func (*SuiteMock) IsInterfaceNil ¶
IsInterfaceNil returns true if there is no value under the interface