Documentation
¶
Index ¶
- Constants
- func DecryptByPrivateKey(data []byte, privateKeyStr string) ([]byte, error)
- func EncryptByPrivateKey(data []byte, privateKeyStr string) ([]byte, error)
- func EncryptByPublicKey(data []byte, publicKeyStr string) ([]byte, error)
- func GenerateKey() ([]string, error)
- func LoadPrivateKeyFromFile(filename string) (string, error)
- func LoadPublicKeyFromFile(filename string) (string, error)
- func SaveKeyToPemFile(publicKeyBase64, privateKeyBase64, publicKeyFile, privateKeyFile string) error
- func Sign(data []byte, privateKeyStr string) (string, error)
- func Verify(data []byte, publicKeyStr string, sign string) (bool, error)
Constants ¶
View Source
const (
// 密钥长度
KEYSIZE = 1024
)
Variables ¶
This section is empty.
Functions ¶
func DecryptByPrivateKey ¶
DecryptByPrivateKey 使用私钥解密 - 使用PKCS1v15填充,与Java的RSA/ECB/PKCS1Padding转换模式兼容
func EncryptByPrivateKey ¶
EncryptByPrivateKey 使用私钥加密(签名)- 使用PKCS1v15填充,与Java的RSA/ECB/PKCS1Padding转换模式兼容
func EncryptByPublicKey ¶
EncryptByPublicKey 使用公钥加密 - 使用PKCS1v15填充,与Java的RSA/ECB/PKCS1Padding转换模式兼容
func LoadPrivateKeyFromFile ¶
LoadPrivateKeyFromFile 从文件加载私钥
func LoadPublicKeyFromFile ¶
LoadPublicKeyFromFile 从文件加载公钥
func SaveKeyToPemFile ¶
func SaveKeyToPemFile(publicKeyBase64, privateKeyBase64, publicKeyFile, privateKeyFile string) error
SaveKeyToPemFile 将公钥和私钥保存到PEM文件
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.