Documentation
¶
Index ¶
- func Exists(path string) bool
- type Config
- type DecryptInterface
- type DecryptStringInterface
- type Ecc
- func (e *Ecc) Decrypt(cryptData []byte) ([]byte, error)
- func (e *Ecc) DecryptByPrivateKey(cryptData, privateKey []byte) ([]byte, error)
- func (e *Ecc) DecryptString(cryptData string) (string, error)
- func (e *Ecc) Encrypt(data []byte) ([]byte, error)
- func (e *Ecc) EncryptByPublicKey(data, publicKey []byte) ([]byte, error)
- func (e *Ecc) EncryptString(data string) (string, error)
- func (e *Ecc) GetKey() ([]byte, []byte, error)
- func (e *Ecc) InitKey() error
- func (e *Ecc) SetKeyData(privateKeyFilePath, publicKeyFilePath string) error
- func (e *Ecc) Sign(data []byte) ([]byte, error)
- func (e *Ecc) Verify(originData, signData []byte) bool
- type EncryptInterface
- type EncryptStringInterface
- type Key
- type Password
- func (p *Password) DecryptFile(filePath string) error
- func (p *Password) DecryptFileNoChangeName(filePath string) error
- func (p *Password) DecryptFileWithEncryptName(encryptFilePath string) error
- func (p *Password) EncryptFile(filePath string) error
- func (p *Password) EncryptFileNoChangeName(filePath string) error
- func (p *Password) GetEcc() *Ecc
- func (p *Password) GetEncryptFileName(filePath string) (encryptFilePath string, encryptFileName string, err error)
- func (p *Password) ReadEncryptFile(filePath string) (data []byte, err error)
- type PasswordInterface
- type PasswordStringInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶ added in v1.2.0
type Config struct {
Debug bool // 是否为debug模式
LogFilePath string // 日志路径
Aes aes.AesConfig `yaml:"aes" json:"aes"` // AES加密核心配置
Rsa rsa.RsaConfig `yaml:"rsa" json:"rsa"` // RSA加密核心配置
Hash hash.HashConfig `yaml:"hash" json:"hash"` // HASH加密核心配置
KeyPath string `yaml:"key_path" json:"key_path"`
EccKey Key `yaml:"ecc_key" json:"ecc_key"` // ECC秘钥
}
Config 密码配置对象
type DecryptInterface ¶ added in v1.1.2
DecryptInterface 密码解密接口
type DecryptStringInterface ¶ added in v1.1.2
DecryptStringInterface 字符串解密接口
type Ecc ¶ added in v1.1.0
func (*Ecc) DecryptByPrivateKey ¶ added in v1.2.1
DecryptByPrivateKey 通过特定的私钥进行解密
func (*Ecc) DecryptString ¶ added in v1.1.0
DecryptString 解密字符串
func (*Ecc) EncryptByPublicKey ¶ added in v1.2.1
EncryptByPublicKey 指定公钥进行数据加密
func (*Ecc) EncryptString ¶ added in v1.1.0
EncryptString 加密字符串
func (*Ecc) SetKeyData ¶ added in v1.2.0
SetKeyData 设置公钥和私钥数据
type EncryptInterface ¶ added in v1.1.2
EncryptInterface 密码加密接口
type EncryptStringInterface ¶ added in v1.1.2
EncryptStringInterface 字符串加密接口
type Key ¶ added in v1.2.0
type Key struct {
PrivateKey []byte `yaml:"private_key" json:"private_key"`
PublicKey []byte `yaml:"public_key" json:"public_key"`
PrivateKeyPrefix string `yaml:"private_key_prefix" json:"private_key_prefix"`
PublicKeyPrefix string `yaml:"public_key_prefix" json:"public_key_prefix"`
PrivateKeyFileName string `yaml:"private_key_file_name" json:"private_key_file_name"`
PublicKeyFileName string `yaml:"public_key_file_name" json:"public_key_file_name"`
}
type Password ¶ added in v1.1.2
type Password struct {
Log *zdpgo_log.Log // 日志对象
Config *Config // 配置对象
Aes *aes2.Aes // AES加密核心对象
Rsa *rsa2.Rsa // RSA加密核心对象
Hash *hash2.Hash // HASH加密核心对象
Ecc *Ecc // ECC加密核心对象
Url *zurl.Url // URL编码解码核心对象
Hex *hex.Hex // 十六进制编码解码
}
Password 密码加密核心对象
func NewWithConfig ¶ added in v1.2.3
NewWithConfig 创建加密对象
func (*Password) DecryptFile ¶ added in v1.1.8
DecryptFile 解密文件
func (*Password) DecryptFileNoChangeName ¶ added in v1.1.9
DecryptFileNoChangeName 解密文件且不修改文件名
func (*Password) DecryptFileWithEncryptName ¶ added in v1.1.8
DecryptFileWithEncryptName 根据加密文件名解密文件
func (*Password) EncryptFile ¶ added in v1.1.8
EncryptFile 加密文件
func (*Password) EncryptFileNoChangeName ¶ added in v1.1.9
EncryptFileNoChangeName 加密文件且不修改文件名
type PasswordInterface ¶ added in v1.1.2
type PasswordInterface interface {
EncryptInterface
DecryptInterface
}
PasswordInterface 字节数据密码接口
type PasswordStringInterface ¶ added in v1.1.2
type PasswordStringInterface interface {
EncryptStringInterface
DecryptStringInterface
}
PasswordStringInterface 字符串数据密码接口
Directories
¶
| Path | Synopsis |
|---|---|
|
core
|
|
|
examples
|
|
|
z01_hash
command
|
|
|
z02_aes
command
|
|
|
z03_rsa
command
|
|
|
z04_ecc
command
|
|
|
libs
|
|
|
blake256
Package blake256 implements BLAKE-256 and BLAKE-224 hash functions (SHA-3 candidate).
|
Package blake256 implements BLAKE-256 and BLAKE-224 hash functions (SHA-3 candidate). |
|
pbkdf2
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0.
|
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0. |
Click to show internal directories.
Click to hide internal directories.