user

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ID          string   //User ID
	DA_         *big.Int //User secret value
	UAX         *big.Int // User public value
	UAY         *big.Int // User public value
	DA          *big.Int // User private key
	PAx, PAy    *big.Int
	PAx_, PAy_  *big.Int
	K           *big.Int
	R, S        *big.Int
	MessageHash []byte
)

Functions

func ComputeDA

func ComputeDA(tA, dA_ *big.Int, n *big.Int) *big.Int

Calculate dA

func ComputePA

func ComputePA(WAx, WAy, PpubX, PpubY *big.Int, lInteger *big.Int) (*big.Int, *big.Int)

Calculate PA = WA + [l]Ppub

func ComputePAPrime

func ComputePAPrime(dA *big.Int) (*big.Int, *big.Int)

Calculate P'A = [dA]G

func GenerateRandomScalar

func GenerateRandomScalar() (*big.Int, error)

Generate a random scalar k for signature calculation

func GenerateUserKeyPairSM2

func GenerateUserKeyPairSM2() error

GenerateUserKeyPairSM2,Generate user private key dA_ and public key UA based on SM2

func ProcessUserEmail

func ProcessUserEmail(id string)

receives the email and processes it

func SignMessageAndEncrypt

func SignMessageAndEncrypt(dA *big.Int) error

sign

func SignWithPrivateKey

func SignWithPrivateKey(dA *big.Int, messageHash []byte) (*big.Int, *big.Int, error)

Signature logic: generate signature based on private key and message hash

func VerifySignature

func VerifySignature(R, S, PAx, PAy *big.Int, messageHash [32]byte) bool

Verify signature

Types

This section is empty.

Jump to

Keyboard shortcuts

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