rsa

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(sk *rsa.PrivateKey, in []byte) ([]byte, error)

Decrypt decrypts input with private key.

func Encrypt

func Encrypt(pk *rsa.PublicKey, in, label []byte) ([]byte, error)

Encrypt encrypts input with public key.

func ExportRSAPrivateKeyAsPEMString

func ExportRSAPrivateKeyAsPEMString(privkey *rsa.PrivateKey) string

ExportRSAPrivateKeyAsPEMString converts private key to string.

func ExportRSAPublicKeyAsPEMString

func ExportRSAPublicKeyAsPEMString(pubkey *rsa.PublicKey) (string, error)

ExportRSAPublicKeyAsPEMString converts public key to string.

func ParseRSAPrivateKeyFromPEMString

func ParseRSAPrivateKeyFromPEMString(privPEM string) (*rsa.PrivateKey, error)

ParseRSAPrivateKeyFromPEMString converts string private key to private key.

func ParseRSAPublicKeyFromPEMString

func ParseRSAPublicKeyFromPEMString(pubPEM string) (*rsa.PublicKey, error)

ParseRSAPublicKeyFromPEMString converts string public key to public key.

Types

type KeyPair

type KeyPair struct {
	Private *rsa.PrivateKey
	Public  *rsa.PublicKey
}

KeyPair is RSA key pair.

func GenerateKeyPair

func GenerateKeyPair() (KeyPair, error)

GenerateKeyPair returns private & public keys.

Jump to

Keyboard shortcuts

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