rsa

package
v1.6.28 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: BSD-2-Clause-Patent Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToPrivateKey

func BytesToPrivateKey(priv []byte) (sk *rsa.PrivateKey, err error)

BytesToPrivateKey converts bytes to private key

func BytesToPublicKey

func BytesToPublicKey(pub []byte) (pk *rsa.PublicKey, err error)

BytesToPublicKey converts bytes to public key

func Decrypt

func Decrypt(ciphered, privateKeyBytes []byte) ([]byte, error)

Decrypt ...

func DecryptWithPrivateKey

func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) ([]byte, error)

DecryptWithPrivateKey decrypts data with private key

func Encrypt

func Encrypt(msg, publicKeyBytes []byte) ([]byte, error)

Encrypt ...

func EncryptWithPublicKey

func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) ([]byte, error)

EncryptWithPublicKey encrypts data with public key

func GenerateKeyPair

func GenerateKeyPair(bits int) (sk *rsa.PrivateKey, pk *rsa.PublicKey, err error)

GenerateKeyPair generates a new key pair

func PrivateKeyToBytes

func PrivateKeyToBytes(priv *rsa.PrivateKey) []byte

PrivateKeyToBytes transforms private key to bytes

func PublicKeyToBytes

func PublicKeyToBytes(pub *rsa.PublicKey) ([]byte, error)

PublicKeyToBytes transforms public key to bytes

Types

This section is empty.

Jump to

Keyboard shortcuts

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