Documentation ¶
Index ¶
- Variables
- func PriKeyDecrypt(data, privateKey string) (string, error)
- func PriKeyEncrypt(data, privateKey string) (string, error)
- func PublicDecrypt(data, publicKey string) (string, error)
- func PublicEncrypt(data, publicKey string) (string, error)
- type RSASecurity
- func (rsas *RSASecurity) GetPrivatekey() (*rsa.PrivateKey, error)
- func (rsas *RSASecurity) GetPublickey() (*rsa.PublicKey, error)
- func (rsas *RSASecurity) PriKeyDECRYPT(input []byte) ([]byte, error)
- func (rsas *RSASecurity) PriKeyENCTYPT(input []byte) ([]byte, error)
- func (rsas *RSASecurity) PubKeyDECRYPT(input []byte) ([]byte, error)
- func (rsas *RSASecurity) PubKeyENCTYPT(input []byte) ([]byte, error)
- func (rsas *RSASecurity) SetPrivateKey(priStr string) (err error)
- func (rsas *RSASecurity) SetPublicKey(pubStr string) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDataToLarge = errors.New("message too long for RSA public key size") ErrDataLen = errors.New("data length error") ErrDataBroken = errors.New("data broken, first byte is not zero") ErrKeyPairDismatch = errors.New("data is not encrypted by the private key") ErrDecryption = errors.New("decryption error") ErrPublicKey = errors.New("get public key error") ErrPrivateKey = errors.New("get private key error") )
View Source
var RSA = &RSASecurity{}
Functions ¶
Types ¶
type RSASecurity ¶
type RSASecurity struct {
// contains filtered or unexported fields
}
func (*RSASecurity) GetPrivatekey ¶
func (rsas *RSASecurity) GetPrivatekey() (*rsa.PrivateKey, error)
*rsa.PublicKey
func (*RSASecurity) GetPublickey ¶
func (rsas *RSASecurity) GetPublickey() (*rsa.PublicKey, error)
*rsa.PrivateKey
func (*RSASecurity) PriKeyDECRYPT ¶
func (rsas *RSASecurity) PriKeyDECRYPT(input []byte) ([]byte, error)
私钥解密
func (*RSASecurity) PriKeyENCTYPT ¶
func (rsas *RSASecurity) PriKeyENCTYPT(input []byte) ([]byte, error)
私钥加密
func (*RSASecurity) PubKeyDECRYPT ¶
func (rsas *RSASecurity) PubKeyDECRYPT(input []byte) ([]byte, error)
公钥解密
func (*RSASecurity) PubKeyENCTYPT ¶
func (rsas *RSASecurity) PubKeyENCTYPT(input []byte) ([]byte, error)
公钥加密
func (*RSASecurity) SetPrivateKey ¶
func (rsas *RSASecurity) SetPrivateKey(priStr string) (err error)
设置私钥
func (*RSASecurity) SetPublicKey ¶
func (rsas *RSASecurity) SetPublicKey(pubStr string) (err error)
设置公钥
Click to show internal directories.
Click to hide internal directories.