encryption

package
v0.0.1-alpha4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package encryption is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrCorruptedCrypt = errors.New("error corrupted crypt file")

Functions

func GenerateRandomNonce

func GenerateRandomNonce() (nonce, error)

fromReader fills the nonce from an io.Reader - normally the OSes crypto random number generator

Types

type Cipher

type Cipher interface {
	OverheadSize(fileSize int64) int64
	EncryptedSize(fileSize int64) int64
	DecryptedSize(encryptedFileSize int64) (int64, error)
	Open(
		ctx context.Context,
		rh *utils.RangeHeader,
		encryptedFileSize int64,
		password string,
		salt string,
		getReader func(ctx context.Context, start, end int64) (io.ReadCloser, error),
	) (io.ReadCloser, error)
	Name() CipherType
}

type CipherType

type CipherType string
const (
	// The rclone crypt cipher type, which will encrypt all the file using a password, salt.
	RCloneCipherType CipherType = "rclone"
	// The none cipher type, which will not encrypt the file
	NoneCipherType CipherType = "none"
)

type Config

type Config struct {
	// Rclone password for the files in case they were encrypted by rclone crypt
	// Use it, in case you don't want to use rclone crypt anymore
	RclonePassword string `yaml:"rclone_password" mapstructure:"rclone_password" json:"-"`
	// Rclone salt for the files in case they were encrypted by rclone crypt
	// Use it, in case you don't want to use rclone crypt anymore
	RcloneSalt string `yaml:"rclone_salt" mapstructure:"rclone_salt" json:"-"`
}

type MockCipher

type MockCipher struct {
	// contains filtered or unexported fields
}

MockCipher is a mock of Cipher interface.

func NewMockCipher

func NewMockCipher(ctrl *gomock.Controller) *MockCipher

NewMockCipher creates a new mock instance.

func (*MockCipher) DecryptedSize

func (m *MockCipher) DecryptedSize(encryptedFileSize int64) (int64, error)

DecryptedSize mocks base method.

func (*MockCipher) EXPECT

func (m *MockCipher) EXPECT() *MockCipherMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCipher) EncryptedSize

func (m *MockCipher) EncryptedSize(fileSize int64) int64

EncryptedSize mocks base method.

func (*MockCipher) Name

func (m *MockCipher) Name() CipherType

Name mocks base method.

func (*MockCipher) Open

func (m *MockCipher) Open(ctx context.Context, rh *utils.RangeHeader, encryptedFileSize int64, password, salt string, getReader func(context.Context, int64, int64) (io.ReadCloser, error)) (io.ReadCloser, error)

Open mocks base method.

func (*MockCipher) OverheadSize

func (m *MockCipher) OverheadSize(fileSize int64) int64

OverheadSize mocks base method.

type MockCipherMockRecorder

type MockCipherMockRecorder struct {
	// contains filtered or unexported fields
}

MockCipherMockRecorder is the mock recorder for MockCipher.

func (*MockCipherMockRecorder) DecryptedSize

func (mr *MockCipherMockRecorder) DecryptedSize(encryptedFileSize any) *gomock.Call

DecryptedSize indicates an expected call of DecryptedSize.

func (*MockCipherMockRecorder) EncryptedSize

func (mr *MockCipherMockRecorder) EncryptedSize(fileSize any) *gomock.Call

EncryptedSize indicates an expected call of EncryptedSize.

func (*MockCipherMockRecorder) Name

func (mr *MockCipherMockRecorder) Name() *gomock.Call

Name indicates an expected call of Name.

func (*MockCipherMockRecorder) Open

func (mr *MockCipherMockRecorder) Open(ctx, rh, encryptedFileSize, password, salt, getReader any) *gomock.Call

Open indicates an expected call of Open.

func (*MockCipherMockRecorder) OverheadSize

func (mr *MockCipherMockRecorder) OverheadSize(fileSize any) *gomock.Call

OverheadSize indicates an expected call of OverheadSize.

Directories

Path Synopsis
pkcs7
Package pkcs7 implements PKCS#7 padding
Package pkcs7 implements PKCS#7 padding

Jump to

Keyboard shortcuts

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