rsa

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 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, publicKey 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) 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)

Jump to

Keyboard shortcuts

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