Documentation ¶
Overview ¶
Package encrypt rsa encryption and decryption Author: Frank Lee Date: 2017-11-17 11:51:41 Last Modified by: Frank Lee Last Modified time: 2018-03-22 13:35:41
Index ¶
- func Decrypt(cipherText string, privateKey *rsa.PrivateKey) ([]byte, error)
- func Encrypt(plainText string, publicKey *rsa.PublicKey) ([]byte, error)
- func GeneratePrivateKey(privateKey []byte, keyType KeyType) (*rsa.PrivateKey, error)
- func GeneratePrivateKeyFromFile(keyPath string, keyType KeyType) (*rsa.PrivateKey, error)
- func GeneratePublicKey(publicKey []byte) (*rsa.PublicKey, error)
- func GeneratePublicKeyFromFile(keyPath string) (*rsa.PublicKey, error)
- type KeyType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
func Decrypt(cipherText string, privateKey *rsa.PrivateKey) ([]byte, error)
Decrypt rsa decrypt param cipherText: cipher text param privateKey: private key return []byte: plain bytes return error: errors
func Encrypt ¶
Encrypt rsa encrypt param plainText: plain text param publicKey: public key string return []byte: cipher bytes return error: errors
func GeneratePrivateKey ¶
func GeneratePrivateKey(privateKey []byte, keyType KeyType) (*rsa.PrivateKey, error)
GeneratePrivateKey generate private key using key string
func GeneratePrivateKeyFromFile ¶
func GeneratePrivateKeyFromFile(keyPath string, keyType KeyType) (*rsa.PrivateKey, error)
GeneratePrivateKeyFromFile generate private key using pem file
func GeneratePublicKey ¶
GeneratePublicKey generate public key using key string
Types ¶
Click to show internal directories.
Click to hide internal directories.