rsa

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePrivateKey

func GeneratePrivateKey(bits int) ([]byte, error)

func GeneratePrivateKeyFile

func GeneratePrivateKeyFile(bits int, filepath string) error

func GeneratePrivateKeyString

func GeneratePrivateKeyString(bits int) (string, error)

func GeneratePublicKey

func GeneratePublicKey(privateKey []byte) ([]byte, error)

func GeneratePublicKeyFile

func GeneratePublicKeyFile(privateKey []byte, filepath string) error

func GeneratePublicKeyString

func GeneratePublicKeyString(privateKey string) (string, error)

func PEMDecode

func PEMDecode(filepath string) (*pem.Block, error)

func PEMEncode

func PEMEncode(filepath string, stream []byte, isPrivate bool) error

Types

type RSA

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

func New

func New(privateKey string) (*RSA, error)

func (*RSA) Decrypt

func (r *RSA) Decrypt(cipherbytes []byte) (plainbytes []byte, err error)

func (*RSA) Encrypt

func (r *RSA) Encrypt(plainbytes []byte) (cipherbytes []byte, err error)

func (*RSA) GetPublickKey added in v1.0.3

func (r *RSA) GetPublickKey() string

func (*RSA) Sign

func (r *RSA) Sign(message []byte) (signature []byte, err error)

func (*RSA) Verify

func (r *RSA) Verify(message, signature []byte) (ok bool, err error)

type RSAEncryptor added in v1.0.3

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

func NewEncryptor added in v1.0.3

func NewEncryptor(publicKey string) (*RSAEncryptor, error)

func (*RSAEncryptor) Encrypt added in v1.0.3

func (r *RSAEncryptor) Encrypt(plainbytes []byte) (cipherbytes []byte, err error)

Jump to

Keyboard shortcuts

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