Documentation
¶
Index ¶
- Variables
- func EncryptPKCS1(input []byte, publicKey *rsa.PublicKey) ([]byte, error)
- type RSASecurity
- func (r *RSASecurity) GetPrivateKey() (*rsa.PrivateKey, error)
- func (r *RSASecurity) GetPublickey() (*rsa.PublicKey, error)
- func (r *RSASecurity) PriKeyDECRYPT(input []byte) ([]byte, error)
- func (r *RSASecurity) PriKeyENCTYPT(input []byte) ([]byte, error)
- func (r *RSASecurity) PubKeyDECRYPT(input []byte) ([]byte, error)
- func (r *RSASecurity) PubKeyENCRYPT(input []byte) ([]byte, error)
- func (r *RSASecurity) SetPrivateKey(priStr string) (err error)
- func (r *RSASecurity) SetPublicKey(pubStr string) (err error)
- func (r *RSASecurity) SignMd5WithRsa(data string) (string, error)
- func (r *RSASecurity) SignSha1WithRsa(data string) (string, error)
- func (r *RSASecurity) SignSha256WithRsa(data string) (string, error)
- func (r *RSASecurity) VerifySignMd5WithRsa(data string, signData string) error
- func (r *RSASecurity) VerifySignSha1WithRsa(data string, signData string) error
- func (r *RSASecurity) VerifySignSha256WithRsa(data string, signData string) 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") ErrKeyPairMismatch = 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") )
Functions ¶
Types ¶
type RSASecurity ¶
type RSASecurity struct {
// contains filtered or unexported fields
}
func (*RSASecurity) GetPrivateKey ¶
func (r *RSASecurity) GetPrivateKey() (*rsa.PrivateKey, error)
GetPrivateKey *rsa.PublicKey
func (*RSASecurity) GetPublickey ¶
func (r *RSASecurity) GetPublickey() (*rsa.PublicKey, error)
GetPublickey *rsa.PrivateKey
func (*RSASecurity) PriKeyDECRYPT ¶
func (r *RSASecurity) PriKeyDECRYPT(input []byte) ([]byte, error)
PriKeyDECRYPT 私钥解密
func (*RSASecurity) PriKeyENCTYPT ¶
func (r *RSASecurity) PriKeyENCTYPT(input []byte) ([]byte, error)
PriKeyENCTYPT 私钥加密
func (*RSASecurity) PubKeyDECRYPT ¶
func (r *RSASecurity) PubKeyDECRYPT(input []byte) ([]byte, error)
PubKeyDECRYPT 公钥解密
func (*RSASecurity) PubKeyENCRYPT ¶
func (r *RSASecurity) PubKeyENCRYPT(input []byte) ([]byte, error)
PubKeyENCRYPT 公钥加密
func (*RSASecurity) SetPrivateKey ¶
func (r *RSASecurity) SetPrivateKey(priStr string) (err error)
SetPrivateKey 设置私钥
func (*RSASecurity) SetPublicKey ¶
func (r *RSASecurity) SetPublicKey(pubStr string) (err error)
SetPublicKey 设置公钥
func (*RSASecurity) SignMd5WithRsa ¶
func (r *RSASecurity) SignMd5WithRsa(data string) (string, error)
SignMd5WithRsa /**
func (*RSASecurity) SignSha1WithRsa ¶
func (r *RSASecurity) SignSha1WithRsa(data string) (string, error)
SignSha1WithRsa /**
func (*RSASecurity) SignSha256WithRsa ¶
func (r *RSASecurity) SignSha256WithRsa(data string) (string, error)
SignSha256WithRsa /**
func (*RSASecurity) VerifySignMd5WithRsa ¶
func (r *RSASecurity) VerifySignMd5WithRsa(data string, signData string) error
VerifySignMd5WithRsa /**
func (*RSASecurity) VerifySignSha1WithRsa ¶
func (r *RSASecurity) VerifySignSha1WithRsa(data string, signData string) error
VerifySignSha1WithRsa /**
func (*RSASecurity) VerifySignSha256WithRsa ¶
func (r *RSASecurity) VerifySignSha256WithRsa(data string, signData string) error
VerifySignSha256WithRsa /**
Click to show internal directories.
Click to hide internal directories.