privacy

package
v6.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2019 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// KeyLen32 key Length
	KeyLen32 = 32
)

Variables

This section is empty.

Functions

func CheckRingSignature

func CheckRingSignature(datahash []byte, signatures *types.RingSignatureItem, publickeys [][]byte, keyimage []byte) bool

CheckRingSignature 效验环签名的签名信息 效验数据datahash是一个哈

func GenerateKeyPair

func GenerateKeyPair(privKeyPrivacyPtr *PrivKeyPrivacy, pubKeyPrivacyPtr *PubKeyPrivacy)

GenerateKeyPair create key pair

func GenerateOneTimeAddr

func GenerateOneTimeAddr(viewPub, spendPub, skAddr32 *[32]byte, outputIndex int64) (pubkeyOnetime *[32]byte, errInfo error)

GenerateOneTimeAddr (A, B) => Hs(rA)G + B, rG=>R func GenerateOneTimeAddr(viewPub, spendPub, skAddr32 *[32]byte, outputIndex int64) (pubkeyOnetime, RtxPublicKey *[32]byte, errInfo error) {

func GenerateRingSignature

func GenerateRingSignature(datahash []byte, utxos []*privacytypes.UTXOBasic, privKey []byte, realUtxoIndex int, keyImage []byte) (*types.RingSignatureItem, error)

GenerateRingSignature create ring signature object

func RecoverOnetimePriKey

func RecoverOnetimePriKey(R []byte, viewSecretKey, spendSecretKey crypto.PrivKey, outputIndex int64) (crypto.PrivKey, error)

RecoverOnetimePriKey calculate Hs(aR) + b

Types

type KeyImage

type KeyImage [32]byte

KeyImage key image type

func GenerateKeyImage

func GenerateKeyImage(privkey crypto.PrivKey, pubkey []byte) (*KeyImage, error)

GenerateKeyImage 根据给定的公钥和私钥信息生成对应的秘钥镜像

func (*KeyImage) String

func (image *KeyImage) String() string

type PrivKeyPrivacy

type PrivKeyPrivacy [privateKeyLen]byte

PrivKeyPrivacy struct data type

func (PrivKeyPrivacy) Bytes

func (privKey PrivKeyPrivacy) Bytes() []byte

Bytes convert to bytes

func (PrivKeyPrivacy) Equals

func (privKey PrivKeyPrivacy) Equals(other crypto.PrivKey) bool

Equals check equals

func (PrivKeyPrivacy) PubKey

func (privKey PrivKeyPrivacy) PubKey() crypto.PubKey

PubKey get public key

func (PrivKeyPrivacy) Sign

func (privKey PrivKeyPrivacy) Sign(msg []byte) crypto.Signature

Sign signature trasaction

type Privacy

type Privacy struct {
	ViewPubkey   PubKeyPrivacy
	ViewPrivKey  PrivKeyPrivacy
	SpendPubkey  PubKeyPrivacy
	SpendPrivKey PrivKeyPrivacy
}

Privacy privacy struct type

func NewPrivacy

func NewPrivacy() *Privacy

NewPrivacy create privacy object

func NewPrivacyWithPrivKey

func NewPrivacyWithPrivKey(privKey *[KeyLen32]byte) (privacy *Privacy, err error)

NewPrivacyWithPrivKey create privacy from private key

type PubKeyPrivacy

type PubKeyPrivacy [publicKeyLen]byte

PubKeyPrivacy key struct types

func Bytes2PubKeyPrivacy

func Bytes2PubKeyPrivacy(in []byte) PubKeyPrivacy

Bytes2PubKeyPrivacy convert bytes to PubKeyPrivacy

func (PubKeyPrivacy) Bytes

func (pubKey PubKeyPrivacy) Bytes() []byte

Bytes convert to bytes

func (PubKeyPrivacy) Equals

func (pubKey PubKeyPrivacy) Equals(other crypto.PubKey) bool

Equals check equals

func (PubKeyPrivacy) KeyString

func (pubKey PubKeyPrivacy) KeyString() string

KeyString convert to string

func (PubKeyPrivacy) VerifyBytes

func (pubKey PubKeyPrivacy) VerifyBytes(msg []byte, sig crypto.Signature) bool

VerifyBytes verify bytes

type RingSignED25519

type RingSignED25519 struct {
}

RingSignED25519 对应crypto.Crypto的接口实现

func (*RingSignED25519) GenKey

func (r *RingSignED25519) GenKey() (crypto.PrivKey, error)

GenKey create privacy key

func (*RingSignED25519) PrivKeyFromBytes

func (r *RingSignED25519) PrivKeyFromBytes(b []byte) (crypto.PrivKey, error)

PrivKeyFromBytes create private key from bytes

func (*RingSignED25519) PubKeyFromBytes

func (r *RingSignED25519) PubKeyFromBytes(b []byte) (crypto.PubKey, error)

PubKeyFromBytes create publick key from bytes

func (*RingSignED25519) SignatureFromBytes

func (r *RingSignED25519) SignatureFromBytes(b []byte) (crypto.Signature, error)

SignatureFromBytes create signature from bytes

type RingSignPrivateKey

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

RingSignPrivateKey 环签名中对于crypto.PrivKey接口实现

func (*RingSignPrivateKey) Bytes

func (privkey *RingSignPrivateKey) Bytes() []byte

Bytes convert key to bytest

func (*RingSignPrivateKey) Equals

func (privkey *RingSignPrivateKey) Equals(other crypto.PrivKey) bool

Equals check key equal

func (*RingSignPrivateKey) PubKey

func (privkey *RingSignPrivateKey) PubKey() crypto.PubKey

PubKey convert to public key

func (*RingSignPrivateKey) Sign

func (privkey *RingSignPrivateKey) Sign(msg []byte) crypto.Signature

Sign signature trasaction

type RingSignPublicKey

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

RingSignPublicKey 环签名中对于crypto.PubKey接口实现

func (*RingSignPublicKey) Bytes

func (pubkey *RingSignPublicKey) Bytes() []byte

Bytes convert key to bytes

func (*RingSignPublicKey) Equals

func (pubkey *RingSignPublicKey) Equals(other crypto.PubKey) bool

Equals check key is equal

func (*RingSignPublicKey) KeyString

func (pubkey *RingSignPublicKey) KeyString() string

KeyString convert key to string

func (*RingSignPublicKey) VerifyBytes

func (pubkey *RingSignPublicKey) VerifyBytes(msg []byte, sign crypto.Signature) bool

VerifyBytes verify bytes

type RingSignature

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

RingSignature 环签名中对于crypto.Signature接口实现

func (*RingSignature) Bytes

func (r *RingSignature) Bytes() []byte

Bytes convert to bytest

func (*RingSignature) Equals

func (r *RingSignature) Equals(other crypto.Signature) bool

Equals check equals

func (*RingSignature) IsZero

func (r *RingSignature) IsZero() bool

IsZero check is zero

func (*RingSignature) String

func (r *RingSignature) String() string

String convert to string

type Sign

type Sign [64]byte

Sign signature data struct type

type SignatureOnetime

type SignatureOnetime [64]byte

SignatureOnetime sinature data type

func (SignatureOnetime) Bytes

func (sig SignatureOnetime) Bytes() []byte

Bytes get bytes

func (SignatureOnetime) Equals

func (sig SignatureOnetime) Equals(other crypto.Signature) bool

Equals check signature equal

func (SignatureOnetime) IsZero

func (sig SignatureOnetime) IsZero() bool

IsZero check is zero

func (SignatureOnetime) String

func (sig SignatureOnetime) String() string

String format to string

type SignatureS

type SignatureS struct {
	crypto.Signature
}

SignatureS signature data

Jump to

Keyboard shortcuts

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