Documentation ¶
Index ¶
- Variables
- func MD5(p []byte) []byte
- func MD5ToString(p []byte) string
- func RSADecryptByPrivateKey(key string, data []byte) ([]byte, error)
- func RSADecryptByPublicKey(key string, data []byte) ([]byte, error)
- func RSAEncryptByPrivateKey(key string, data []byte) (string, error)
- func RSAEncryptByPublicKey(key string, data []byte) (string, error)
- func RSAGenerateKey(bits int, format KeyFormat) (privateKey string, publicKey string, err error)
- func SHA1(p []byte) []byte
- func SHA1ToString(p []byte) string
- func SHA256(p []byte) []byte
- func SHA256ToString(p []byte) string
- type KeyFormat
Constants ¶
This section is empty.
Variables ¶
View Source
var KeyFormatErr = errors.New("the key format must be PKCS#1 or PKCS#8")
View Source
var PrivateKeyErr = errors.New("private key error")
View Source
var PublicKeyErr = errors.New("public key error")
Functions ¶
func MD5ToString ¶
func RSAGenerateKey ¶
RSAGenerateKey generate public and private keys in pem format bits: 512、1024、2048、3072、4096 format: PKCS1、PKCS8
func SHA1ToString ¶
func SHA256ToString ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.