serverlib

package
v0.0.0-...-a26456e Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FinishTransaction

func FinishTransaction(t *transaction.Transaction) (err error)

FinishTransaction 将交易标记为已完成 该方法应该在交易完成,签名验证后,且更新交易双方账户后使用

func GetUpdatedBalance

func GetUpdatedBalance(tx *transaction.Transaction, balanceSender, balanceReceipt *rlwe.Ciphertext) (updatedSender *rlwe.Ciphertext, updatedReceipt *rlwe.Ciphertext, err error)

func GetUpdatedReceiptBalance

func GetUpdatedReceiptBalance(tx *transaction.Transaction, balance *rlwe.Ciphertext) (updated *rlwe.Ciphertext, err error)

GetUpdatedReceiptBalance 计算新的接收方余额,也就是包装过的密文加法 输入原余额和变动金额,输出新的余额

func GetUpdatedSenderBalance

func GetUpdatedSenderBalance(tx *transaction.Transaction, balance *rlwe.Ciphertext) (updated *rlwe.Ciphertext, err error)

GetUpdatedSenderBalance 计算新的发送方余额,也就是包装过的密文减法 输入原余额和变动金额,输出新的余额

func InitializeNewReceiptPKTransaction

func InitializeNewReceiptPKTransaction(t *transaction.Transaction) (err error)

func InitializeNewSenderPKTransaction

func InitializeNewSenderPKTransaction(t *transaction.Transaction) (err error)

func KeySwitchReceiptToSender

func KeySwitchReceiptToSender(t *transaction.Transaction, swk *rlwe.SwitchingKey) (err error)

func KeySwitchSenderToReceipt

func KeySwitchSenderToReceipt(t *transaction.Transaction, swk *rlwe.SwitchingKey) (err error)

func NewEmptyEvaluator

func NewEmptyEvaluator() ckks.Evaluator

func ReEncryptCTWithSwk

func ReEncryptCTWithSwk(ctIn *rlwe.Ciphertext, swk *rlwe.SwitchingKey) (ctOut *rlwe.Ciphertext, err error)

func Recover

func Recover(f func()) (err error)

func RequestSwitchingKey

func RequestSwitchingKey(uIn, uOut *uuid.UUID, caUrl string) (swk *rlwe.SwitchingKey, err error)

RequestSwitchingKey 向 CA 请求重加密密钥

func ValidateSignatureBase

func ValidateSignatureBase(msg []byte, sig []byte, pk *ecdsa.PublicKey) (isValid bool)

func ValidateSignatureForAcceptCipherText

func ValidateSignatureForAcceptCipherText(ct interface{}, sig []byte, pk *ecdsa.PublicKey) (isValid bool, err error)

ValidateSignatureForAcceptCipherText 输入公钥和密文和签名 输出验证结果

func ValidateSignatureForCipherText

func ValidateSignatureForCipherText(ct interface{}, sig []byte, pk *ecdsa.PublicKey) (isValid bool, err error)

ValidateSignatureForCipherText 输入公钥和密文和签名 输出验证结果

Types

type User

type User struct {
	users.User

	Balance *rlwe.Ciphertext
}

不同于客户端,服务端只能看到用户的公钥,以及用户的余额密文

Jump to

Keyboard shortcuts

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