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