Documentation ¶
Index ¶
- Constants
- func CheckRingSignature(datahash []byte, signatures *types.RingSignatureItem, publickeys [][]byte, ...) bool
- func GenerateKeyPair(privKeyPrivacyPtr *PrivKeyPrivacy, pubKeyPrivacyPtr *PubKeyPrivacy)
- func GenerateOneTimeAddr(viewPub, spendPub, skAddr32 *[32]byte, outputIndex int64) (pubkeyOnetime *[32]byte, errInfo error)
- func GenerateRingSignature(datahash []byte, utxos []*privacytypes.UTXOBasic, privKey []byte, ...) (*types.RingSignatureItem, error)
- func RecoverOnetimePriKey(R []byte, viewSecretKey, spendSecretKey crypto.PrivKey, outputIndex int64) (crypto.PrivKey, error)
- type KeyImage
- type PrivKeyPrivacy
- type Privacy
- type PubKeyPrivacy
- type RingSignED25519
- func (r *RingSignED25519) GenKey() (crypto.PrivKey, error)
- func (r *RingSignED25519) PrivKeyFromBytes(b []byte) (crypto.PrivKey, error)
- func (r *RingSignED25519) PubKeyFromBytes(b []byte) (crypto.PubKey, error)
- func (r *RingSignED25519) SignatureFromBytes(b []byte) (crypto.Signature, error)
- func (r *RingSignED25519) Validate(msg, pub, sig []byte) error
- type RingSignPrivateKey
- type RingSignPublicKey
- type RingSignature
- type Sign
- type SignatureOnetime
- type SignatureS
Constants ¶
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
Types ¶
type KeyImage ¶
type KeyImage [32]byte
KeyImage key image type
func GenerateKeyImage ¶
GenerateKeyImage 根据给定的公钥和私钥信息生成对应的秘钥镜像
type PrivKeyPrivacy ¶
type PrivKeyPrivacy [privateKeyLen]byte
PrivKeyPrivacy struct data type
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
type Privacy ¶
type Privacy struct { ViewPubkey PubKeyPrivacy ViewPrivKey PrivKeyPrivacy SpendPubkey PubKeyPrivacy SpendPrivKey PrivKeyPrivacy }
Privacy privacy struct type
type PubKeyPrivacy ¶
type PubKeyPrivacy [publicKeyLen]byte
PubKeyPrivacy key struct types
func Bytes2PubKeyPrivacy ¶
func Bytes2PubKeyPrivacy(in []byte) PubKeyPrivacy
Bytes2PubKeyPrivacy convert bytes to PubKeyPrivacy
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
func (*RingSignED25519) Validate ¶ added in v1.65.2
func (r *RingSignED25519) Validate(msg, pub, sig []byte) error
Validate validate msg and signature
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
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接口实现
type SignatureOnetime ¶
type SignatureOnetime [64]byte
SignatureOnetime sinature data type
func (SignatureOnetime) Equals ¶
func (sig SignatureOnetime) Equals(other crypto.Signature) bool
Equals check signature equal
func (SignatureOnetime) String ¶
func (sig SignatureOnetime) String() string
String format to string