utils

package
v0.0.0-...-f5904f7 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidBlockSize indicates hash blocksize <= 0.
	ErrInvalidBlockSize = errors.New("invalid blocksize")

	// ErrInvalidPKCS7Data indicates bad input to PKCS7 pad or unpad.
	ErrInvalidPKCS7Data = errors.New("invalid PKCS7 data (empty or not padded)")

	// ErrInvalidPKCS7Padding indicates PKCS7 unpad fails to bad input.
	ErrInvalidPKCS7Padding = errors.New("invalid padding on input")
)

Functions

func AES256Decrypt

func AES256Decrypt(encrypted string, key AESKey) (string, error)

AES256Decrypt decrypt a string using the provided key

func AES256Encrypt

func AES256Encrypt(plaintext string, key AESKey) (string, error)

AES256Encrypt encrypt a string using the provided key

func EncryptRsa

func EncryptRsa(msg string, key *rsa.PublicKey) (string, error)

EncryptRsa encrypts a string using the provided key

func GenerateRsaKey

func GenerateRsaKey(data []string) (*rsa.PublicKey, error)

GenerateRsaKey creates a RSA Public key from an exponent and modulus

Types

type AESKey

type AESKey struct {
	Key []byte
	Iv  []byte
}

AESKey Holds the key and initialitation vector for aes encrypting

func GenerateAESKey

func GenerateAESKey() *AESKey

GenerateAESKey generates a new AESKey

Jump to

Keyboard shortcuts

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