lmots

package module
v2.2.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2018 License: MIT Imports: 9 Imported by: 2

README

The Leighton-Micali One-Time Signature [LM-OTS]

version tag build status license tag

Copyright (c) 2017-2018 LoCCS.
Project to implement the Leighton-Micali one-time signature scheme according to Hash-Based Signatures: draft-mcgrew-hash-sigs-08.

Contents

Requirement

  • git
  • go 1.9+

are required to compile the library.

Installation

By go get
$ go get -u github.com/LoCCS/lmots
By dep
  1. download the source code into local disks
  2. invoke dep to build up dependencies
$ dep ensure

Usage

Please refer to ExampleLMS() in example_test.go

Contributing

Kind advices and contributions are always welcomed, but to avoid chaos or destabilization in existing work, we have processes that bring people in gradually. In general the process is:

  • Find a specific bug you'd like to fix or a specific feature you’d like to add (check out the issues list if to get some ideas)
  • Fix the bug in your own clone and ensure that it's working
  • Submit the change to the master branch via a pull request

Development Resources

Documentation

Index

Constants

View Source
const (
	D_PBLC = 0x8080
	D_MESG = 0x8181
	D_LEAF = 0x8282
	D_INTR = 0x8383
)

domain separation fields enumerators indicating the message to hash

  • D_PBLC = 0x8080 when computing the hash of all of the iterates in the LM-OTS algorithm
  • D_MESG = 0x8181 when computing the hash of the message in the LM-OTS algorithms
  • D_LEAF = 0x8282 when computing the hash of the leaf of an LMS tree
  • D_INTR = 0x8383 when computing the hash of an interior node of an LMS tree
View Source
const (
	LMOTS_SHAKE256_N32_W2 = iota
	LMOTS_SHAKE256_N32_W4
)

typecodes as prefix secret key, public key and signature it takes form of "LMOTS_SHAKE{shake}_N{n}_W{w}" where shake is the version of the shake hash to use and n is the byte length of output fetching from the hash function every time w is the bit width of the Winternitz coefficient

View Source
const N = 32

N is the security level measured in the bytes length of output of the hash function in use

Variables

This section is empty.

Functions

func Verify

func Verify(pk *PublicKey, msg HashType, sig *Sig) bool

Verify checks the signature on msg against the given public key

Types

type HashType

type HashType = []byte

HashType alias a byte slice to ease understanding and typing

func RecoverK

func RecoverK(opts *LMOpts, msg HashType, sig *Sig) (HashType, error)

RecoverK recovers the K component for a public key

type LMOpts

type LMOpts struct {
	// big-endian order bytes for LMOTS_SHAKE{shake}_N{n}_W{w}
	// typecodes defined in params.go
	Typecode [4]byte
	// key pair identifier
	I [key_id_len]byte
	// index of the current key pair
	KeyIdx uint32
}

LMOpts wraps options for key generations, signing and verification

func NewLMOpts

func NewLMOpts() *LMOpts

NewLMOpts makes an LM-OTS option with default `typecode` and `keyIdx` as 0

func (*LMOpts) Clone

func (opts *LMOpts) Clone() *LMOpts

Clone makes a copy of this *LMOpts

func (*LMOpts) Equal

func (opts *LMOpts) Equal(rhs *LMOpts) bool

Equal checks the equality of two options

type MetaOpts

type MetaOpts struct {
	// contains filtered or unexported fields
}

MetaOpts is a container for the parameter set specification of LM-OTS

var METAOPTS_DEFAULT *MetaOpts

this one is set as default in current implementation

var METAOPTS_SHAKE256_N32_W2, METAOPTS_SHAKE256_N32_W4 *MetaOpts

METAOPTS_SHAKE256_N32_W2: specialized options for n=32, w=2 METAOPTS_SHAKE256_N32_W4: specialized options for n=32, w=4 users should only run the library with one of these provided options otherwise, the correctness of the implementation is unpredictable ALL THESE OPTIONS SHOULD BE **READONLY**

type PrivateKey

type PrivateKey struct {
	PublicKey
	X []HashType
}

PrivateKey as a container for private key, it also embeds its corresponding public key

func GenerateKey

func GenerateKey(opts *LMOpts, rng io.Reader) (*PrivateKey, error)

GenerateKey generates a key pair

func (*PrivateKey) Equal

func (sk *PrivateKey) Equal(rhs *PrivateKey) bool

Equal checks if this key equals to the given one

type PublicKey

type PublicKey struct {
	Opts *LMOpts
	K    HashType // hash of public key components
}

PublicKey as container for public key

func (*PublicKey) Clone

func (pk *PublicKey) Clone() *PublicKey

Clone makes a copy of this pk

func (*PublicKey) Equal

func (pk *PublicKey) Equal(rhs *PublicKey) bool

Equal checks if this `pk` equals to `rhs`

type Sig

type Sig struct {
	Typecode [4]byte
	C        []byte
	Sigma    []HashType
}

Sig as container for the Winternitz one-time signature export all fields to make it encodeable as Gob

func Sign

func Sign(rng io.Reader, sk *PrivateKey, msg HashType) (*Sig, error)

Sign generates the signature for a message digest

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL