Documentation ¶
Overview ¶
Package crypto is a generated protocol buffer package.
It is generated from these files:
crazybits/x/crypto/crypto.proto
It has these top-level messages:
PublicKey PrivateKey Signature
Index ¶
- Variables
- func CompressedPublicKeyToHexString(pub *secp256k1.PublicKey) string
- func Decode(b string) []byte
- func Decrypt(password string, cipherText []byte) []byte
- func Encode(b []byte) string
- func Encrypt(password string, plainText []byte) []byte
- func HexToPrivateKey(hexkey string) *secp256k1.PrivateKey
- func PrivateKeyToHexString(priv *secp256k1.PrivateKey) string
- func PublicKeyToHexString(pub *secp256k1.PublicKey) string
- func StrToPrivateKey(str string) *secp256k1.PrivateKey
- func ToECDSA(prv []byte) *ecdsa.PrivateKey
- type CryptoType
- type PrivateKey
- func (*PrivateKey) Descriptor() ([]byte, []int)
- func (privateKey *PrivateKey) GenerateSharedSecret(publicKey *PublicKey) []byte
- func (*PrivateKey) ProtoMessage()
- func (privateKey *PrivateKey) PublicKey() *PublicKey
- func (m *PrivateKey) Reset()
- func (privateKey *PrivateKey) Sign(hash []byte) *Signature
- func (m *PrivateKey) String() string
- type PublicKey
- type Signature
Constants ¶
This section is empty.
Variables ¶
var CryptoType_name = map[int32]string{
0: "ECDSA",
1: "RSA",
2: "DSA",
}
var CryptoType_value = map[string]int32{
"ECDSA": 0,
"RSA": 1,
"DSA": 2,
}
Functions ¶
func CompressedPublicKeyToHexString ¶
CompressedPublicKeyToHexString convert secp256k1 compressed public key to hex string
func HexToPrivateKey ¶
func HexToPrivateKey(hexkey string) *secp256k1.PrivateKey
HexToPrivateKey convert hex private key to secp256k1 private key
func PrivateKeyToHexString ¶
func PrivateKeyToHexString(priv *secp256k1.PrivateKey) string
PrivateKeyToHexString convert secp256k1 private key to hex string
func PublicKeyToHexString ¶
PublicKeyToHexString convert secp256k1 uncompressed public key to hex string
func StrToPrivateKey ¶
func StrToPrivateKey(str string) *secp256k1.PrivateKey
StrToPrivateKey generate private key from given string
func ToECDSA ¶
func ToECDSA(prv []byte) *ecdsa.PrivateKey
ToECDSA convert bytes to ecdsa private key
Types ¶
type CryptoType ¶
type CryptoType int32
const ( CryptoType_ECDSA CryptoType = 0 CryptoType_RSA CryptoType = 1 CryptoType_DSA CryptoType = 2 )
func (CryptoType) EnumDescriptor ¶
func (CryptoType) EnumDescriptor() ([]byte, []int)
func (CryptoType) String ¶
func (x CryptoType) String() string
type PrivateKey ¶
type PrivateKey struct { Type CryptoType `protobuf:"varint,1,opt,name=type,enum=crypto.CryptoType" json:"type,omitempty"` Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` }
func GenePrivateKeyFromSeed ¶
func GenePrivateKeyFromSeed(hash []byte) *PrivateKey
GenePrivateKeyFromSeed generate private key from seed
func (*PrivateKey) Descriptor ¶
func (*PrivateKey) Descriptor() ([]byte, []int)
func (*PrivateKey) GenerateSharedSecret ¶
func (privateKey *PrivateKey) GenerateSharedSecret(publicKey *PublicKey) []byte
GenerateSharedSecret generate shared secret between self private key and target public key
func (*PrivateKey) ProtoMessage ¶
func (*PrivateKey) ProtoMessage()
func (*PrivateKey) PublicKey ¶
func (privateKey *PrivateKey) PublicKey() *PublicKey
PublicKey get the compressed public key
func (*PrivateKey) Reset ¶
func (m *PrivateKey) Reset()
func (*PrivateKey) Sign ¶
func (privateKey *PrivateKey) Sign(hash []byte) *Signature
Sign sign the provided data
func (*PrivateKey) String ¶
func (m *PrivateKey) String() string
type PublicKey ¶
type PublicKey struct { Type CryptoType `protobuf:"varint,1,opt,name=type,enum=crypto.CryptoType" json:"type,omitempty"` Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` }
func (*PublicKey) Descriptor ¶
func (*PublicKey) ProtoMessage ¶
func (*PublicKey) ProtoMessage()
type Signature ¶
type Signature struct { Type CryptoType `protobuf:"varint,1,opt,name=type,enum=crypto.CryptoType" json:"type,omitempty"` R []byte `protobuf:"bytes,2,opt,name=r,proto3" json:"r,omitempty"` S []byte `protobuf:"bytes,3,opt,name=s,proto3" json:"s,omitempty"` }
func (*Signature) Descriptor ¶
func (*Signature) ProtoMessage ¶
func (*Signature) ProtoMessage()