Documentation ¶
Index ¶
- type Encryption
- func (e *Encryption) CreateEncryptionKey(encryptedFilename string, strings []string, encFunc bool) ([]byte, error)
- func (e *Encryption) DecryptFile(encryptedFilename string, key []byte, toDisk bool) ([]byte, error)
- func (e *Encryption) EncryptFile(filename string, contentData []byte, key []byte) error
- func (e *Encryption) SetLogger(log logger.LoggerInterface)
- type Parameters
- type RealFileOps
- func (r *RealFileOps) Create(name string) (*os.File, error)
- func (r *RealFileOps) Open(name string) (*os.File, error)
- func (r *RealFileOps) ReadFile(name string) ([]byte, error)
- func (r *RealFileOps) Remove(name string) error
- func (r *RealFileOps) WriteDecryptedFile(filename string, key []byte, data []byte, perm os.FileMode) error
- func (r *RealFileOps) WriteEncryptedFile(filename string, data []byte, key []byte, perm os.FileMode) error
- func (r *RealFileOps) WriteFile(filename string, data []byte, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encryption ¶
type Encryption struct { DB initdb.DBInterface FI fileutils.FileInterface DBConfig initdb.DBConfigInterface Log logger.LoggerInterface Parameters *Parameters FileOps fileutils.FileOperator GetWrittenData []byte DBInitializer initdb.DBInitializer FUInitializer fileutils.FUInitializer }
func NewEncryption ¶
func NewEncryption(dbcfg initdb.DBConfigInterface, dbInitializer initdb.DBInitializer, fuInitializer fileutils.FUInitializer, log logger.LoggerInterface, parameters *Parameters) *Encryption
func (*Encryption) CreateEncryptionKey ¶
func (*Encryption) DecryptFile ¶
Decryption Logic
func (*Encryption) EncryptFile ¶
func (e *Encryption) EncryptFile(filename string, contentData []byte, key []byte) error
Encryption Logic
encryptFile encrypts the file with the given key and writes the encrypted data to a new file
func (*Encryption) SetLogger ¶
func (e *Encryption) SetLogger(log logger.LoggerInterface)
type Parameters ¶
type Parameters struct { PartsDir string PrefixParts string Timestamp int64 CURRENT_VERSION string }
func NewParamters ¶
func NewParamters(partsDir string, prefixParts string, timestamp int64, currentVersion string) *Parameters
type RealFileOps ¶
type RealFileOps struct {
Enc *Encryption
}
func (*RealFileOps) Remove ¶
func (r *RealFileOps) Remove(name string) error
func (*RealFileOps) WriteDecryptedFile ¶
func (*RealFileOps) WriteEncryptedFile ¶
Click to show internal directories.
Click to hide internal directories.