Documentation ¶
Overview ¶
Package rsaKit 对私钥进行"加密"、"解密"操作. *
- 参考(将里面两个PKCS1 marshall改为PKCS8的了):https://www.jianshu.com/p/c102a639cc50
Package rsaKit 支持长文本加解密 *
- Golang-RSA加密解密-数据无大小限制:https://www.cnblogs.com/akidongzi/p/12036165.html *
- 密钥对(公钥、私钥)的要求: PKCS#8、PEM
- 在线生成非对称加密公钥、私钥: http://web.chacuo.net/netrsakeypair
Index ¶
- Variables
- func Decrypt(privateKey, password, data []byte) ([]byte, error)
- func DecryptPEM(pemRaw []byte, passwd []byte) ([]byte, error)
- func DecryptToString(privateKeyData, password, data []byte) (string, error)
- func Encrypt(publicKey []byte, data []byte) ([]byte, error)
- func EncryptPEM(pemRaw []byte, passwd []byte) ([]byte, error)
- func EncryptToString(publicKeyData []byte, data []byte) (string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultPublicKey 默认公钥 DefaultPublicKey []byte // DefaultPrivateKey 默认私钥 DefaultPrivateKey []byte // DefaultPassword 默认私钥的密码 DefaultPassword = []byte("Y3l5") )
Functions ¶
func DecryptPEM ¶
DecryptPEM 通过password,解密私钥 *
- decrypt a pem private key
- input: pem raw
- output: pem raw
func EncryptPEM ¶
EncryptPEM 通过password,加密私钥 *
- encrypt a pem private key
- input: pem raw
- output: pem raw
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.