Documentation ¶
Index ¶
- type RSASecret
- type RsaCrypt
- func (rc *RsaCrypt) Decrypt(src string, srcType gocrypt.Encode) (dst string, err error)
- func (rc *RsaCrypt) DecryptBlock(src string, srcType gocrypt.Encode) (bytesDecrypt string, err error)
- func (rc *RsaCrypt) Encrypt(src string, outputDataType gocrypt.Encode) (dst string, err error)
- func (rc *RsaCrypt) EncryptBlock(src string, outputDataType gocrypt.Encode) (dst string, err error)
- func (rc *RsaCrypt) Sign(src string, hashType gocrypt.Hash, outputDataType gocrypt.Encode) (dst string, err error)
- func (rc *RsaCrypt) VerifySign(src string, hashType gocrypt.Hash, signedData string, ...) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RsaCrypt ¶
type RsaCrypt struct {
// contains filtered or unexported fields
}
func NewRSACrypt ¶
NewRSACrypt init with the RSA secret info
func (*RsaCrypt) Decrypt ¶
Decrypt decrypts a plaintext using private key src the encrypted data with public key srcType the encode type of encrypted data ,such as Base64,HEX
func (*RsaCrypt) DecryptBlock ¶
func (rc *RsaCrypt) DecryptBlock(src string, srcType gocrypt.Encode) (bytesDecrypt string, err error)
分段解密
func (*RsaCrypt) Encrypt ¶
Encrypt encrypts the given message with public key src the original data outputDataType the encode type of encrypted data ,such as Base64,HEX
func (*RsaCrypt) EncryptBlock ¶
分段加密
func (*RsaCrypt) Sign ¶
func (rc *RsaCrypt) Sign(src string, hashType gocrypt.Hash, outputDataType gocrypt.Encode) (dst string, err error)
Sign calculates the signature of input data with the hash type & private key src the original unsigned data hashType the type of hash ,such as MD5,SHA1... outputDataType the encode type of sign data ,such as Base64,HEX
func (*RsaCrypt) VerifySign ¶
func (rc *RsaCrypt) VerifySign(src string, hashType gocrypt.Hash, signedData string, signDataType gocrypt.Encode) (bool, error)
VerifySign verifies input data whether match the sign data with the public key src the original unsigned data signedData the data signed with private key hashType the type of hash ,such as MD5,SHA1... signDataType the encode type of sign data ,such as Base64,HEX