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 GenerateKeyFiles ¶
func GenerateKeyFiles(bits int, format KeyFormat, password, priPath, pubPath string, perm os.FileMode) error
GenerateKeyFiles 生成: 公钥 && 私钥
@param bits 512 ||1024 || 2048 || 3072 || 4096 @param format PKCS1 || PKCS8 @param password 私钥的密码(没有则传"") @param priPath 生成私钥文件的位置 @param pubPath 生成公钥文件的位置
func GenerateKeys ¶
func ParsePrivateKeyFromPem ¶
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.