Documentation ¶
Index ¶
- func Decrypt(data, pemData []byte, password string) ([]byte, error)
- func DecryptPrivatePEM(pemData []byte, format KeyFormat, password string) ([]byte, error)
- func Encrypt(data, pemData []byte) ([]byte, error)
- func EncryptPrivatePEM(pemData []byte, format KeyFormat, password string) ([]byte, error)
- func GenerateKeyFiles(bits int, format KeyFormat, password, priPath, pubPath string) error
- func GenerateKeys(bits int, format KeyFormat, password string) (pri []byte, pub []byte, err error)
- func ParsePrivateKeyFromPem(data []byte, password string) (*rsa.PrivateKey, error)
- func ParsePublicKeyFromPem(pemData []byte) (*rsa.PublicKey, error)
- type KeyFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptPrivatePEM ¶ added in v2.1.32
DecryptPrivatePEM 通过password,解密私钥(.pem格式)
input: pem raw output: pem raw
func EncryptPrivatePEM ¶ added in v2.1.32
EncryptPrivatePEM 加密私钥(通过password)
input: pem raw output: pem raw
func GenerateKeyFiles ¶
GenerateKeyFiles 生成: 公钥 && 私钥
@param bits 512 ||1024 || 2048 || 3072 || 4096 @param format PKCS1 || PKCS8 @param password 私钥的密码(没有则传"") @param priPath 生成私钥文件的位置 @param pubPath 生成公钥文件的位置
func GenerateKeys ¶
func ParsePrivateKeyFromPem ¶ added in v2.1.32
func ParsePrivateKeyFromPem(data []byte, password string) (*rsa.PrivateKey, error)
ParsePrivateKeyFromPem 解析私钥.
支持: PKCS1、PKCS8.
@param password 私钥的密码("": 无密码)
Types ¶
Click to show internal directories.
Click to hide internal directories.