rsakit

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptFromBase64

func DecryptFromBase64(privateKey rsa.PrivateKey, cipher string) (string, error)

func DecryptOAEP

func DecryptOAEP(privateKey rsa.PrivateKey, cipher []byte) ([]byte, error)

func DecryptPKCS1v15

func DecryptPKCS1v15(privateKey rsa.PrivateKey, cipher []byte) ([]byte, error)

func EncryptIntoBase64

func EncryptIntoBase64(publicKey rsa.PublicKey, plain string) (string, error)

func EncryptOAEP

func EncryptOAEP(publicKey rsa.PublicKey, plain []byte) ([]byte, error)

func EncryptPKCS1v15

func EncryptPKCS1v15(publicKey rsa.PublicKey, plain []byte) ([]byte, error)

func FormatKey

func FormatKey(key string) (string, error)

func ParseIntoAuthorizedKeyBuf

func ParseIntoAuthorizedKeyBuf(publicKey *rsa.PublicKey) (*ssh.PublicKey, *bytes.Buffer)

func ParseIntoPrivateKeyBuf

func ParseIntoPrivateKeyBuf(privateKey *rsa.PrivateKey) *bytes.Buffer

func ParseIntoPublicKeyBuf

func ParseIntoPublicKeyBuf(publicKey *rsa.PublicKey) *bytes.Buffer

func ParsePrivateKey

func ParsePrivateKey(privateKey string) *rsa.PrivateKey

func ParsePublicKey

func ParsePublicKey(publicKey string) *rsa.PublicKey

func SignPKCS1v15

func SignPKCS1v15(privateKey *rsa.PrivateKey, target []byte) ([]byte, error)

func SignPSS

func SignPSS(privateKey *rsa.PrivateKey, target []byte) ([]byte, error)

func SignText

func SignText(privateKey *rsa.PrivateKey, plain string) string

func VerifyPKCS1v15

func VerifyPKCS1v15(publicKey *rsa.PublicKey, target []byte, signature []byte) error

func VerifyPSS

func VerifyPSS(publicKey *rsa.PublicKey, signature []byte) error

func VerifyText

func VerifyText(publicKey *rsa.PublicKey, content string, signature string) bool

Types

type RSAKey

type RSAKey struct {
	PrivateKey       *rsa.PrivateKey
	PrivateKeyBuff   *bytes.Buffer
	PrivateKeyText   string
	PrivateKeyBase64 string

	PublicKey       *rsa.PublicKey
	PublicKeyBuff   *bytes.Buffer
	PublicKeyText   string
	PublicKeyBase64 string

	AuthorizedKey       *ssh.PublicKey
	AuthorizedKeyBuff   *bytes.Buffer
	AuthorizedKeyText   string
	AuthorizedKeyBase64 string
}

func GenerateRSAKeyPair

func GenerateRSAKeyPair(bits int) RSAKey

Jump to

Keyboard shortcuts

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