Documentation ¶
Overview ¶
* Copyright (c) 2019. Baidu Inc. All Rights Reserved.
* Copyright (c) 2019. Baidu Inc. All Rights Reserved.
* Copyright (c) 2019. Baidu Inc. All Rights Reserved.
* Copyright (c) 2019. Baidu Inc. All Rights Reserved.
* Copyright (c) 2019. Baidu Inc. All Rights Reserved.
Index ¶
- Constants
- Variables
- func AddNetAdmin(net, address string) error
- func AddNode(net, adminAddress, address string) error
- func CheckCaAdmin(address string) bool
- func CheckNetAdmin(address, net string) bool
- func CheckNode(address, net string) bool
- func DecryptByHdKey(net, adminAddress, hdPubKey, cypherText string) (string, error)
- func DecryptByNetHdPriKey(netHdPriKey, childHdPubKey, cypherText string) (string, error)
- func GenerateNetHdPriKey() (string, error)
- func GenerateNodeHdPriKey(total uint32, netHdPriKey string) (string, error)
- func GetRevokeList(net, latestSerialNum string) (*[]dao.Revoke, error)
- func RevokeNode(net, address string) (bool, error)
- func WriteCert(path string, cert *Cert) error
- type Cert
- type OriginalCert
Constants ¶
View Source
const ( HardenedKeyStart = 0x80000000 Language = 1 StrengthHard = 3 )
The range for hardened child keys is [2^31, 2^32 - 1].
View Source
const CERT_NAME = "root.crt"
View Source
const PRIVATEKEY_NAME = "root.key"
Variables ¶
View Source
var ( ErrNetExisted = errors.New("net has been existed") ErrParam = errors.New("params is illegal") ErrDB = errors.New("DB operate failed") ErrCACert = errors.New("can not get ca cert") ErrCreateCert = errors.New("create cert failed") ErrCertNoExisted = errors.New("cert is not existed") )
Functions ¶
func DecryptByHdKey ¶
解密一笔交易
func DecryptByNetHdPriKey ¶
交易解密
func GenerateNodeHdPriKey ¶
生成全节点的一级私钥
func GetRevokeList ¶
获取增量撤销列表
Types ¶
type Cert ¶
type Cert struct { Address string SerialNum string Cert string PrivateKey string CaCert string ValidTime int }
func GenerateCert ¶
func GenerateCert(caCert *OriginalCert, net string, root bool) (*Cert, error)
生成证书
type OriginalCert ¶
type OriginalCert struct { SerialNum string CaCert *x509.Certificate Cert *x509.Certificate PrivateKey *rsa.PrivateKey ValidTime int }
func GetAdminCert ¶
func GetAdminCert(net, adminAddress string) (*OriginalCert, string, error)
获取网络管理员的证书
Click to show internal directories.
Click to hide internal directories.