cryptutil

package
v0.0.0-...-f21823f Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptAESKey

func DecryptAESKey(encryptedAESKey []byte, privateKey rsa.PrivateKey) []byte

Decrypt the AES key with the RSA private key

func DecryptFile

func DecryptFile(filename string, extension string, aeskey *[]byte)

func EncryptAESKey

func EncryptAESKey(aesBytes *[]byte, pubkey rsa.PublicKey) []byte

Encrypt the AES key with OAEP RSA public key

func EncryptFile

func EncryptFile(filename string, extension string, aeskey *[]byte)

func GenerateAES

func GenerateAES(aesBytes *[]byte)

Generate random 32-byte AES key

func GenerateRSA

func GenerateRSA() *rsa.PrivateKey

Generate 2048-bit RSA keypair

func LoadAESKey

func LoadAESKey(aesKey *[]byte, filename string)

Read hex encoded AES key from file and return byte array. Key can be encrypted or unencrypted, but must be hex encoded

func LoadRSAPrivateKey

func LoadRSAPrivateKey(filename string) *rsa.PrivateKey

Reads RSA key formatted in x509 PKCS1 from file and returns the key value in type 'rsa.PrivateKey'

func LoadRSAPublicKey

func LoadRSAPublicKey(fileName string) rsa.PublicKey

func SaveAESKey

func SaveAESKey(aesBytes []byte, fileName string)

Save AES key to file system, hex encoded. Key can be plaintext or encrypted This function is insecure, and should not be used in a live demo when testing security controls

func SaveRSAPrivateKey

func SaveRSAPrivateKey(privateKey rsa.PrivateKey, fileName string)

Saves RSA private key to file in x509 PKCS1 format This function should never be performed on the target system that is used for testing security controls

func SaveRSAPublicKey

func SaveRSAPublicKey(publicKey rsa.PublicKey, fileName string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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