bliss

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: ISC Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BSTypeBliss = 4

	BlissVersion = 1

	BlissPubKeyLen = 897

	BlissPrivKeyLen = 385
)

Variables

View Source
var Bliss = newBlissDSA()

Secp256k1 is the secp256k1 curve and ECDSA system used in Bitcoin.

View Source
var BlissDSA = newBlissDSA()

Functions

func SignCompact

func SignCompact(key hxcrypto.PrivateKey, hash []byte) ([]byte, error)

func VerifyCompact

func VerifyCompact(key hxcrypto.PublicKey, messageHash, sign []byte) (bool, error)

Types

type DSA

type DSA interface {

	// ----------------------------------------------------------------------------
	// Private keys
	//
	// NewPrivateKey instantiates a new private key for the given data
	NewPrivateKey(s1, s2, a *poly.PolyArray) hccrypto.PrivateKey

	// PrivKeyFromBytes calculates the public key from serialized bytes,
	// and returns both it and the private key.
	PrivKeyFromBytes(pk []byte) (hccrypto.PrivateKey, hccrypto.PublicKey)

	// PrivKeyBytesLen returns the length of a serialized private key.
	PrivKeyBytesLen() int

	// ----------------------------------------------------------------------------
	// Public keys
	//
	// NewPublicKey instantiates a new public key (point) for the given data.
	NewPublicKey(a *poly.PolyArray) hccrypto.PublicKey

	// ParsePubKey parses a serialized public key for the given
	// curve and returns a public key.
	ParsePubKey(pubKeyStr []byte) (hccrypto.PublicKey, error)

	// PubKeyBytesLen returns the length of the default serialization
	// method for a public key.
	PubKeyBytesLen() int

	// ----------------------------------------------------------------------------
	// Signatures
	//
	// NewSignature instantiates a new signature
	NewSignature(z1, z2 *poly.PolyArray, c []uint32) hccrypto.Signature

	// ParseDERSignature parses a DER encoded signature .
	// If the method doesn't support DER signatures, it
	// just parses with the default method.
	ParseDERSignature(sigStr []byte) (hccrypto.Signature, error)

	// ParseSignature a default encoded signature
	ParseSignature(sigStr []byte) (hccrypto.Signature, error)

	// RecoverCompact recovers a public key from an encoded signature
	// and message, then verifies the signature against the public
	// key.
	RecoverCompact(signature, hash []byte) (hccrypto.PublicKey, bool, error)

	// ----------------------------------------------------------------------------
	// Bliss
	//
	// GenerateKey generates a new private and public keypair from the
	// given reader.
	GenerateKey(rand io.Reader) (hccrypto.PrivateKey, hccrypto.PublicKey, error)

	// Sign produces an Bliss signature using a private key and a message.
	Sign(priv hccrypto.PrivateKey, hash []byte) (hccrypto.Signature, error)

	// Verify verifies an Bliss signature against a given message and
	// public key.
	Verify(pub hccrypto.PublicKey, hash []byte, sig hccrypto.Signature) bool
}

type PrivateKey

type PrivateKey struct {
	hccrypto.PrivateKeyAdapter
	bliss.PrivateKey
}

func (PrivateKey) GetType

func (p PrivateKey) GetType() int

GetType satisfies the bliss PrivateKey interface.

func (PrivateKey) PublicKey

func (p PrivateKey) PublicKey() hccrypto.PublicKey

Public returns the PublicKey corresponding to this private key.

func (PrivateKey) Serialize

func (p PrivateKey) Serialize() []byte

type PublicKey

type PublicKey struct {
	hccrypto.PublicKeyAdapter
	bliss.PublicKey
}

func (PublicKey) GetType

func (p PublicKey) GetType() int

func (PublicKey) Serialize

func (p PublicKey) Serialize() []byte

func (PublicKey) SerializeCompressed

func (p PublicKey) SerializeCompressed() []byte

func (PublicKey) SerializeUnCompressed

func (p PublicKey) SerializeUnCompressed() []byte

type Signature

type Signature struct {
	hxcrypto.SignatureAdapter
	bliss.Signature
}

func (Signature) GetType

func (s Signature) GetType() int

func (Signature) Serialize

func (s Signature) Serialize() []byte

Jump to

Keyboard shortcuts

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