Documentation ¶
Index ¶
- Constants
- func Base64DecodeString(encode string) (pubKey []byte, err error)
- func Base64EncodeString(pubPEM []byte) (basePubKey string)
- func DecodingByPrivateKey(privateKey string, result []byte) (decodeStr []byte, err error)
- func ExportPrivateKeyAsPEM(privateKey *rsa.PrivateKey) []byte
- func ExportPublicKeyAsPEM(publicKey *rsa.PublicKey) []byte
- func GenerateRSAKey() (*rsa.PrivateKey, *rsa.PublicKey)
- func GetPublicKeyFromPriKey(privKey []byte) *rsa.PublicKey
- func LoadPrivateKey(privPEM []byte) *rsa.PrivateKey
- func LoadPublicKey(pubPEM []byte) *rsa.PublicKey
Constants ¶
View Source
const BITS = 2048 // 密钥长度 1024 2048
Variables ¶
This section is empty.
Functions ¶
func Base64DecodeString ¶
Base64DecodeString BASE64解码
func Base64EncodeString ¶
Base64EncodeString BASE64编码
func DecodingByPrivateKey ¶
DecodingByPrivateKey 私钥解密
func ExportPrivateKeyAsPEM ¶
func ExportPrivateKeyAsPEM(privateKey *rsa.PrivateKey) []byte
ExportPrivateKeyAsPEM 将 RSA 私钥导出为 PEM 格式
func ExportPublicKeyAsPEM ¶
ExportPublicKeyAsPEM 将 RSA 公钥导出为 PEM 格式
func GenerateRSAKey ¶
func GenerateRSAKey() (*rsa.PrivateKey, *rsa.PublicKey)
GenerateRSAKey 生成 RSA 密钥对
func GetPublicKeyFromPriKey ¶
GetPublicKeyFromPriKey 通过密钥获取公钥
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.