Documentation ¶
Index ¶
- Constants
- func ConvertByteArrayToHex(arr []byte) string
- func ConvertByteArrayToString(arr []byte) string
- func ConvertHexToByteArray(hexa string) ([]byte, error)
- func CreateAES256Key() []byte
- func FileDecryption(filePath string, aesKey []byte, bufferSize int, fileExtension string) error
- func FileEncryption(filePath string, key []byte, bufferSize int, fileExtension string) error
- func GetFiles(rootPath string) []string
- type AsymmetricEncOptions
- type AsymmetricEncryption
- func (asymEnc *AsymmetricEncryption) RSAEncrypt(keyToEncrypt []byte, pubKey string) ([]byte, error)
- func (asymEnc *AsymmetricEncryption) RetrieveAndDecryptEncKeyFromFile(filePath string, rsa_private_key_path string) ([]byte, error)
- func (asymEnc *AsymmetricEncryption) SaveAsHEXToFile(key []byte, path string, filename string, fileExtension string) (string, error)
- type EncOptions
- type FolderEncryption
- type Logger
- type LoggerFunc
Constants ¶
View Source
const (
DEFAULT_BUFFER_SIZE = 4096
)
Variables ¶
This section is empty.
Functions ¶
func ConvertByteArrayToHex ¶
func ConvertHexToByteArray ¶
func CreateAES256Key ¶
func CreateAES256Key() []byte
func FileDecryption ¶
func FileEncryption ¶
Types ¶
type AsymmetricEncOptions ¶
type AsymmetricEncOptions func(*AsymmetricEncryption)
func WithLoggerForAsymmetricEnc ¶
func WithLoggerForAsymmetricEnc(logger Logger) AsymmetricEncOptions
type AsymmetricEncryption ¶
type AsymmetricEncryption struct {
Logger Logger
}
func NewAssymetricEncryption ¶
func NewAssymetricEncryption(args ...AsymmetricEncOptions) (*AsymmetricEncryption, error)
func (*AsymmetricEncryption) RSAEncrypt ¶
func (asymEnc *AsymmetricEncryption) RSAEncrypt(keyToEncrypt []byte, pubKey string) ([]byte, error)
func (*AsymmetricEncryption) RetrieveAndDecryptEncKeyFromFile ¶
func (asymEnc *AsymmetricEncryption) RetrieveAndDecryptEncKeyFromFile(filePath string, rsa_private_key_path string) ([]byte, error)
func (*AsymmetricEncryption) SaveAsHEXToFile ¶
type EncOptions ¶
type EncOptions func(*FolderEncryption)
func WithBufferSize ¶
func WithBufferSize(size int) EncOptions
func WithEncryptionKey ¶
func WithEncryptionKey(key []byte) EncOptions
func WithLogger ¶
func WithLogger(logger Logger) EncOptions
type FolderEncryption ¶
type FolderEncryption struct { Folder string FileExtension string BufferSize int SymmetricKey []byte Logger Logger }
func NewFolderDecryption ¶
func NewFolderDecryption(encryptedPath string, opts ...EncOptions) (*FolderEncryption, error)
func NewFolderEncryption ¶
func NewFolderEncryption(pathToEncrypt string, fileExtension string, opts ...EncOptions) (*FolderEncryption, error)
func (*FolderEncryption) DecryptFiles ¶
func (opts *FolderEncryption) DecryptFiles() (int64, error)
func (*FolderEncryption) Encrypt ¶
func (opts *FolderEncryption) Encrypt() (int64, error)
type Logger ¶
type Logger interface {
Log(...interface{})
}
Should be used to provide custom logging writers for the SDK to use.
type LoggerFunc ¶
type LoggerFunc func(...interface{})
Wrapper for client to satisfy Logger interface
Ex: alanacrypt.LoggerFunc(func(args ...interface{}) { fmt.Fprintln(os.Stdout, args...) }
func (LoggerFunc) Log ¶
func (f LoggerFunc) Log(args ...interface{})
Log calls the wrapped function with the arguments provided
Click to show internal directories.
Click to hide internal directories.