crypto

package
v0.0.0-...-b9171e1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptCipherText

func DecryptCipherText(ciphertext []byte, privateKey *rsa.PrivateKey) (string, error)

Function to decrypt ciphertext using private key

func EncryptMessage

func EncryptMessage(message string, publicKey *rsa.PublicKey) ([]byte, error)

Function to encrypt message using public key

func GenerateKeyPair

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

Function to generate RSA Public-Private key pair and print in string

func LoadPrivateKeyFromFile

func LoadPrivateKeyFromFile(filePath string) (*rsa.PrivateKey, error)

Function to load RSA private key from a file

func LoadPublicKeyFromFile

func LoadPublicKeyFromFile(filePath string) (*rsa.PublicKey, error)

Function to load RSA public key from a file

func ParsePrivateKey

func ParsePrivateKey(privKeyStr string) (*rsa.PrivateKey, error)

Function to parse private key

func ParsePublicKey

func ParsePublicKey(pubKeyStr string) (*rsa.PublicKey, error)

Function to parse public key

func PrivateKeyToString

func PrivateKeyToString(privateKey *rsa.PrivateKey) (string, error)

Function to convert *rsa.PrivateKey into a string

func PublicKeyToString

func PublicKeyToString(publicKey *rsa.PublicKey) (string, error)

Function to convert *rsa.PublicKey into a string

func SavePrivateKeyToFile

func SavePrivateKeyToFile(privateKey *rsa.PrivateKey, filePath string) error

Function to save RSA private key to a file

func SavePublicKeyToFile

func SavePublicKeyToFile(publicKey *rsa.PublicKey, filePath string) error

Function to save RSA public key to a file

func SignMessage

func SignMessage(message string, privateKey *rsa.PrivateKey) ([]byte, error)

Function to sign message using private key

func ValidatePublicAndPrivateKeys

func ValidatePublicAndPrivateKeys(privateKeyStr string, publicKeyStr string) bool

func VerifySignature

func VerifySignature(signature []byte, publicKey *rsa.PublicKey, message string) error

Function to verify signature using public key

Types

This section is empty.

Jump to

Keyboard shortcuts

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