mocksignaturealgorithm

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 = 64 + 1281 + 897 //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 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 MockSig

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

func CreateMockSig

func CreateMockSig() MockSig

func (MockSig) CombinePublicKeySignature

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

func (MockSig) DecodePublicKey

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

func (MockSig) DeserializePrivateKey

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

func (MockSig) DeserializePublicKey

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

func (MockSig) EncodePublicKey

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

func (MockSig) GenerateKey

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

func (MockSig) HexToPrivateKey

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

func (MockSig) HexToPrivateKeyNoError

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

func (MockSig) HexToPublicKey

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

func (MockSig) LoadPrivateKeyFromFile

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

func (MockSig) PrivateKeyLength

func (s MockSig) PrivateKeyLength() int

func (MockSig) PrivateKeyToHex

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

func (MockSig) PublicKeyAndSignatureFromCombinedSignature

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

func (MockSig) PublicKeyBytesFromSignature

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

func (MockSig) PublicKeyFromSignature

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

func (MockSig) PublicKeyLength

func (s MockSig) PublicKeyLength() int

func (MockSig) PublicKeyStartValue

func (s MockSig) PublicKeyStartValue() byte

func (MockSig) PublicKeyToAddress

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

func (MockSig) PublicKeyToAddressNoError

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

func (MockSig) PublicKeyToHex

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

func (MockSig) SavePrivateKeyToFile

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

func (MockSig) SerializePrivateKey

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

func (MockSig) SerializePublicKey

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

func (MockSig) Sign

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

func (MockSig) SignatureLength

func (s MockSig) SignatureLength() int

func (MockSig) SignatureName

func (s MockSig) SignatureName() string

func (MockSig) SignatureStartValue

func (s MockSig) SignatureStartValue() byte

func (MockSig) SignatureWithPublicKeyLength

func (s MockSig) SignatureWithPublicKeyLength() int

func (MockSig) ValidateSignatureValues

func (osig MockSig) 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 (MockSig) Verify

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

func (MockSig) Zeroize

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

Jump to

Keyboard shortcuts

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