Documentation ¶
Index ¶
- Variables
- type Ecdsa
- func FromBase64String(data string) Ecdsa
- func FromBytes(data []byte) Ecdsa
- func FromHexString(data string) Ecdsa
- func FromPKCS8PrivateKey(key []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 FromString(data string) Ecdsa
- func GenerateKey(hash string) Ecdsa
- func New() Ecdsa
- func NewEcdsa() Ecdsa
- func (this Ecdsa) CreatePKCS8KdfPrivateKeyWithPassword(password string, opts ...any) Ecdsa
- func (this Ecdsa) CreatePKCS8PbePrivateKeyWithPassword(password string, alg 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) DataHash(signHash string, data []byte) []byte
- func (this Ecdsa) FromBase64String(data string) Ecdsa
- func (this Ecdsa) FromBytes(data []byte) Ecdsa
- func (this Ecdsa) FromHexString(data string) Ecdsa
- func (this Ecdsa) FromPKCS8PrivateKey(key []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) FromPrivateKeyDBytes(DBytes []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) FromPublicKeyString(keyString 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) GetData() []byte
- func (this Ecdsa) GetError() error
- func (this Ecdsa) GetKeyData() []byte
- func (this Ecdsa) GetParedData() []byte
- func (this Ecdsa) GetPrivateKey() *ecdsa.PrivateKey
- func (this Ecdsa) GetPrivateKeyCurve() elliptic.Curve
- func (this Ecdsa) GetPrivateKeyDHexString() string
- func (this Ecdsa) GetPrivateKeyXHexString() string
- func (this Ecdsa) GetPrivateKeyYHexString() string
- func (this Ecdsa) GetPublicKey() *ecdsa.PublicKey
- func (this Ecdsa) GetPublicKeyCurve() elliptic.Curve
- func (this Ecdsa) GetPublicKeyXHexString() string
- func (this Ecdsa) GetPublicKeyYHexString() string
- func (this Ecdsa) GetSignHash() string
- func (this Ecdsa) GetVeryed() bool
- func (this Ecdsa) MakePublicKey() Ecdsa
- func (this Ecdsa) OnError(fn EcdsaErrorFunc) Ecdsa
- func (this Ecdsa) ParseECPKCS8PrivateKeyFromPEMWithPassword(key []byte, password string) (*ecdsa.PrivateKey, error)
- func (this Ecdsa) ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error)
- func (this Ecdsa) ParseECPrivateKeyFromPEMWithPassword(key []byte, password string) (*ecdsa.PrivateKey, error)
- func (this Ecdsa) ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error)
- func (this Ecdsa) Sign(separator ...string) Ecdsa
- func (this Ecdsa) SignAsn1() Ecdsa
- func (this Ecdsa) SignHex() 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) ToVeryed() bool
- func (this Ecdsa) VerifyAsn1(data []byte) Ecdsa
- func (this Ecdsa) VerifyHex(data []byte) Ecdsa
- func (this Ecdsa) Very(data []byte, separator ...string) Ecdsa
- func (this Ecdsa) WithCurve(curve string) Ecdsa
- func (this Ecdsa) WithData(data []byte) Ecdsa
- func (this Ecdsa) WithError(err error) Ecdsa
- func (this Ecdsa) WithParedData(data []byte) Ecdsa
- func (this Ecdsa) WithPrivateKey(data *ecdsa.PrivateKey) Ecdsa
- func (this Ecdsa) WithPublicKey(data *ecdsa.PublicKey) Ecdsa
- func (this Ecdsa) WithSignHash(hash string) Ecdsa
- func (this Ecdsa) WithVeryed(data bool) Ecdsa
- type EcdsaErrorFunc
- type Opts
- type PBKDF2Opts
- type ScryptOpts
Constants ¶
This section is empty.
Variables ¶
var ( // 获取 Cipher 类型 GetCipherFromName = cryptobin_pkcs8.GetCipherFromName // 获取 hash 类型 GetHashFromName = cryptobin_pkcs8.GetHashFromName )
var ( ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") ErrNotECPublicKey = errors.New("key is not a valid ECDSA public key") ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key") )
var PEMCiphers = map[string]x509.PEMCipher{ "DESCBC": x509.PEMCipherDES, "DESEDE3CBC": x509.PEMCipher3DES, "AES128CBC": x509.PEMCipherAES128, "AES192CBC": x509.PEMCipherAES192, "AES256CBC": x509.PEMCipherAES256, }
pem 加密方式
Functions ¶
This section is empty.
Types ¶
type Ecdsa ¶
type Ecdsa struct { // 错误 Error error // contains filtered or unexported fields }
*
- Ecdsa *
- @create 2022-4-3
- @author deatil
func FromPKCS8PrivateKeyWithPassword ¶ added in v1.0.1018
PKCS8 私钥带密码
func FromPrivateKeyWithPassword ¶ added in v1.0.1018
私钥
func GenerateKey ¶ added in v1.0.1018
生成密钥 可选 [P521 | P384 | P256 | P224]
func (Ecdsa) CreatePKCS8KdfPrivateKeyWithPassword ¶ added in v1.0.1022
生成 PKCS8 私钥带密码 pem 数据 CreatePKCS8KdfPrivateKeyWithPassword("123", "AES256CBC", "SHA256")
func (Ecdsa) CreatePKCS8PbePrivateKeyWithPassword ¶ added in v1.0.1022
生成 PKCS8 私钥带密码 pem 数据
func (Ecdsa) CreatePKCS8PrivateKey ¶
生成 PKCS8 私钥 pem 数据
func (Ecdsa) CreatePKCS8PrivateKeyWithPassword ¶
生成 PKCS8 私钥带密码 pem 数据 CreatePKCS8PrivateKeyWithPassword("123", "AES256CBC", "SHA256")
func (Ecdsa) CreatePrivateKey ¶
生成私钥 pem 数据 使用: obj := New().WithCurve("P521").GenerateKey() priKey := obj.CreatePrivateKey().ToKeyString()
func (Ecdsa) CreatePrivateKeyWithPassword ¶
生成私钥带密码 pem 数据 CreatePrivateKeyWithPassword("123", "AES256CBC")
func (Ecdsa) FromPKCS8PrivateKeyWithPassword ¶
Pkcs8WithPassword
func (Ecdsa) FromPrivateKeyBytes ¶
明文私钥生成私钥结构体
func (Ecdsa) FromPrivateKeyDBytes ¶
私钥字符,必须先添加公钥
func (Ecdsa) FromPrivateKeyString ¶
私钥字符,必须先添加公钥 (hexStringD)
func (Ecdsa) FromPrivateKeyWithPassword ¶
私钥带密码
func (Ecdsa) FromPublicKeyString ¶
公钥字符 (hexStringX + hexStringY)
func (Ecdsa) FromPublicKeyXYBytes ¶
公钥字符对
func (Ecdsa) FromPublicKeyXYString ¶ added in v1.0.1018
公钥 x,y 16进制字符对 [xString: xHexString, yString: yHexString]
func (Ecdsa) GetPrivateKeyCurve ¶
获取 PrivateKeyCurve
func (Ecdsa) GetPrivateKeyDHexString ¶ added in v1.0.1018
获取 PrivateKeyD
func (Ecdsa) GetPrivateKeyXHexString ¶ added in v1.0.1018
获取 PrivateKeyX
func (Ecdsa) GetPrivateKeyYHexString ¶ added in v1.0.1018
获取 PrivateKeyY
func (Ecdsa) GetPublicKeyCurve ¶
获取 PublicKeyCurve
func (Ecdsa) GetPublicKeyXHexString ¶ added in v1.0.1018
获取 PublicKeyX
func (Ecdsa) GetPublicKeyYHexString ¶ added in v1.0.1018
获取 PublicKeyY
func (Ecdsa) ParseECPKCS8PrivateKeyFromPEMWithPassword ¶
func (this Ecdsa) ParseECPKCS8PrivateKeyFromPEMWithPassword(key []byte, password string) (*ecdsa.PrivateKey, error)
解析 PKCS8 带密码的私钥
func (Ecdsa) ParseECPrivateKeyFromPEM ¶
func (this Ecdsa) ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error)
解析私钥
func (Ecdsa) ParseECPrivateKeyFromPEMWithPassword ¶
func (this Ecdsa) ParseECPrivateKeyFromPEMWithPassword(key []byte, password string) (*ecdsa.PrivateKey, error)
解析私钥带密码
func (Ecdsa) ParseECPublicKeyFromPEM ¶
解析公钥
func (Ecdsa) WithPrivateKey ¶
func (this Ecdsa) WithPrivateKey(data *ecdsa.PrivateKey) Ecdsa
设置 PrivateKey
func (Ecdsa) WithPublicKey ¶
设置 PublicKey