gorsa

package
v0.0.0-...-8ce3c74 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

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

func EncryptPKCS1

func EncryptPKCS1(input []byte, publicKey *rsa.PublicKey) ([]byte, error)

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 /**

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL