Documentation ¶
Index ¶
- Variables
- type Dh
- func (this Dh) CreateKdfPrivateKeyWithPassword(password string, opts ...any) Dh
- func (this Dh) CreatePbePrivateKeyWithPassword(password string, alg string) Dh
- func (this Dh) CreatePrivateKey() Dh
- func (this Dh) CreatePrivateKeyWithPassword(password string, opts ...any) Dh
- func (this Dh) CreatePublicKey() Dh
- func (this Dh) CreateSecret() Dh
- func (this Dh) FromPrivateKey(key []byte) Dh
- func (this Dh) FromPrivateKeyWithPassword(key []byte, password string) Dh
- func (this Dh) FromPublicKey(key []byte) Dh
- func (this Dh) GenerateKey(name string) Dh
- func (this Dh) GetError() error
- func (this Dh) GetKeyData() []byte
- func (this Dh) GetPrivateKey() *dh.PrivateKey
- func (this Dh) GetPublicKey() *dh.PublicKey
- func (this Dh) MakePublicKey() Dh
- func (this Dh) OnError(fn ErrorFunc) Dh
- func (this Dh) ParsePrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error)
- func (this Dh) ParsePrivateKeyFromPEMWithPassword(key []byte, password string) (crypto.PrivateKey, error)
- func (this Dh) ParsePublicKeyFromPEM(key []byte) (crypto.PublicKey, error)
- func (this Dh) ToBase64String() string
- func (this Dh) ToBytes() []byte
- func (this Dh) ToHexString() string
- func (this Dh) ToKeyBytes() []byte
- func (this Dh) ToKeyString() string
- func (this Dh) ToString() string
- func (this Dh) WithError(err error) Dh
- func (this Dh) WithKeyData(data []byte) Dh
- func (this Dh) WithPrivateKey(data *dh.PrivateKey) Dh
- func (this Dh) WithPublicKey(data *dh.PublicKey) Dh
- type ErrorFunc
- type Opts
- type PBKDF2Opts
- type ScryptOpts
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // 获取 Cipher 类型 GetCipherFromName = cryptobin_pkcs8.GetCipherFromName // 获取 hash 类型 GetHashFromName = cryptobin_pkcs8.GetHashFromName )
View Source
var ( ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") ErrNotPrivateKey = errors.New("key is not a valid dh private key") ErrNotPublicKey = errors.New("key is not a valid dh public key") )
View Source
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 Dh ¶
type Dh struct { // 错误 Error error // contains filtered or unexported fields }
*
- dh *
- @create 2022-8-7
- @author deatil
func (Dh) CreateKdfPrivateKeyWithPassword ¶
生成私钥带密码 pem 数据 CreateKdfPrivateKeyWithPassword("123", "AES256CBC", "SHA256")
func (Dh) CreatePbePrivateKeyWithPassword ¶
生成 PKCS8 私钥带密码 pem 数据
func (Dh) CreatePrivateKey ¶
生成私钥 pem 数据 使用: obj := New().GenerateKey("P2048") priKey := obj.CreatePrivateKey().ToKeyString()
func (Dh) CreatePrivateKeyWithPassword ¶
生成 PKCS8 私钥带密码 pem 数据 CreatePrivateKeyWithPassword("123", "AES256CBC", "SHA256")
func (Dh) FromPrivateKeyWithPassword ¶
私钥带密码
func (Dh) ParsePrivateKeyFromPEM ¶
func (this Dh) ParsePrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error)
解析私钥
func (Dh) ParsePrivateKeyFromPEMWithPassword ¶
func (this Dh) ParsePrivateKeyFromPEMWithPassword(key []byte, password string) (crypto.PrivateKey, error)
解析私钥带密码
func (Dh) ParsePublicKeyFromPEM ¶
解析公钥
Click to show internal directories.
Click to hide internal directories.