Documentation ¶
Index ¶
Constants ¶
const ( SecurityLevel256 = 32 // 256 bits SecurityLevel512 = 64 // 512 bits SecurityLevel = SecurityLevel256 )
security parameter
Variables ¶
This section is empty.
Functions ¶
Types ¶
type KeyIterator ¶
type KeyIterator struct { // options specifying stuff like nonce for // randomizing hash function *WtnOpts // contains filtered or unexported fields }
KeyIterator is a prkgator to produce a key chain for user based on a seed
func NewKeyIterator ¶
func NewKeyIterator(compactSeed []byte) *KeyIterator
NewKeyIterator makes a key pair prkgator
func (*KeyIterator) Init ¶
func (prkg *KeyIterator) Init(compositeSeed []byte) bool
Init initialises the prkgator with the composite seed exported by Serialize()
func (*KeyIterator) Next ¶
func (prkg *KeyIterator) Next() (*PrivateKey, error)
Next estimates and returns the next sk-pk pair
func (*KeyIterator) Offset ¶
func (prkg *KeyIterator) Offset() uint32
Offset returns 0-based index of the **next** running prkgation
func (*KeyIterator) Serialize ¶
func (prkg *KeyIterator) Serialize() []byte
Serialize encodes the key iterator as +---------------------------------------------+ | len(seed)||seed||offset||len(nonce)||nonce | +---------------------------------------------+ the byte slice export from here makes up everything needed to recovered the state the prkg So unless it's your first-time use, you should store this byte slice so as to snapshot the prkg
type PrivateKey ¶
type PrivateKey struct { PublicKey // contains filtered or unexported fields }
PrivateKey as container for private key, it also embeds its corresponding public key
func GenerateKey ¶
func GenerateKey(opts *WtnOpts, rng io.Reader) (*PrivateKey, error)
GenerateKey generates a one-time key pair according to specification (nonce, key-pair-index) in opts and by getting randomness from rng
type WinternitzSig ¶
type WinternitzSig struct {
// contains filtered or unexported fields
}
WinternitzSig as container for the Winternitz one-time signature
func DeserializeWinternitzSig ¶
func DeserializeWinternitzSig(sigBytes []byte) *WinternitzSig
Deserialize decodes the winternitz signature from bytes
func Sign ¶
func Sign(sk *PrivateKey, hash []byte) (*WinternitzSig, error)
Sign generates the signature for a message digest based on the given private key the opts should have the same seed and key-pair index and as that of generating key pairs
func (*WinternitzSig) Serialize ¶
func (sig *WinternitzSig) Serialize() []byte
Serialize encodes the winternitz signature
type WtnOpts ¶
type WtnOpts struct {
// contains filtered or unexported fields
}
WtnOpts provides a container specifying options for W-OTS
var DummyWtnOpts *WtnOpts = NewWtnOpts(SecurityLevel)
DummyWtnOpts is a dummy WtnOpts with a random nonce
func Deserialize ¶
Deserialize recovers the WtnOpts from bytes
func NewWtnOpts ¶
NewWtnOpts makes a WtnOpts of the specified security level and securityLevel should be in {32, 64}
func (*WtnOpts) SecurityLevel ¶
SecurityLevel returns the security level specified by this WtnOpts, should be the same length as the nonce in use