key

package
v0.0.0-...-fe6a4cd Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptAESKey

func DecryptAESKey(encryptedKey []byte, privateKey *rsa.PrivateKey) ([]byte, error)

DecryptAESKey decrypts an AES key using the RSA private key.

func EncryptAESKey

func EncryptAESKey(aesKey []byte, publicKey *rsa.PublicKey) ([]byte, error)

EncryptAESKey encrypts an AES key using an RSA public key.

func ExtractPublicKey

func ExtractPublicKey(privateKey *rsa.PrivateKey) *rsa.PublicKey

ExtractPublicKey extracts the RSA public key from a private key.

func GenerateAESKey

func GenerateAESKey() ([]byte, error)

GenerateAESKey generates a new AES key.

func GenerateRSAKeyPair

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

GenerateRSAKeyPair generates an RSA private and public key pair.

func LoadEncryptedAESKey

func LoadEncryptedAESKey() ([]byte, error)

LoadEncryptedAESKey loads the encrypted AES key from a binary file.

func LoadPrivateKey

func LoadPrivateKey() (*rsa.PrivateKey, error)

LoadPrivateKey loads an RSA private key from a PEM file.

func SaveEncryptedAESKey

func SaveEncryptedAESKey(encryptedKey []byte) error

SaveEncryptedAESKey saves the encrypted AES key to a file.

func SavePrivateKey

func SavePrivateKey(privateKey *rsa.PrivateKey) error

SavePrivateKey saves the RSA private key to a PEM file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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