Documentation ¶
Overview ¶
Package crypto is used for encyption of bytes This is TOY encryption and keep the RSA privatekey next to the encrypted AES key. The private key should be stored someone a bit more secure. ;)
Current version: experimental
Index ¶
- Variables
- func AesCfbDecrypt(encryptedBytes []byte, hash string) ([]byte, error)
- func AesCfbEncrypt(bytesToEncrypt []byte, hash string) ([]byte, error)
- func DeleteAesSecret(hash string)
- func GenerateAesSecret() []byte
- func GenerateRsaKey()
- func GetAesSecretPath(hash string) string
- func LoadOrGenerateRsaKey()
- func RsaDecrypt(encryptedBytes []byte) ([]byte, error)
- func RsaEncrypt(bytesToEncrypt []byte) ([]byte, error)
- type AesKey
- type RsaChipher
Constants ¶
This section is empty.
Variables ¶
var CertifcatePath = filepath.Join(os.TempDir(), "blocker", "cert.pem")
Path to the certificate
var KeyPath = filepath.Join(os.TempDir(), "blocker", "key.pem")
Path to the private key
Functions ¶
func AesCfbDecrypt ¶
Encrpyt data using AES with the CFB chipher mode
func AesCfbEncrypt ¶
Encrpyt data using AES with the CFB chipher mode
func DeleteAesSecret ¶
func DeleteAesSecret(hash string)
DeleteAesSecret - Remove a key if not needed
func GetAesSecretPath ¶
GetAesSecretPath - Will return a key name for a hash
func RsaDecrypt ¶
Decrypt data using RSA and a private key
func RsaEncrypt ¶
Encrypt data using RSA and a public key
Types ¶
type AesKey ¶
type AesKey struct {
// contains filtered or unexported fields
}
Structure to hold unencrypted AES key
func GetAesSecret ¶
Get the AES secret to be used for encryption
type RsaChipher ¶
type RsaChipher struct { PrivateKey *rsa.PrivateKey PrivateKeyPath string PublicKey *rsa.PublicKey PublicKeyPath string }
Structure for encryption chipher
var RsaEncryptionChipher RsaChipher
The key to be used to encrypt and decrypt when using RSA encryption