Documentation ¶
Index ¶
- Variables
- type BIP0340
- func FromBase64String(data string) BIP0340
- func FromBytes(data []byte) BIP0340
- func FromHexString(data string) BIP0340
- func FromPKCS1PrivateKey(key []byte) BIP0340
- func FromPKCS1PrivateKeyWithPassword(key []byte, password string) BIP0340
- func FromPKCS8PrivateKey(key []byte) BIP0340
- func FromPKCS8PrivateKeyWithPassword(key []byte, password string) BIP0340
- func FromPrivateKey(key []byte) BIP0340
- func FromPrivateKeyWithPassword(key []byte, password string) BIP0340
- func FromPublicKey(key []byte) BIP0340
- func FromString(data string) BIP0340
- func GenerateKey(curve string) BIP0340
- func GenerateKeyWithSeed(reader io.Reader, curve string) BIP0340
- func New() BIP0340
- func NewBIP0340() BIP0340
- func (this BIP0340) AppendError(err ...error) BIP0340
- func (this BIP0340) CheckKeyPair() bool
- func (this BIP0340) CreatePKCS1PrivateKey() BIP0340
- func (this BIP0340) CreatePKCS1PrivateKeyWithPassword(password string, opts ...string) BIP0340
- func (this BIP0340) CreatePKCS8PrivateKey() BIP0340
- func (this BIP0340) CreatePKCS8PrivateKeyWithPassword(password string, opts ...any) BIP0340
- func (this BIP0340) CreatePrivateKey() BIP0340
- func (this BIP0340) CreatePrivateKeyWithPassword(password string, opts ...string) BIP0340
- func (this BIP0340) CreatePublicKey() BIP0340
- func (this BIP0340) Error() error
- func (this BIP0340) FromBase64String(data string) BIP0340
- func (this BIP0340) FromBytes(data []byte) BIP0340
- func (this BIP0340) FromHexString(data string) BIP0340
- func (this BIP0340) FromPKCS1PrivateKey(key []byte) BIP0340
- func (this BIP0340) FromPKCS1PrivateKeyDer(der []byte) BIP0340
- func (this BIP0340) FromPKCS1PrivateKeyWithPassword(key []byte, password string) BIP0340
- func (this BIP0340) FromPKCS8PrivateKey(key []byte) BIP0340
- func (this BIP0340) FromPKCS8PrivateKeyDer(der []byte) BIP0340
- func (this BIP0340) FromPKCS8PrivateKeyWithPassword(key []byte, password string) BIP0340
- func (this BIP0340) FromPrivateKey(key []byte) BIP0340
- func (this BIP0340) FromPrivateKeyBytes(priByte []byte) BIP0340
- func (this BIP0340) FromPrivateKeyString(keyString string) BIP0340
- func (this BIP0340) FromPrivateKeyWithPassword(key []byte, password string) BIP0340
- func (this BIP0340) FromPublicKey(key []byte) BIP0340
- func (this BIP0340) FromPublicKeyBytes(pub []byte) BIP0340
- func (this BIP0340) FromPublicKeyCompressString(key string) BIP0340
- func (this BIP0340) FromPublicKeyDer(der []byte) BIP0340
- func (this BIP0340) FromPublicKeyString(key string) BIP0340
- func (this BIP0340) FromPublicKeyUncompressString(key string) BIP0340
- func (this BIP0340) FromPublicKeyXYBytes(xBytes, yBytes []byte) BIP0340
- func (this BIP0340) FromPublicKeyXYString(xString string, yString string) BIP0340
- func (this BIP0340) FromString(data string) BIP0340
- func (this BIP0340) GenerateKey() BIP0340
- func (this BIP0340) GenerateKeyWithSeed(reader io.Reader) BIP0340
- func (this BIP0340) GetCurve() elliptic.Curve
- func (this BIP0340) GetData() []byte
- func (this BIP0340) GetEncoding() EncodingType
- func (this BIP0340) GetErrors() []error
- func (this BIP0340) GetKeyData() []byte
- func (this BIP0340) GetParsedData() []byte
- func (this BIP0340) GetPrivateKey() *bip0340.PrivateKey
- func (this BIP0340) GetPrivateKeyCurve() elliptic.Curve
- func (this BIP0340) GetPrivateKeyDString() string
- func (this BIP0340) GetPrivateKeyString() string
- func (this BIP0340) GetPublicKey() *bip0340.PublicKey
- func (this BIP0340) GetPublicKeyCompressString() string
- func (this BIP0340) GetPublicKeyCurve() elliptic.Curve
- func (this BIP0340) GetPublicKeyUncompressString() string
- func (this BIP0340) GetPublicKeyXString() string
- func (this BIP0340) GetPublicKeyXYString() string
- func (this BIP0340) GetPublicKeyYString() string
- func (this BIP0340) GetSignHash() HashFunc
- func (this BIP0340) GetVerify() bool
- func (this BIP0340) MakeKeyDer() BIP0340
- func (this BIP0340) MakePublicKey() BIP0340
- func (this BIP0340) OnError(fn Bip0340ErrorFunc) BIP0340
- func (this BIP0340) ParsePKCS1PrivateKeyFromPEM(key []byte) (*bip0340.PrivateKey, error)
- func (this BIP0340) ParsePKCS1PrivateKeyFromPEMWithPassword(key []byte, password string) (*bip0340.PrivateKey, error)
- func (this BIP0340) ParsePKCS8PrivateKeyFromPEM(key []byte) (*bip0340.PrivateKey, error)
- func (this BIP0340) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password string) (*bip0340.PrivateKey, error)
- func (this BIP0340) ParsePublicKeyFromPEM(key []byte) (*bip0340.PublicKey, error)
- func (this BIP0340) SetCurve(curve string) BIP0340
- func (this BIP0340) SetSignHash(name string) BIP0340
- func (this BIP0340) Sign() BIP0340
- func (this BIP0340) SignASN1() BIP0340
- func (this BIP0340) SignBytes() BIP0340
- func (this BIP0340) ToBase64String() string
- func (this BIP0340) ToBytes() []byte
- func (this BIP0340) ToHexString() string
- func (this BIP0340) ToKeyBytes() []byte
- func (this BIP0340) ToKeyString() string
- func (this BIP0340) ToString() string
- func (this BIP0340) ToVerify() bool
- func (this BIP0340) ToVerifyInt() int
- func (this BIP0340) Verify(data []byte) BIP0340
- func (this BIP0340) VerifyASN1(data []byte) BIP0340
- func (this BIP0340) VerifyBytes(data []byte) BIP0340
- func (this BIP0340) WithCurve(curve elliptic.Curve) BIP0340
- func (this BIP0340) WithData(data []byte) BIP0340
- func (this BIP0340) WithEncoding(encoding EncodingType) BIP0340
- func (this BIP0340) WithEncodingASN1() BIP0340
- func (this BIP0340) WithEncodingBytes() BIP0340
- func (this BIP0340) WithErrors(errs []error) BIP0340
- func (this BIP0340) WithParsedData(data []byte) BIP0340
- func (this BIP0340) WithPrivateKey(data *bip0340.PrivateKey) BIP0340
- func (this BIP0340) WithPublicKey(data *bip0340.PublicKey) BIP0340
- func (this BIP0340) WithSignHash(hash HashFunc) BIP0340
- func (this BIP0340) WithVerify(data bool) BIP0340
- type Bip0340ErrorFunc
- type EncodingType
- type HashFunc
- type Opts
- type PBKDF2Opts
- type ScryptOpts
Constants ¶
This section is empty.
Variables ¶
var ( // 获取 Cipher 类型 GetCipherFromName = pkcs8.GetCipherFromName // 获取 hash 类型 GetHashFromName = pkcs8.GetHashFromName )
Functions ¶
This section is empty.
Types ¶
type BIP0340 ¶
type BIP0340 struct { // 错误 Errors []error // contains filtered or unexported fields }
*
- BIP0340 *
- @create 2024-12-24
- @author deatil
func FromPKCS1PrivateKeyWithPassword ¶
私钥带密码
func FromPKCS8PrivateKeyWithPassword ¶
PKCS8 私钥带密码
func FromPrivateKeyWithPassword ¶
私钥
func GenerateKey ¶
生成密钥 可选 [P521 | P384 | P256 | P224 | S256]
func GenerateKeyWithSeed ¶
生成密钥 可选 [P521 | P384 | P256 | P224 | S256]
func (BIP0340) CreatePKCS1PrivateKey ¶
生成私钥 pem 数据
func (BIP0340) CreatePKCS1PrivateKeyWithPassword ¶
生成私钥带密码 pem 数据
func (BIP0340) CreatePKCS8PrivateKey ¶
生成 PKCS8 私钥 pem 数据
func (BIP0340) CreatePKCS8PrivateKeyWithPassword ¶
生成 PKCS8 私钥带密码 pem 数据 CreatePKCS8PrivateKeyWithPassword("123", "AES256CBC", "SHA256")
func (BIP0340) CreatePrivateKey ¶
生成私钥 pem 数据, PKCS1 别名 使用: obj := New().WithCurve("P521").GenerateKey() priKey := obj.CreatePrivateKey().ToKeyString()
func (BIP0340) CreatePrivateKeyWithPassword ¶
生成私钥带密码 pem 数据, PKCS1 别名 CreatePrivateKeyWithPassword("123", "AES256CBC") PEMCipher: DESCBC | DESEDE3CBC | AES128CBC | AES192CBC | AES256CBC
func (BIP0340) FromPKCS1PrivateKeyDer ¶
DER 私钥
func (BIP0340) FromPKCS1PrivateKeyWithPassword ¶
私钥带密码
func (BIP0340) FromPKCS8PrivateKey ¶
PKCS8 私钥
func (BIP0340) FromPKCS8PrivateKeyDer ¶
DER 私钥
func (BIP0340) FromPKCS8PrivateKeyWithPassword ¶
Pkcs8WithPassword
func (BIP0340) FromPrivateKeyBytes ¶
明文私钥生成私钥结构体 需要设置对应的 curve
func (BIP0340) FromPrivateKeyString ¶
私钥明文,需要设置对应的 curve private-key: 07e4********;
func (BIP0340) FromPrivateKeyWithPassword ¶
私钥带密码
func (BIP0340) FromPublicKeyBytes ¶
公钥明文, hex 或者 base64 解码后 需要设置对应的 curve
func (BIP0340) FromPublicKeyCompressString ¶
公钥明文压缩 需要设置对应的 curve public-key hex: 027c******** || 036c********
func (BIP0340) FromPublicKeyString ¶
公钥明文,需要设置对应的 curve
func (BIP0340) FromPublicKeyUncompressString ¶
公钥明文未压缩 需要设置对应的 curve public-key hex: 047c********.
func (BIP0340) FromPublicKeyXYBytes ¶
公钥字符对,需要设置对应的 curve
func (BIP0340) FromPublicKeyXYString ¶
公钥 x,y 16进制字符对 需要设置对应的 curve [xString: xHexString, yString: yHexString]
func (BIP0340) GenerateKeyWithSeed ¶
生成密钥
func (BIP0340) GetPrivateKey ¶
func (this BIP0340) GetPrivateKey() *bip0340.PrivateKey
get PrivateKey
func (BIP0340) GetPrivateKeyCurve ¶
get PrivateKey Curve
func (BIP0340) GetPrivateKeyDString ¶
get PrivateKey D hex string
func (BIP0340) GetPrivateKeyString ¶
get PrivateKey data hex string
func (BIP0340) GetPublicKeyCompressString ¶
get PublicKey Compress Hex string
func (BIP0340) GetPublicKeyCurve ¶
get PublicKey Curve
func (BIP0340) GetPublicKeyUncompressString ¶
get PublicKey Uncompress Hex string
func (BIP0340) GetPublicKeyXString ¶
get PublicKey X hex string
func (BIP0340) GetPublicKeyXYString ¶
get PublicKey X and Y Hex string
func (BIP0340) GetPublicKeyYString ¶
get PublicKey Y hex string
func (BIP0340) ParsePKCS1PrivateKeyFromPEM ¶
func (this BIP0340) ParsePKCS1PrivateKeyFromPEM(key []byte) (*bip0340.PrivateKey, error)
解析私钥
func (BIP0340) ParsePKCS1PrivateKeyFromPEMWithPassword ¶
func (this BIP0340) ParsePKCS1PrivateKeyFromPEMWithPassword(key []byte, password string) (*bip0340.PrivateKey, error)
解析私钥带密码
func (BIP0340) ParsePKCS8PrivateKeyFromPEM ¶
func (this BIP0340) ParsePKCS8PrivateKeyFromPEM(key []byte) (*bip0340.PrivateKey, error)
解析私钥
func (BIP0340) ParsePKCS8PrivateKeyFromPEMWithPassword ¶
func (this BIP0340) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password string) (*bip0340.PrivateKey, error)
解析 PKCS8 带密码的私钥
func (BIP0340) ParsePublicKeyFromPEM ¶
解析公钥
func (BIP0340) VerifyASN1 ¶
公钥验证 ASN1 使用原始数据[data]对比签名后数据
func (BIP0340) VerifyBytes ¶
公钥验证 Bytes 使用原始数据[data]对比签名后数据
func (BIP0340) WithEncoding ¶
func (this BIP0340) WithEncoding(encoding EncodingType) BIP0340
设置编码方式
func (BIP0340) WithParsedData ¶
设置 parsedData
func (BIP0340) WithPrivateKey ¶
func (this BIP0340) WithPrivateKey(data *bip0340.PrivateKey) BIP0340
设置 PrivateKey
func (BIP0340) WithPublicKey ¶
设置 PublicKey
type EncodingType ¶
type EncodingType uint
数据编码方式 marshal data type
const ( EncodingASN1 EncodingType = 1 + iota EncodingBytes )