rsapkg

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenRsaKey

func GenRsaKey() ([]byte, []byte, error)

GenRsaKey RSA公钥私钥产生

func ParserPrivateKey

func ParserPrivateKey(key []byte) (*rsa.PrivateKey, error)

ParserPrivateKey 解析私钥

func ParserPublicKey

func ParserPublicKey(key []byte) (*rsa.PublicKey, error)

ParserPublicKey 解析公钥

Types

type Encryptor

type Encryptor interface {
	EncryptToString(plaintext string) (string, error)
	DecryptToString(ciphertext string) (string, error)
}

Encryptor ...

type RsaCipher

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

RsaCipher rsa加解密

func NewRsaCipher

func NewRsaCipher(pubKey, priKey []byte) (*RsaCipher, error)

NewRsaCipher rsa加解密

func NewRsaCipherBase64

func NewRsaCipherBase64(pubKeyBase64, priKeyBase64 []byte) (*RsaCipher, error)

NewRsaCipherBase64 rsa加解密

func (*RsaCipher) Decrypt

func (r *RsaCipher) Decrypt(cipherText []byte) ([]byte, error)

func (*RsaCipher) DecryptToString

func (r *RsaCipher) DecryptToString(cipherText string) (string, error)

func (*RsaCipher) Encrypt

func (r *RsaCipher) Encrypt(plainText []byte) ([]byte, error)

func (*RsaCipher) EncryptToString

func (r *RsaCipher) EncryptToString(plainText string) (string, error)

func (*RsaCipher) Sign

func (r *RsaCipher) Sign(text []byte) ([]byte, error)

func (*RsaCipher) VerifySign

func (r *RsaCipher) VerifySign(text, signature []byte) (bool, error)

Jump to

Keyboard shortcuts

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