rsa_utils

package
v0.0.0-...-ac0a939 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToPrivateKey

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

BytesToPrivateKey bytes to private key

func BytesToPublicKey

func BytesToPublicKey(pub []byte) *rsa.PublicKey

BytesToPublicKey bytes to public key

func DecryptWithPrivateKey

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

DecryptWithPrivateKey decrypts data with private key

func EncryptWithPublicKey

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

EncryptWithPublicKey encrypts data with public key

func GenerateKey

func GenerateKey() (*rsa.PrivateKey, *rsa.PublicKey, error)

GenerateKey Copy from https://gist.github.com/wongoo/2b974a9594627114bea3e53c794980cd GenerateKey

func GenerateKey64

func GenerateKey64() (pri64, pub64 string, err error)

func GenerateKeyBytes

func GenerateKeyBytes() (privateBytes, publicBytes []byte, err error)

func GenerateKeyPair

func GenerateKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey)

GenerateKeyPair Copy from https://gist.github.com/miguelmota/3ea9286bd1d3c2a985b67cac4ba2130a GenerateKeyPair generates a new key pair

func PrivateDecrypt

func PrivateDecrypt(key *rsa.PrivateKey, data []byte) ([]byte, error)

func PrivateKeyFrom

func PrivateKeyFrom(key []byte) (*rsa.PrivateKey, error)

func PrivateKeyFrom64

func PrivateKeyFrom64(key string) (*rsa.PrivateKey, error)

func PrivateKeyToBytes

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

PrivateKeyToBytes private key to bytes

func PrivateSign

func PrivateSign(key *rsa.PrivateKey, data []byte) ([]byte, error)

func PrivateVerify

func PrivateVerify(key *rsa.PrivateKey, sign, data []byte) error

func PublicEncrypt

func PublicEncrypt(key *rsa.PublicKey, data []byte) ([]byte, error)

func PublicKeyFrom

func PublicKeyFrom(key []byte) (*rsa.PublicKey, error)

func PublicKeyFrom64

func PublicKeyFrom64(key string) (*rsa.PublicKey, error)

func PublicKeyToBytes

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

PublicKeyToBytes public key to bytes

func PublicSign

func PublicSign(key *rsa.PublicKey, data []byte) ([]byte, error)

func PublicVerify

func PublicVerify(key *rsa.PublicKey, sign, data []byte) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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