ots

package
v0.0.0-...-21b5147 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package ots implements one-time signatures (LM-OTS) for use in LMS

This file implements the private key and signing logic.

Package ots implements one-time signatures (LM-OTS) for use in LMS

This file implements the public key and verification logic.

Package ots implements one-time signatures (LM-OTS) for use in LMS

This file implements the signature (including serialization).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LmsOtsPrivateKey

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

A LmsOtsPrivateKey is used to sign exactly one message.

func NewPrivateKey

func NewPrivateKey(tc common.LmsOtsAlgorithmType, q uint32, id common.ID) (LmsOtsPrivateKey, error)

NewPrivateKey returns a LmsOtsPrivateKey, seeded by a cryptographically secure random number generator.

func NewPrivateKeyFromSeed

func NewPrivateKeyFromSeed(tc common.LmsOtsAlgorithmType, q uint32, id common.ID, seed []byte) (LmsOtsPrivateKey, error)

NewPrivateKeyFromSeed returns a new LmsOtsPrivateKey, using the algorithm from Appendix A of <https://datatracker.ietf.org/doc/html/rfc8554#appendix-A>

func (*LmsOtsPrivateKey) Public

func (x *LmsOtsPrivateKey) Public() (LmsOtsPublicKey, error)

Public returns an LmsOtsPublicKey that validates signatures for this private key.

func (*LmsOtsPrivateKey) Sign

func (x *LmsOtsPrivateKey) Sign(msg []byte, rng io.Reader) (LmsOtsSignature, error)

Sign calculates the LM-OTS signature of a chosen message. The rng argument is optional. If nil is provided, crypto/rand.Reader will be used.

type LmsOtsPublicKey

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

A LmsOtsPublicKey is used to verify exactly one message.

func LmsOtsPublicKeyFromBytes

func LmsOtsPublicKeyFromBytes(b []byte) (LmsOtsPublicKey, error)

LmsOtsPublicKeyFromBytes returns an LmsOtsPublicKey that represents b. This is the inverse of the ToBytes() method on the LmsOtsPublicKey object.

func (*LmsOtsPublicKey) Key

func (pub *LmsOtsPublicKey) Key() []byte

Key returns a copy of the public key's k parameter. We need this to get the public key as bytes in order to hash

func (*LmsOtsPublicKey) ToBytes

func (pub *LmsOtsPublicKey) ToBytes() []byte

ToBytes() serializes the public key into a byte string for transmission or storage.

func (*LmsOtsPublicKey) Verify

func (pub *LmsOtsPublicKey) Verify(msg []byte, sig LmsOtsSignature) bool

Verify returns true if sig is valid for msg and this public key. It returns false otherwise.

type LmsOtsSignature

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

A LmsOtsSignature is a signature of one message.

func LmsOtsSignatureFromBytes

func LmsOtsSignatureFromBytes(b []byte) (LmsOtsSignature, error)

LmsOtsSignatureFromBytes returns an LmsOtsSignature represented by b.

func (*LmsOtsSignature) RecoverPublicKey

func (sig *LmsOtsSignature) RecoverPublicKey(msg []byte, id common.ID, q uint32) (LmsOtsPublicKey, bool)

RecoverPublicKey calculates the public key for a given message. This is used in signature verification.

func (*LmsOtsSignature) ToBytes

func (sig *LmsOtsSignature) ToBytes() ([]byte, error)

ToBytes() serializes the LM-OTS signature into a byte string for transmission or storage.

Jump to

Keyboard shortcuts

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