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