myrsa

package
v0.0.0-...-616a791 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

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

func CreatePublicEC(publicKey *rsa.PublicKey, path string) (err error)

CreatePublicEC *

  • @Description: 创建EC格式公钥文件
  • @param privateKey 公钥
  • @param path 公钥文件保存路径
  • @return err 错误

func CreatePublicPem

func CreatePublicPem(publicKey *rsa.PublicKey, path string) (err error)

CreatePublicPem *

  • @Description: 创建PEM格式公钥文件
  • @param publicKey 公钥
  • @param path 私钥文件保存路径
  • @return err 错误

func GenerateRsaKey

func GenerateRsaKey(keySize int) (privateKey *rsa.PrivateKey, publicKey *rsa.PublicKey, err error)

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

func ReadPublicEC(path string) (publicKey *rsa.PublicKey, err error)

ReadPublicEC *

  • @Description: 读取EC格式公钥
  • @param path 公钥文件保存路径
  • @return privateKey 私钥
  • @return err 错误

func ReadPublicPem

func ReadPublicPem(path string) (publicKey *rsa.PublicKey, err error)

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 错误

func RsaEncrypt

func RsaEncrypt(publicKey *rsa.PublicKey, data string) (cipherText string, err error)

RsaEncrypt *

  • @Description: RSA加密
  • @param publicKey 公钥
  • @param data 需要解密的内容
  • @return cipherText 加密后的内容
  • @return error 错误

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL