Documentation ¶
Index ¶
- Constants
- func AESDecrypt(key []byte, cryptoText string) string
- func AESEncrypt(key []byte, text string) (string, string)
- func DecipherKeyStore(keyStore KeyStore, password string) string
- func EncPublicKey(rawPublicKey []byte, keyType int) string
- func GetEncAddress(rawPublicKey []byte, chainCode string, keyType int) string
- func GetEncPrivateKey(privateKey []byte, keyType int) string
- func GetEncPublicKey(encPrivateKey []byte) (string, error)
- func GetRawPrivateKey(encPrivateKey []byte) (int, []byte, error)
- func GetRawPublicKey(encPublicKey []byte) []byte
- func IsAddressValid(encAddress string) bool
- func Sign(encPrivate []byte, message []byte) ([]byte, error)
- func Verify(encPublicKey []byte, msg []byte, signMsg []byte) bool
- type KeyPairEntity
- type KeyStore
- type PrivateKeyManager
- type PublicKeyManager
- type ScryptParams
Constants ¶
View Source
const ( // ED25519算法 ED25519 = iota + 1 // SM2算法 SM2 // 加密类型关键字 ED25519_VALUE = 'e' SM2_VALUE = 'z' // 字符编码类型关键字 BASE_58_VALUE = 'f' )
Variables ¶
This section is empty.
Functions ¶
func AESDecrypt ¶
AESDecrypt Decrypt from base64 to decrypted string
func DecipherKeyStore ¶
func EncPublicKey ¶
EncPublicKey 原生公钥转星火公钥
func GetEncAddress ¶
GetEncAddress 获取地址
func GetEncPrivateKey ¶
GetEncPrivateKey 原生私钥转星火私钥
func GetEncPublicKey ¶
GetEncPublicKey 星火私钥获取星火公钥
func GetRawPrivateKey ¶
GetRawPrivateKey 星火私钥转原生私钥
Types ¶
type KeyPairEntity ¶
type KeyPairEntity struct { EncAddress string EncPublicKey string EncPrivateKey string RawPrivateKey []byte RawPublicKey []byte }
func GetBidAndKeyPair ¶
func GetBidAndKeyPair() (*KeyPairEntity, error)
func GetBidAndKeyPairBySM2 ¶
func GetBidAndKeyPairBySM2() (*KeyPairEntity, error)
func (*KeyPairEntity) GetEncAddress ¶
func (k *KeyPairEntity) GetEncAddress() string
func (*KeyPairEntity) GetEncPrivateKey ¶
func (k *KeyPairEntity) GetEncPrivateKey() string
func (*KeyPairEntity) GetEncPublicKey ¶
func (k *KeyPairEntity) GetEncPublicKey() string
func (*KeyPairEntity) GetRawPrivateKey ¶
func (k *KeyPairEntity) GetRawPrivateKey() []byte
func (*KeyPairEntity) GetRawPublicKey ¶
func (k *KeyPairEntity) GetRawPublicKey() []byte
type KeyStore ¶
type KeyStore struct { Address string AesctrIv string CypherText string ScryptParams Version int }
type PrivateKeyManager ¶
type PrivateKeyManager struct { EncPrivateKey string // 星火私钥 RawPrivateKey []byte // 原生私钥 RawPublicKey []byte // 原生公钥 TypeKey string // 加密类型 }
func GetPrivateKeyManager ¶
func GetPrivateKeyManager(keyType int) (*PrivateKeyManager, error)
func GetPrivateKeyManagerByPrivateKey ¶
func GetPrivateKeyManagerByPrivateKey(encPrivateKey string) (*PrivateKeyManager, error)
GetPrivateKeyManagerByPrivateKey 根据星火私钥获取私钥对象
func GetPrivateKeyManagerByRand ¶
func GetPrivateKeyManagerByRand(seed []byte, keyType int) (*PrivateKeyManager, error)
type PublicKeyManager ¶
func GetPublicKeyManager ¶
func GetPublicKeyManager(encPrivateKey []byte, keyType int) (*PublicKeyManager, error)
func GetPublicKeyManagerByPublicKey ¶
func GetPublicKeyManagerByPublicKey(encPublicKey string) (*PublicKeyManager, error)
GetPublicKeyManagerByPublicKey
Click to show internal directories.
Click to hide internal directories.