Documentation ¶
Index ¶
- Variables
- func GetGroupIDFromName(name string) dh.GroupID
- 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) FromKeyXYHexString(name string, xString string, yString string) Dh
- func (this Dh) FromPrivateKey(key []byte) Dh
- func (this Dh) FromPrivateKeyWithPassword(key []byte, password string) Dh
- func (this Dh) FromPrivateKeyXHexString(name string, xString string) Dh
- func (this Dh) FromPrivateKeyXHexStringWithGroup(group *dh.Group, xString string) Dh
- func (this Dh) FromPublicKey(key []byte) Dh
- func (this Dh) FromPublicKeyYHexString(name string, yString string) Dh
- func (this Dh) FromPublicKeyYHexStringWithGroup(group *dh.Group, yString string) 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) GetPrivateKeyXHexString() string
- func (this Dh) GetPublicKey() *dh.PublicKey
- func (this Dh) GetPublicKeyParametersGHexString() string
- func (this Dh) GetPublicKeyParametersPHexString() string
- func (this Dh) GetPublicKeyYHexString() string
- 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 Group
- 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 ¶
func GetGroupIDFromName ¶ added in v1.0.1025
根据名称获取分组
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) FromKeyXYHexString ¶ added in v1.0.1025
根据密钥 x, y 生成
func (Dh) FromPrivateKeyWithPassword ¶
私钥带密码
func (Dh) FromPrivateKeyXHexString ¶ added in v1.0.1025
根据私钥 x 生成
func (Dh) FromPrivateKeyXHexStringWithGroup ¶ added in v1.0.1025
根据私钥 x 生成
func (Dh) FromPublicKeyYHexString ¶ added in v1.0.1025
根据公钥 y 生成
func (Dh) FromPublicKeyYHexStringWithGroup ¶ added in v1.0.1025
根据公钥 y 生成
func (Dh) GetPrivateKeyXHexString ¶ added in v1.0.1025
获取 X 16进制字符
func (Dh) GetPublicKeyParametersGHexString ¶ added in v1.0.1025
获取 G 16进制字符
func (Dh) GetPublicKeyParametersPHexString ¶ added in v1.0.1025
获取 P 16进制字符
func (Dh) GetPublicKeyYHexString ¶ added in v1.0.1025
获取 Y 16进制字符
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.