Documentation
¶
Index ¶
- Variables
- type ECDSA
- func AddNamedCurve(curve elliptic.Curve, oid asn1.ObjectIdentifier) ECDSA
- func FromBase64String(data string) ECDSA
- func FromBytes(data []byte) ECDSA
- func FromHexString(data string) ECDSA
- func FromPKCS1PrivateKey(key []byte) ECDSA
- func FromPKCS1PrivateKeyDer(der []byte) ECDSA
- func FromPKCS1PrivateKeyWithPassword(key []byte, password string) ECDSA
- func FromPKCS8PrivateKey(key []byte) ECDSA
- func FromPKCS8PrivateKeyDer(der []byte) ECDSA
- func FromPKCS8PrivateKeyWithPassword(key []byte, password string) ECDSA
- func FromPrivateKey(key []byte) ECDSA
- func FromPrivateKeyWithPassword(key []byte, password string) ECDSA
- func FromPublicKey(key []byte) ECDSA
- func FromPublicKeyDer(der []byte) ECDSA
- func FromString(data string) ECDSA
- func GenerateKey(curve string) ECDSA
- func GenerateKeyWithSeed(reader io.Reader, curve string) ECDSA
- func New() ECDSA
- func NewECDSA() ECDSA
- func (this ECDSA) AddNamedCurve(curve elliptic.Curve, oid asn1.ObjectIdentifier) ECDSA
- func (this ECDSA) AppendError(err ...error) ECDSA
- func (this ECDSA) CheckKeyPair() bool
- func (this ECDSA) CreatePKCS1PrivateKey() ECDSA
- func (this ECDSA) CreatePKCS1PrivateKeyWithPassword(password string, opts ...string) ECDSA
- func (this ECDSA) CreatePKCS8PrivateKey() ECDSA
- func (this ECDSA) CreatePKCS8PrivateKeyWithPassword(password string, opts ...any) ECDSA
- func (this ECDSA) CreatePrivateKey() ECDSA
- func (this ECDSA) CreatePrivateKeyWithPassword(password string, opts ...string) ECDSA
- func (this ECDSA) CreatePublicKey() ECDSA
- func (this ECDSA) Decrypt() ECDSA
- func (this ECDSA) Encrypt() ECDSA
- func (this ECDSA) Error() error
- func (this ECDSA) FromBase64String(data string) ECDSA
- func (this ECDSA) FromBytes(data []byte) ECDSA
- func (this ECDSA) FromHexString(data string) ECDSA
- func (this ECDSA) FromPKCS1PrivateKey(key []byte) ECDSA
- func (this ECDSA) FromPKCS1PrivateKeyDer(der []byte) ECDSA
- func (this ECDSA) FromPKCS1PrivateKeyWithPassword(key []byte, password string) ECDSA
- func (this ECDSA) FromPKCS8PrivateKey(key []byte) ECDSA
- func (this ECDSA) FromPKCS8PrivateKeyDer(der []byte) ECDSA
- func (this ECDSA) FromPKCS8PrivateKeyWithPassword(key []byte, password string) ECDSA
- func (this ECDSA) FromPrivateKey(key []byte) ECDSA
- func (this ECDSA) FromPrivateKeyBytes(priByte []byte) ECDSA
- func (this ECDSA) FromPrivateKeyString(keyString string) ECDSA
- func (this ECDSA) FromPrivateKeyWithPassword(key []byte, password string) ECDSA
- func (this ECDSA) FromPublicKey(key []byte) ECDSA
- func (this ECDSA) FromPublicKeyBytes(pub []byte) ECDSA
- func (this ECDSA) FromPublicKeyCompressString(key string) ECDSA
- func (this ECDSA) FromPublicKeyDer(der []byte) ECDSA
- func (this ECDSA) FromPublicKeyString(key string) ECDSA
- func (this ECDSA) FromPublicKeyUncompressString(key string) ECDSA
- func (this ECDSA) FromPublicKeyXYBytes(xBytes, yBytes []byte) ECDSA
- func (this ECDSA) FromPublicKeyXYString(xString string, yString string) ECDSA
- func (this ECDSA) FromString(data string) ECDSA
- func (this ECDSA) GenerateKey() ECDSA
- func (this ECDSA) GenerateKeyWithSeed(reader io.Reader) ECDSA
- func (this ECDSA) GetCurve() elliptic.Curve
- func (this ECDSA) GetData() []byte
- func (this ECDSA) GetEncoding() EncodingType
- func (this ECDSA) GetErrors() []error
- func (this ECDSA) GetKeyData() []byte
- func (this ECDSA) GetParsedData() []byte
- func (this ECDSA) GetPrivateKey() *ecdsa.PrivateKey
- func (this ECDSA) GetPrivateKeyCurve() elliptic.Curve
- func (this ECDSA) GetPrivateKeyDString() string
- func (this ECDSA) GetPrivateKeyString() string
- func (this ECDSA) GetPublicKey() *ecdsa.PublicKey
- func (this ECDSA) GetPublicKeyCompressString() string
- func (this ECDSA) GetPublicKeyCurve() elliptic.Curve
- func (this ECDSA) GetPublicKeyUncompressString() string
- func (this ECDSA) GetPublicKeyXString() string
- func (this ECDSA) GetPublicKeyXYString() string
- func (this ECDSA) GetPublicKeyYString() string
- func (this ECDSA) GetSignHash() HashFunc
- func (this ECDSA) GetVerify() bool
- func (this ECDSA) MakeKeyDer() ECDSA
- func (this ECDSA) MakePublicKey() ECDSA
- func (this ECDSA) OnError(fn func([]error)) ECDSA
- func (this ECDSA) ParsePKCS1PrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error)
- func (this ECDSA) ParsePKCS1PrivateKeyFromPEMWithPassword(key []byte, password string) (*ecdsa.PrivateKey, error)
- func (this ECDSA) ParsePKCS8PrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error)
- func (this ECDSA) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password string) (*ecdsa.PrivateKey, error)
- func (this ECDSA) ParsePublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error)
- func (this ECDSA) SetCurve(curve string) ECDSA
- func (this ECDSA) SetSignHash(name string) ECDSA
- func (this ECDSA) Sign() ECDSA
- func (this ECDSA) SignASN1() ECDSA
- func (this ECDSA) SignBytes() ECDSA
- func (this ECDSA) ToBase64String() string
- func (this ECDSA) ToBytes() []byte
- func (this ECDSA) ToHexString() string
- func (this ECDSA) ToKeyBytes() []byte
- func (this ECDSA) ToKeyString() string
- func (this ECDSA) ToString() string
- func (this ECDSA) ToVerify() bool
- func (this ECDSA) ToVerifyInt() int
- func (this ECDSA) Verify(data []byte) ECDSA
- func (this ECDSA) VerifyASN1(data []byte) ECDSA
- func (this ECDSA) VerifyBytes(data []byte) ECDSA
- func (this ECDSA) WithCurve(curve elliptic.Curve) ECDSA
- func (this ECDSA) WithData(data []byte) ECDSA
- func (this ECDSA) WithEncoding(encoding EncodingType) ECDSA
- func (this ECDSA) WithEncodingASN1() ECDSA
- func (this ECDSA) WithEncodingBytes() ECDSA
- func (this ECDSA) WithErrors(errs []error) ECDSA
- func (this ECDSA) WithParsedData(data []byte) ECDSA
- func (this ECDSA) WithPrivateKey(data *ecdsa.PrivateKey) ECDSA
- func (this ECDSA) WithPublicKey(data *ecdsa.PublicKey) ECDSA
- func (this ECDSA) WithSignHash(hash HashFunc) ECDSA
- func (this ECDSA) WithVerify(data bool) ECDSA
- type EncodingType
- type HashFunc
- type Opts
- type PBKDF2Opts
- type ScryptOpts
Constants ¶
This section is empty.
Variables ¶
var ( // Get cipher from name GetCipherFromName = pkcs8.GetCipherFromName // Get hash from name GetHashFromName = pkcs8.GetHashFromName )
var ( ErrKeyMustBePEMEncoded = errors.New("go-cryptobin/ecdsa: invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") ErrNotECPublicKey = errors.New("go-cryptobin/ecdsa: key is not a valid ECDSA public key") ErrNotECPrivateKey = errors.New("go-cryptobin/ecdsa: key is not a valid ECDSA private key") )
Functions ¶
This section is empty.
Types ¶
type ECDSA ¶
type ECDSA struct {
// error list
Errors []error
// contains filtered or unexported fields
}
*
- ECDSA *
- @create 2022-4-3
- @author deatil
func AddNamedCurve ¶
func AddNamedCurve(curve elliptic.Curve, oid asn1.ObjectIdentifier) ECDSA
Add Named Curve
func FromPKCS1PrivateKeyDer ¶
From PKCS1 PrivateKey Der bytes
func FromPKCS1PrivateKeyWithPassword ¶
From PKCS1 PrivateKey bytes With Password
func FromPKCS8PrivateKeyDer ¶
From PKCS8 PrivateKey Der bytes
func FromPKCS8PrivateKeyWithPassword ¶
From PKCS8 PrivateKey bytes With Password
func FromPrivateKeyWithPassword ¶
From PrivateKey bytes With Password
func GenerateKey ¶
GenerateKey curve list [P521 | P384 | P256 | P224]
func GenerateKeyWithSeed ¶
GenerateKey With Seed curve list [P521 | P384 | P256 | P224]
func (ECDSA) AddNamedCurve ¶
Add Named Curve
func (ECDSA) CreatePKCS1PrivateKey ¶
Create PKCS1 PrivateKey PEM data
func (ECDSA) CreatePKCS1PrivateKeyWithPassword ¶
Create PKCS1 PrivateKey PEM data with password
func (ECDSA) CreatePKCS8PrivateKey ¶
Create PKCS8 PrivateKey PEM data
func (ECDSA) CreatePKCS8PrivateKeyWithPassword ¶
Create PKCS8 PrivateKey PEM data with password CreatePKCS8PrivateKeyWithPassword("123", "AES256CBC", "SHA256")
func (ECDSA) CreatePrivateKey ¶
生成私钥 pem 数据, PKCS1 别名 Create PrivateKey PEM data example: obj := New().WithCurve("P521").GenerateKey() priKey := obj.CreatePrivateKey().ToKeyString()
func (ECDSA) CreatePrivateKeyWithPassword ¶
生成私钥带密码 pem 数据, PKCS1 别名 Create PrivateKey PEM data with password CreatePrivateKeyWithPassword("123", "AES256CBC") PEMCipher: DESCBC | DESEDE3CBC | AES128CBC | AES192CBC | AES256CBC
func (ECDSA) FromBase64String ¶
From Base64 String
func (ECDSA) FromPKCS1PrivateKey ¶
From PKCS1 PrivateKey bytes
func (ECDSA) FromPKCS1PrivateKeyDer ¶
From PKCS1 PrivateKey Der bytes
func (ECDSA) FromPKCS1PrivateKeyWithPassword ¶
From PKCS1 PrivateKey bytes With Password
func (ECDSA) FromPKCS8PrivateKey ¶
From PKCS8 PrivateKey bytes
func (ECDSA) FromPKCS8PrivateKeyDer ¶
From PKCS8 PrivateKey Der bytes
func (ECDSA) FromPKCS8PrivateKeyWithPassword ¶
From PKCS8 PrivateKey bytes With Password
func (ECDSA) FromPrivateKey ¶
From PrivateKey bytes
func (ECDSA) FromPrivateKeyBytes ¶
From PublicKey Bytes and need set curve 明文私钥生成私钥结构体 需要设置对应的 curve
func (ECDSA) FromPrivateKeyString ¶
From PrivateKey String and need set curve private-key: 07e4********;
func (ECDSA) FromPrivateKeyWithPassword ¶
From PrivateKey bytes With Password
func (ECDSA) FromPublicKeyBytes ¶
From PublicKey Bytes and need set curve 公钥明文, hex 或者 base64 解码后 需要设置对应的 curve
func (ECDSA) FromPublicKeyCompressString ¶
From PublicKey Compress String 公钥明文压缩 需要设置对应的 curve public-key hex: 027c******** || 036c********
func (ECDSA) FromPublicKeyDer ¶
From PublicKey Der bytes
func (ECDSA) FromPublicKeyString ¶
From PublicKey String and need set curve 公钥明文,需要设置对应的 curve
func (ECDSA) FromPublicKeyUncompressString ¶
From PublicKey Uncompress String 公钥明文未压缩 需要设置对应的 curve public-key hex: 047c********.
func (ECDSA) FromPublicKeyXYBytes ¶
From PublicKey XY Bytes 公钥字符对,需要设置对应的 curve
func (ECDSA) FromPublicKeyXYString ¶
From PublicKey XY String 公钥 x,y 16进制字符对 需要设置对应的 curve [xString: xHexString, yString: yHexString]
func (ECDSA) GenerateKeyWithSeed ¶
GenerateKey With Seed
func (ECDSA) GetPrivateKeyCurve ¶
get PrivateKey Curve
func (ECDSA) GetPrivateKeyDString ¶
get PrivateKey D hex string
func (ECDSA) GetPrivateKeyString ¶
get PrivateKey data hex string
func (ECDSA) GetPublicKeyCompressString ¶
get PublicKey Compress Hex string
func (ECDSA) GetPublicKeyCurve ¶
get PublicKey Curve
func (ECDSA) GetPublicKeyUncompressString ¶
get PublicKey Uncompress Hex string
func (ECDSA) GetPublicKeyXString ¶
get PublicKey X hex string
func (ECDSA) GetPublicKeyXYString ¶
get PublicKey X and Y Hex string
func (ECDSA) GetPublicKeyYString ¶
get PublicKey Y hex string
func (ECDSA) ParsePKCS1PrivateKeyFromPEM ¶
func (this ECDSA) ParsePKCS1PrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error)
Parse PKCS1 PrivateKey From PEM
func (ECDSA) ParsePKCS1PrivateKeyFromPEMWithPassword ¶
func (this ECDSA) ParsePKCS1PrivateKeyFromPEMWithPassword(key []byte, password string) (*ecdsa.PrivateKey, error)
Parse PKCS1 PrivateKey From PEM With Password
func (ECDSA) ParsePKCS8PrivateKeyFromPEM ¶
func (this ECDSA) ParsePKCS8PrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error)
Parse PKCS8 PrivateKey From PEM
func (ECDSA) ParsePKCS8PrivateKeyFromPEMWithPassword ¶
func (this ECDSA) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password string) (*ecdsa.PrivateKey, error)
Parse PKCS8 PrivateKey From PEM With Password
func (ECDSA) ParsePublicKeyFromPEM ¶
Parse PublicKey From PEM
func (ECDSA) VerifyASN1 ¶
publicKey Verify from asn1 encode data 使用原始数据[data]对比签名后数据
func (ECDSA) VerifyBytes ¶
publicKey Verify from bytes encode data 使用原始数据[data]对比签名后数据
func (ECDSA) WithEncoding ¶
func (this ECDSA) WithEncoding(encoding EncodingType) ECDSA
With encoding
func (ECDSA) WithEncodingASN1 ¶
encoding ASN1 encoding type
func (ECDSA) WithEncodingBytes ¶
encoding Bytes encoding type
func (ECDSA) WithPrivateKey ¶
func (this ECDSA) WithPrivateKey(data *ecdsa.PrivateKey) ECDSA
With PrivateKey
func (ECDSA) WithPublicKey ¶
With PublicKey
type EncodingType ¶
type EncodingType uint
数据编码方式 marshal data type
const ( EncodingASN1 EncodingType = 1 + iota EncodingBytes )