sphincsplus

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: AGPL-3.0, CC0-1.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// PublicKeySize is the size in bytes of the public key.
	PublicKeySize int = C.CRYPTO_PUBLICKEYBYTES

	// PrivateKeySize is the size in bytes of the private key.
	PrivateKeySize int = C.CRYPTO_SECRETKEYBYTES

	// SignatureSize is the size in bytes of the signature.
	SignatureSize int = C.CRYPTO_BYTES

	// ErrPublicKeySize indicates the raw data is not the correct size for a public key.
	ErrPublicKeySize error = fmt.Errorf("%s: raw public key data size is wrong", Name())

	// ErrPrivateKeySize indicates the raw data is not the correct size for a private key.
	ErrPrivateKeySize error = fmt.Errorf("%s: raw private key data size is wrong", Name())
)

Functions

func Name

func Name() string

Name returns the string naming of the current Sphincs+ that this binding is being used with.

func NewKeypair

func NewKeypair() (*PrivateKey, *PublicKey)

NewKeypair generates a new Sphincs+ keypair.

Types

type PrivateKey

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

PrivateKey is a private Sphincs+ key.

func (*PrivateKey) Bytes

func (p *PrivateKey) Bytes() []byte

Bytes returns the PrivateKey as a byte slice.

func (*PrivateKey) FromBytes

func (p *PrivateKey) FromBytes(data []byte) error

FromBytes loads a PrivateKey from the given byte slice.

func (*PrivateKey) Reset

func (p *PrivateKey) Reset()

Reset overwrites the key with zeros.

func (*PrivateKey) Sign

func (p *PrivateKey) Sign(message []byte) []byte

Sign signs the given message and returns the signature.

type PublicKey

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

PublicKey is a public Sphincs+ key.

func (*PublicKey) Bytes

func (p *PublicKey) Bytes() []byte

Bytes returns the PublicKey as a byte slice.

func (*PublicKey) FromBytes

func (p *PublicKey) FromBytes(data []byte) error

FromBytes loads a PublicKey from the given byte slice.

func (*PublicKey) Reset

func (p *PublicKey) Reset()

Reset overwrites the key with zeros.

func (*PublicKey) Verify

func (p *PublicKey) Verify(signature, message []byte) bool

Verify checks whether the given signature is valid.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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