Documentation ¶
Index ¶
- func DecryptCipherText(ciphertext []byte, privateKey *rsa.PrivateKey) (string, error)
- func EncryptMessage(message string, publicKey *rsa.PublicKey) ([]byte, error)
- func GenerateKeyPair() (*rsa.PrivateKey, *rsa.PublicKey, error)
- func LoadPrivateKeyFromFile(filePath string) (*rsa.PrivateKey, error)
- func LoadPublicKeyFromFile(filePath string) (*rsa.PublicKey, error)
- func ParsePrivateKey(privKeyStr string) (*rsa.PrivateKey, error)
- func ParsePublicKey(pubKeyStr string) (*rsa.PublicKey, error)
- func PrivateKeyToString(privateKey *rsa.PrivateKey) (string, error)
- func PublicKeyToString(publicKey *rsa.PublicKey) (string, error)
- func SavePrivateKeyToFile(privateKey *rsa.PrivateKey, filePath string) error
- func SavePublicKeyToFile(publicKey *rsa.PublicKey, filePath string) error
- func SignMessage(message string, privateKey *rsa.PrivateKey) ([]byte, error)
- func ValidatePublicAndPrivateKeys(privateKeyStr string, publicKeyStr string) bool
- func VerifySignature(signature []byte, publicKey *rsa.PublicKey, message string) error
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 ¶
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 ¶
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 ¶
Function to parse public key
func PrivateKeyToString ¶
func PrivateKeyToString(privateKey *rsa.PrivateKey) (string, error)
Function to convert *rsa.PrivateKey into a string
func PublicKeyToString ¶
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 ¶
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
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.