Documentation ¶
Index ¶
- func GenKeyPair(n, rtH, chanH uint32, c uint16, w uint16) (*PrivateKey, *PublicKey, error)
- func GenerateKeyPair(p *Params, t int) (*PrivateKey, *PublicKey, error)
- type Channel
- type Context
- type GrowSignature
- type MsgSignature
- type Params
- type PrivateKey
- func (sk *PrivateKey) AddChannel() (uint32, *RootSignature, error)
- func (sk *PrivateKey) ChainSeqNo(chIdx uint32) uint32
- func (sk *PrivateKey) ChannelSeqNos(chIdx uint32) (uint32, SignatureSeqNo, error)
- func (sk *PrivateKey) GetSeqNo() (SignatureSeqNo, error)
- func (sk *PrivateKey) GrowChannel(chIdx uint32) (*GrowSignature, error)
- func (sk *PrivateKey) SignChannelMsg(chIdx uint32, msg []byte) (*MsgSignature, error)
- func (sk *PrivateKey) SignChannelRoot(chRt []byte) (*RootSignature, error)
- func (sk *PrivateKey) SignMsg(chIdx uint32, msg []byte) (*MsgSignature, error)
- type PublicKey
- func (pk *PublicKey) Verify(sig Signature, msgAuthNode ...[]byte) (bool, error)
- func (pk *PublicKey) VerifyChannel(rt *RootSignature) (bool, error)
- func (pk *PublicKey) VerifyChannelMsg(sig *MsgSignature, msg, authNode []byte) (bool, error)
- func (pk *PublicKey) VerifyChannelRoot(rtSig *RootSignature, chRt []byte) (bool, error)
- func (pk *PublicKey) VerifyGrow(sig *GrowSignature, authNode []byte) (bool, error)
- func (pk *PublicKey) VerifyMsg(sig *MsgSignature, msg, authNode []byte) (bool, error)
- type RootSignature
- type Signature
- type SignatureSeqNo
- type SubTreeAddress
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenKeyPair ¶
GenKeyPair generates a keypair for the given parameters.
func GenerateKeyPair ¶
func GenerateKeyPair(p *Params, t int) (*PrivateKey, *PublicKey, error)
GenerateKeyPair generates a new MBPQS keypair for given parameters.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel is a key channel within the MBPQS tree, are stacked chain trees with the same Tree address.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context including a full MBPQS instance.
func NewContextFromOid ¶
NewContextFromOid returns a new context for the given Root tree.
type GrowSignature ¶
type GrowSignature struct {
// contains filtered or unexported fields
}
GrowSignature is a signature of the last OTS key in a chain tree over the next chain tree root node.
func (*GrowSignature) NextAuthNode ¶
func (gs *GrowSignature) NextAuthNode(prevAuthNode ...[]byte) []byte
NextAuthNode returns the growSig root hash field from the GrowSignature. This is the chainTree root signed in this signature.
type MsgSignature ¶
type MsgSignature struct {
// contains filtered or unexported fields
}
MsgSignature holds a signature on a message in a channel.
func (MsgSignature) NextAuthNode ¶
func (ms MsgSignature) NextAuthNode(prevAuthNode ...[]byte) []byte
NextAuthNode returns the authentication node for the next signature from the current MsgSignature.
type Params ¶
type Params struct {
// contains filtered or unexported fields
}
Params includes the MBPQS parameters.
type PrivateKey ¶
type PrivateKey struct { Channels []*Channel // Channel states in the private key. // contains filtered or unexported fields }
PrivateKey is a MBPQS private key */
func (*PrivateKey) AddChannel ¶
func (sk *PrivateKey) AddChannel() (uint32, *RootSignature, error)
AddChannel returns the ID of the added channel, and the signature of its initial chain tree root node.
func (*PrivateKey) ChainSeqNo ¶
func (sk *PrivateKey) ChainSeqNo(chIdx uint32) uint32
ChainSeqNo retrieves the current cahinSeqNo and increases it with one.
func (*PrivateKey) ChannelSeqNos ¶
func (sk *PrivateKey) ChannelSeqNos(chIdx uint32) (uint32, SignatureSeqNo, error)
ChannelSeqNos retrieves the current chainSeqNo and the current channelSeqNo.
func (*PrivateKey) GetSeqNo ¶
func (sk *PrivateKey) GetSeqNo() (SignatureSeqNo, error)
GetSeqNo retrieves the current index of the first unusued channel signing key in the RootTree.
func (*PrivateKey) GrowChannel ¶
func (sk *PrivateKey) GrowChannel(chIdx uint32) (*GrowSignature, error)
GrowChannel adds a chainTree to the channel.
func (*PrivateKey) SignChannelMsg ¶
func (sk *PrivateKey) SignChannelMsg(chIdx uint32, msg []byte) (*MsgSignature, error)
SignChannelMsg signs the message 'msg' in the channel with index chIdx. Be cautious: this
func (*PrivateKey) SignChannelRoot ¶
func (sk *PrivateKey) SignChannelRoot(chRt []byte) (*RootSignature, error)
SignChannelRoot is used to sign the n-byte channel root hash with the PrivateKey
func (*PrivateKey) SignMsg ¶
func (sk *PrivateKey) SignMsg(chIdx uint32, msg []byte) (*MsgSignature, error)
SignMsg returns the signature over the message in channel with index chIdx.
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey is a MBPQS public key.
func (*PublicKey) Verify ¶
Verify is the generic verification function for all signature types. First parameter: signature of any type Second (optional) parameter: message, plus additionally a authentication node as third. Authnod of growsignature and msgsignature should be CurAuthNode of previous signature.
func (*PublicKey) VerifyChannel ¶
func (pk *PublicKey) VerifyChannel(rt *RootSignature) (bool, error)
VerifyChannel verifies that a channel is signed by a certain PublicKey.
func (*PublicKey) VerifyChannelMsg ¶
func (pk *PublicKey) VerifyChannelMsg(sig *MsgSignature, msg, authNode []byte) (bool, error)
VerifyChannelMsg return true if the signature/message pair is valid.
func (*PublicKey) VerifyChannelRoot ¶
func (pk *PublicKey) VerifyChannelRoot(rtSig *RootSignature, chRt []byte) (bool, error)
VerifyChannelRoot is used to verify the signature on the channel root.
func (*PublicKey) VerifyGrow ¶
func (pk *PublicKey) VerifyGrow(sig *GrowSignature, authNode []byte) (bool, error)
VerifyGrow verifies the growing signature.
type RootSignature ¶
type RootSignature struct {
// contains filtered or unexported fields
}
RootSignature holds a signature on a channel by a rootTree leaf.
func (*RootSignature) GetSignedRoot ¶
func (rtSig *RootSignature) GetSignedRoot() []byte
GetSignedRoot returns the root hash field from the the RootSignature. This is the channel root signed by this signature.
func (*RootSignature) NextAuthNode ¶
func (rtSig *RootSignature) NextAuthNode(prevAuthNode ...[]byte) []byte
NextAuthNode returns the authentication path for the RootSignature.
type Signature ¶
type Signature interface {
NextAuthNode(prevAuthNode ...[]byte) []byte // Retrieve the current Authentication root after this signature is verified.
}
Signature is the interface type for RootSignature, MsgSignature, and GrowSignature.
type SignatureSeqNo ¶
type SignatureSeqNo uint32
SignatureSeqNo is the sequence number (index) of signatures and wotsKeys in channels and the root tree.
type SubTreeAddress ¶
type SubTreeAddress struct { // The root tree has layer 0. // The top-level chain tree has layer 1, etc. Layer uint32 // The offset in the subtree. // The root has tree index = 0. // The leftmost chaintrees have tree = 0. Tree uint64 }
SubTreeAddress represents the position of a subtree in the full MBPQS tree.