xmss

package
v1.0.2065 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XMSS_HASH_PADDING_F          = 0
	XMSS_HASH_PADDING_H          = 1
	XMSS_HASH_PADDING_HASH       = 2
	XMSS_HASH_PADDING_PRF        = 3
	XMSS_HASH_PADDING_PRF_KEYGEN = 4
)

Variables

View Source
var (
	SHA2_10_256 = NewParams(sha256.New, 32, 16, 10, 1, 32)
	SHA2_16_256 = NewParams(sha256.New, 32, 16, 16, 1, 32)
	SHA2_20_256 = NewParams(sha256.New, 32, 16, 20, 1, 32)
)

Functions

func GenerateKey

func GenerateKey(rand io.Reader, params *Params) (*PrivateKey, *PublicKey, error)

GenerateKey Section 4.1.7. Algorithm 10: XMSS_keyGen - Generate an XMSS key pair Generates a XMSS key pair for a given parameter set. Format private: [(32bit) index || prvSeed || seed || pubSeed || root] Format public: [root || pubSeed]

func Verify

func Verify(params *Params, publicKey *PublicKey, m, signature []byte) (match bool)

Verify Section 4.1.10. Algorithm 14: XMSS_verify - Verify an XMSS signature using the corresponding XMSS public key and a message Verifies a given message signature pair under a given public key. Note that this assumes a pk without an OID, i.e. [root || pubSeed]

Types

type Params

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

Params is a struct for parameters

func NewParams

func NewParams(hashFunc func() hash.Hash, n, w, h, d, paddingLen int) *Params

func (*Params) Hash

func (params *Params) Hash() hash.Hash

func (*Params) SignBytes

func (params *Params) SignBytes() int

SignBytes the length of the signature based on a given parameter set

type PrivateKey

type PrivateKey struct {
	D []byte
}

PrivateKey key

func (*PrivateKey) Equal

func (priv *PrivateKey) Equal(x crypto.PrivateKey) bool

Equal reports whether priv and x have the same value.

func (*PrivateKey) PublicKey added in v1.0.2042

func (priv *PrivateKey) PublicKey(params *Params) *PublicKey

func (*PrivateKey) Sign

func (priv *PrivateKey) Sign(params *Params, m []byte) ([]byte, error)

Sign Section 4.1.9. Algorithm 12: XMSS_sign - Generate an XMSS signature and update the XMSS private key Signs a message. Returns an array containing the signature followed by the message and an updated secret key.

type PublicKey

type PublicKey struct {
	X []byte
}

PublicKey key

func (*PublicKey) Equal

func (pub *PublicKey) Equal(x crypto.PublicKey) bool

Equal reports whether pub and x have the same value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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