xmss

package
v0.0.0-...-c31dd52 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Example
// test message
message := []byte("Hello, world!")

// ***************************************  XMSS  ****************************************

// generates an XMSS key pair with the type XMSSSHA2H10W256
xsk, xpk, xkerr := KeyGen(XMSSSHA2H10W256)
if xkerr != nil {
	panic(xkerr)
}
// generate an XMSS signature
xsig, xserr := xsk.Sign(message)
if xserr != nil {
	panic(xserr)
}
// verify an XMSS signature
xver := xpk.Verify(message, xsig)
fmt.Println(xver)

// *************************************** XMSS^MT ***************************************

// generates an XMSS^MT key pair with the type XMSSMTSHA2H20D4W256
mtsk, mtpk, mkerr := MTkeyGen(XMSSMTSHA2H20D4W256)
if mkerr != nil {
	panic(mkerr)
}
// generate an XMSS^MT signature
mtsig, mserr := mtsk.Sign(message)
if mserr != nil {
	panic(mserr)
}
// verify an XMSS^MT signature
mver := mtpk.Verify(message, mtsig)
fmt.Println(mver)
Output:

true
true

Index

Examples

Constants

View Source
const (
	XMSSSHA2H10W256
	XMSSSHA2H16W256
	XMSSSHA2H20W256
	XMSSSHA2H10W512
	XMSSSHA2H16W512
	XMSSSHA2H20W512
	XMSSSHAKEH10W256
	XMSSSHAKEH16W256
	XMSSSHAKEH20W256
	XMSSSHAKEH10W512
	XMSSSHAKEH16W512
	XMSSSHAKEH20W512
)

XMSS types

View Source
const (
	XMSSMTSHA2H20D2W256
	XMSSMTSHA2H20D4W256
	XMSSMTSHA2H40D2W256
	XMSSMTSHA2H40D4W256
	XMSSMTSHA2H40D8W256
	XMSSMTSHA2H60D3W256
	XMSSMTSHA2H60D6W256
	XMSSMTSHA2H60D12W256
	XMSSMTSHA2H20D2W512
	XMSSMTSHA2H20D4W512
	XMSSMTSHA2H40D2W512
	XMSSMTSHA2H40D4W512
	XMSSMTSHA2H40D8W512
	XMSSMTSHA2H60D3W512
	XMSSMTSHA2H60D6W512
	XMSSMTSHA2H60D12W512
	XMSSMTSHAKEH20D2W256
	XMSSMTSHAKEH20D4W256
	XMSSMTSHAKEH40D2W256
	XMSSMTSHAKEH40D4W256
	XMSSMTSHAKEH40D8W256
	XMSSMTSHAKEH60D3W256
	XMSSMTSHAKEH60D6W256
	XMSSMTSHAKEH60D12W256
	XMSSMTSHAKEH20D2W512
	XMSSMTSHAKEH20D4W512
	XMSSMTSHAKEH40D2W512
	XMSSMTSHAKEH40D4W512
	XMSSMTSHAKEH40D8W512
	XMSSMTSHAKEH60D3W512
	XMSSMTSHAKEH60D6W512
	XMSSMTSHAKEH60D12W512
)

XMSS-MT types

Variables

This section is empty.

Functions

func KeyGen

func KeyGen(oid uint) (*SK, *PK, error)

KeyGen generates an XMSS key pair

func MTkeyGen

func MTkeyGen(oid uint) (*MTSK, *MTPK, error)

MTkeyGen generates an XMSS^MT key pair

Types

type MTPK

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

A MTPK represents an XMSS^MT public key.

func ParseMTPK

func ParseMTPK(pk string) (*MTPK, error)

ParseMTPK parses an XMSS^MT public key in hexadecimal.

func (*MTPK) String

func (mtpk *MTPK) String() string

String serializes the public key and converts it to a hexadecimal string.

func (*MTPK) Verify

func (mtpk *MTPK) Verify(message, mtsig []byte) bool

Verify an XMSS^MT signature using the corresponding XMSS^MT public key and a message.

type MTSK

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

A MTSK represents an XMSS^MT private key.

func ParseMTSK

func ParseMTSK(sk string) (*MTSK, error)

ParseMTSK parses an XMSS^MT private key in hexadecimal.

func (*MTSK) Public

func (mtsk *MTSK) Public() *MTPK

Public generates the public key of a private key.

func (*MTSK) Sign

func (mtsk *MTSK) Sign(message []byte) ([]byte, error)

Sign generates an XMSS^MT signature and updates the XMSS^MT private key.

func (*MTSK) String

func (mtsk *MTSK) String() string

String serializes the private key and converts it to a hexadecimal string.

type PK

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

A PK represents an XMSS public key.

func ParsePK

func ParsePK(pk string) (*PK, error)

ParsePK parses an XMSS public key in hexadecimal.

func (*PK) String

func (xpk *PK) String() string

String serializes the public key and converts it to a hexadecimal string.

func (*PK) Verify

func (xpk *PK) Verify(message []byte, xsig []byte) bool

Verify an XMSS signature using the corresponding XMSS public key and a message.

type SK

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

A SK represents an XMSS private key.

func ParseSK

func ParseSK(sk string) (*SK, error)

ParseSK parses an XMSS private key in hexadecimal.

func (*SK) Public

func (xsk *SK) Public() *PK

Public generates the public key of a private key.

func (*SK) Sign

func (xsk *SK) Sign(message []byte) ([]byte, error)

Sign generates an XMSS signature and updates the XMSS private key.

func (*SK) String

func (xsk *SK) String() string

String serializes the private key and converts it to a hexadecimal string.

Jump to

Keyboard shortcuts

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