hybrid

package
v0.0.0-...-37ff43f Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK                     = 0
	CRYPTO_SECRETKEY_BYTES = 64 + 1281 + 897
	CRYPTO_PUBLICKEY_BYTES = 32 + 897
	CRYPTO_SIGNATURE_BYTES = 2 + 2 + 64 + CRYPTO_MESSAGE_LEN + 40 + 690 //Nonce + 2 for size
	CRYPTO_MESSAGE_LEN     = 32                                         //todo: validate this
	SIG_NAME               = "Falcon-512-ed25519"
)

Variables

View Source
var (
	ErrSignatureInitial       = errors.New("signature mechanism is not supported by OQS")
	ErrInvalidMsgLen          = errors.New("invalid message length, need max 64 bytes")
	ErrInvalidSignatureLen    = errors.New("invalid signature length")
	ErrInvalidPublicKeyLen    = errors.New("invalid public key length")
	ErrInvalidPrivateKeyLen   = errors.New("invalid private key length")
	ErrInvalidRecoveryID      = errors.New("invalid signature recovery id")
	ErrInvalidKey             = errors.New("invalid private key")
	ErrInvalidPubkey          = errors.New("invalid public key")
	ErrMismatchPublicKey      = errors.New("mismatch public key")
	ErrSignFailed             = errors.New("signing failed")
	ErrRecoverFailed          = errors.New("recovery failed")
	ErrKeypairFailed          = errors.New("can not generate keypair")
	ErrInvalidLen             = errors.New("invalid length")
	ErrVerifyFailed           = errors.New("verify length")
	ErrRecoverPublicKeyFailed = errors.New("recover public key length")
)

Functions

func GenerateKey

func GenerateKey() (publicKey []byte, secretKey []byte, err error)

func PrivateAndPublicFromPrivateKey

func PrivateAndPublicFromPrivateKey(compositePrivateKey []byte) (privateBytes []byte, publicBytes []byte, err error)

func Sign

func Sign(secretKey []byte, message []byte) ([]byte, error)

func Verify

func Verify(message []byte, signature []byte, publicKey []byte) error

Verify verifies the validity of a signed message, returning true if the signature is valid, and false otherwise.

Types

type HybridSig

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

func CreateHybridSig

func CreateHybridSig() HybridSig

func (HybridSig) CombinePublicKeySignature

func (s HybridSig) CombinePublicKeySignature(sigBytes []byte, pubKeyBytes []byte) (combinedSignature []byte, err error)

func (HybridSig) DecodePublicKey

func (s HybridSig) DecodePublicKey(encoded []byte) (*signaturealgorithm.PublicKey, error)

func (HybridSig) DeserializePrivateKey

func (s HybridSig) DeserializePrivateKey(priv []byte) (*signaturealgorithm.PrivateKey, error)

func (HybridSig) DeserializePublicKey

func (s HybridSig) DeserializePublicKey(pub []byte) (*signaturealgorithm.PublicKey, error)

func (HybridSig) EncodePublicKey

func (s HybridSig) EncodePublicKey(pubKey *signaturealgorithm.PublicKey) []byte

func (HybridSig) GenerateKey

func (s HybridSig) GenerateKey() (*signaturealgorithm.PrivateKey, error)

func (HybridSig) HexToPrivateKey

func (s HybridSig) HexToPrivateKey(hexkey string) (*signaturealgorithm.PrivateKey, error)

func (HybridSig) HexToPrivateKeyNoError

func (s HybridSig) HexToPrivateKeyNoError(hexkey string) *signaturealgorithm.PrivateKey

func (HybridSig) HexToPublicKey

func (s HybridSig) HexToPublicKey(hexkey string) (*signaturealgorithm.PublicKey, error)

func (HybridSig) LoadPrivateKeyFromFile

func (s HybridSig) LoadPrivateKeyFromFile(file string) (*signaturealgorithm.PrivateKey, error)

func (HybridSig) PrivateKeyLength

func (s HybridSig) PrivateKeyLength() int

func (HybridSig) PrivateKeyToHex

func (s HybridSig) PrivateKeyToHex(priv *signaturealgorithm.PrivateKey) (string, error)

func (HybridSig) PublicKeyAndSignatureFromCombinedSignature

func (s HybridSig) PublicKeyAndSignatureFromCombinedSignature(digestHash []byte, sig []byte) (signature []byte, pubKey []byte, err error)

func (HybridSig) PublicKeyBytesFromSignature

func (s HybridSig) PublicKeyBytesFromSignature(digestHash []byte, sig []byte) ([]byte, error)

func (HybridSig) PublicKeyFromSignature

func (s HybridSig) PublicKeyFromSignature(digestHash []byte, sig []byte) (*signaturealgorithm.PublicKey, error)

func (HybridSig) PublicKeyLength

func (s HybridSig) PublicKeyLength() int

func (HybridSig) PublicKeyStartValue

func (s HybridSig) PublicKeyStartValue() byte

func (HybridSig) PublicKeyToAddress

func (s HybridSig) PublicKeyToAddress(p *signaturealgorithm.PublicKey) (common.Address, error)

func (HybridSig) PublicKeyToAddressNoError

func (s HybridSig) PublicKeyToAddressNoError(p *signaturealgorithm.PublicKey) common.Address

func (HybridSig) PublicKeyToHex

func (s HybridSig) PublicKeyToHex(pub *signaturealgorithm.PublicKey) (string, error)

func (HybridSig) SavePrivateKeyToFile

func (s HybridSig) SavePrivateKeyToFile(file string, key *signaturealgorithm.PrivateKey) error

func (HybridSig) SerializePrivateKey

func (s HybridSig) SerializePrivateKey(priv *signaturealgorithm.PrivateKey) ([]byte, error)

func (HybridSig) SerializePublicKey

func (s HybridSig) SerializePublicKey(pub *signaturealgorithm.PublicKey) ([]byte, error)

func (HybridSig) Sign

func (s HybridSig) Sign(digestHash []byte, prv *signaturealgorithm.PrivateKey) (sig []byte, err error)

func (HybridSig) SignatureLength

func (s HybridSig) SignatureLength() int

func (HybridSig) SignatureName

func (s HybridSig) SignatureName() string

func (HybridSig) SignatureStartValue

func (s HybridSig) SignatureStartValue() byte

func (HybridSig) SignatureWithPublicKeyLength

func (s HybridSig) SignatureWithPublicKeyLength() int

func (HybridSig) ValidateSignatureValues

func (osig HybridSig) ValidateSignatureValues(v byte, r, s *big.Int, homestead bool) bool

ValidateSignatureValues verifies whether the signature values are valid with the given chain rules. The v value is assumed to be either 0 or 1.

func (HybridSig) Verify

func (s HybridSig) Verify(pubKey []byte, digestHash []byte, signature []byte) bool

func (HybridSig) Zeroize

func (s HybridSig) Zeroize(prv *signaturealgorithm.PrivateKey)

Jump to

Keyboard shortcuts

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