Documentation ¶
Index ¶
- func CreateCertificate(publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey, caPath string) (err error)
- func CreatePrivateEC(privateKey *rsa.PrivateKey, path string) (err error)
- func CreatePrivatePem(privateKey *rsa.PrivateKey, path string) (err error)
- func CreatePublicEC(publicKey *rsa.PublicKey, path string) (err error)
- func CreatePublicPem(publicKey *rsa.PublicKey, path string) (err error)
- func GenerateRsaKey(keySize int) (privateKey *rsa.PrivateKey, publicKey *rsa.PublicKey, err error)
- func LoadCertificate(path string) (certificate *x509.Certificate, err error)
- func ReadPrivateEC(path string) (privateKey *rsa.PrivateKey, err error)
- func ReadPrivatePem(path string) (privateKey *rsa.PrivateKey, err error)
- func ReadPublicEC(path string) (publicKey *rsa.PublicKey, err error)
- func ReadPublicPem(path string) (publicKey *rsa.PublicKey, err error)
- func RsaDecrypt(privateKey *rsa.PrivateKey, cipherText string) (data string, err error)
- func RsaEncrypt(publicKey *rsa.PublicKey, data string) (cipherText string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCertificate ¶
func CreateCertificate(publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey, caPath string) (err error)
CreateCertificate *
- @Description: 生成自签证书文件(RSA)
- @param publicKey 公钥
- @param privateKey 私钥
- @param path 证书保存路径(不包含证书名)
- @return err 错误
func CreatePrivateEC ¶
func CreatePrivateEC(privateKey *rsa.PrivateKey, path string) (err error)
CreatePrivateEC *
- @Description: 创建EC格式私钥文件
- @param privateKey 私钥
- @param path 私钥文件保存路径
- @return err 错误
func CreatePrivatePem ¶
func CreatePrivatePem(privateKey *rsa.PrivateKey, path string) (err error)
CreatePrivatePem *
- @Description: 创建PEM格式私钥文件
- @param privateKey 私钥
- @param path 私钥文件保存路径
- @return err 错误
func CreatePublicEC ¶
CreatePublicEC *
- @Description: 创建EC格式公钥文件
- @param privateKey 公钥
- @param path 公钥文件保存路径
- @return err 错误
func CreatePublicPem ¶
CreatePublicPem *
- @Description: 创建PEM格式公钥文件
- @param publicKey 公钥
- @param path 私钥文件保存路径
- @return err 错误
func GenerateRsaKey ¶
GenerateRsaKey *
- @Description: 生成RSA公私钥
- @param keySize
- @return privateKey
- @return publicKey
- @return err
func LoadCertificate ¶
func LoadCertificate(path string) (certificate *x509.Certificate, err error)
LoadCertificate *
- @Description: 读取CA证书
- @param path CA证书路径
- @return certificate CA证书
- @return err 错误
func ReadPrivateEC ¶
func ReadPrivateEC(path string) (privateKey *rsa.PrivateKey, err error)
ReadPrivateEC *
- @Description: 读取EC格式私钥
- @param path 私钥文件保存路径
- @return privateKey 私钥
- @return err 错误
func ReadPrivatePem ¶
func ReadPrivatePem(path string) (privateKey *rsa.PrivateKey, err error)
ReadPrivatePem *
- @Description: 读取PEM格式私钥
- @param path 私钥文件保存路径
- @return privateKey 私钥
- @return err 错误
func ReadPublicEC ¶
ReadPublicEC *
- @Description: 读取EC格式公钥
- @param path 公钥文件保存路径
- @return privateKey 私钥
- @return err 错误
func ReadPublicPem ¶
ReadPublicPem *
- @Description: 读取PEM格式公钥
- @param path 公钥文件保存路径
- @return publicKey 公钥
- @return err 错误
func RsaDecrypt ¶
func RsaDecrypt(privateKey *rsa.PrivateKey, cipherText string) (data string, err error)
RsaDecrypt *
- @Description: RSA解密
- @param privateKey 私钥
- @param cipherText 加密后的字符串
- @return data 解密后的内容
- @return err 错误
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.