rsa

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDataToLarge     = errors.New("message to 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 = &Security{}

Functions

This section is empty.

Types

type Security

type Security struct {
	// contains filtered or unexported fields
}

func (*Security) GetPrivateKey

func (sec *Security) GetPrivateKey() (*rsa.PrivateKey, error)

func (*Security) GetPublicKey

func (sec *Security) GetPublicKey() (*rsa.PublicKey, error)

func (*Security) PriKeyDecrypt

func (sec *Security) PriKeyDecrypt(input []byte) ([]byte, error)

PriKeyDecrypt 私钥解密

func (*Security) PriKeyEncrypt

func (sec *Security) PriKeyEncrypt(input []byte) ([]byte, error)

PriKeyEncrypt 私钥加密

func (*Security) PubKeyDecrypt

func (sec *Security) PubKeyDecrypt(input []byte) ([]byte, error)

PubKeyDecrypt 公钥解密

func (*Security) PubKeyEncrypt

func (sec *Security) PubKeyEncrypt(input []byte) ([]byte, error)

PubKeyEncrypt 公钥加密

func (*Security) SetPrivateKey

func (sec *Security) SetPrivateKey(priStr string) (err error)

SetPrivateKey 设置私钥

func (*Security) SetPublicKey

func (sec *Security) SetPublicKey(pubStr string) (err error)

SetPublicKey 设置公钥

Jump to

Keyboard shortcuts

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