fortifier

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const FileMagicNumber = uint32(0x40F1ED00)

Variables

This section is empty.

Functions

This section is empty.

Types

type Aes256DecrypterCFB

type Aes256DecrypterCFB struct {
	Aes256StreamDecrypter
}

func NewAes256DecrypterCFB

func NewAes256DecrypterCFB(f *Fortifier) *Aes256DecrypterCFB

func (*Aes256DecrypterCFB) Decrypt

func (f *Aes256DecrypterCFB) Decrypt(r io.Reader, w io.Writer, layout *FileLayout) error

func (*Aes256DecrypterCFB) DecryptFile

func (f *Aes256DecrypterCFB) DecryptFile(in, out *os.File, layout *FileLayout) error

type Aes256DecrypterCTR

type Aes256DecrypterCTR struct {
	Aes256StreamDecrypter
}

func NewAes256DecrypterCTR

func NewAes256DecrypterCTR(f *Fortifier) *Aes256DecrypterCTR

func (*Aes256DecrypterCTR) Decrypt

func (f *Aes256DecrypterCTR) Decrypt(r io.Reader, w io.Writer, layout *FileLayout) error

func (*Aes256DecrypterCTR) DecryptFile

func (f *Aes256DecrypterCTR) DecryptFile(in, out *os.File, layout *FileLayout) error

type Aes256DecrypterOFB

type Aes256DecrypterOFB struct {
	Aes256StreamDecrypter
}

func NewAes256DecrypterOFB

func NewAes256DecrypterOFB(f *Fortifier) *Aes256DecrypterOFB

func (*Aes256DecrypterOFB) Decrypt

func (f *Aes256DecrypterOFB) Decrypt(r io.Reader, w io.Writer, layout *FileLayout) error

func (*Aes256DecrypterOFB) DecryptFile

func (f *Aes256DecrypterOFB) DecryptFile(in, out *os.File, layout *FileLayout) error

type Aes256EncrypterCFB

type Aes256EncrypterCFB struct {
	Aes256StreamEncrypter
}

func NewAes256EncrypterCFB

func NewAes256EncrypterCFB(f *Fortifier) *Aes256EncrypterCFB

func (*Aes256EncrypterCFB) EncryptFile

func (f *Aes256EncrypterCFB) EncryptFile(in, out *os.File) error

type Aes256EncrypterCTR

type Aes256EncrypterCTR struct {
	Aes256StreamEncrypter
}

func NewAes256EncrypterCTR

func NewAes256EncrypterCTR(f *Fortifier) *Aes256EncrypterCTR

func (*Aes256EncrypterCTR) EncryptFile

func (f *Aes256EncrypterCTR) EncryptFile(in, out *os.File) error

type Aes256EncrypterOFB

type Aes256EncrypterOFB struct {
	Aes256StreamEncrypter
}

func NewAes256EncrypterOFB

func NewAes256EncrypterOFB(f *Fortifier) *Aes256EncrypterOFB

func (*Aes256EncrypterOFB) EncryptFile

func (f *Aes256EncrypterOFB) EncryptFile(in, out *os.File) error

type Aes256StreamDecrypter

type Aes256StreamDecrypter struct {
	*Fortifier
}

func (*Aes256StreamDecrypter) Decrypt

func (f *Aes256StreamDecrypter) Decrypt(in io.Reader, w io.Writer, layout *FileLayout, mode CipherMode) (err error)

func (*Aes256StreamDecrypter) DecryptFile

func (f *Aes256StreamDecrypter) DecryptFile(in, out *os.File, layout *FileLayout, mode CipherMode) (err error)

type Aes256StreamEncrypter

type Aes256StreamEncrypter struct {
	*Fortifier
}

func (*Aes256StreamEncrypter) Encrypt

func (f *Aes256StreamEncrypter) Encrypt(
	in io.Reader, out io.WriteSeeker, layout *FileLayout, mode CipherMode) (err error)

func (*Aes256StreamEncrypter) EncryptFile

func (f *Aes256StreamEncrypter) EncryptFile(in, out *os.File, mode CipherMode) (err error)

type CipherKey

type CipherKey interface {
	CipherKeyKind() CipherKeyKind
	NewSha256() hash.Hash
}

type CipherKeyData

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

func (*CipherKeyData) CipherKeyKind

func (k *CipherKeyData) CipherKeyKind() CipherKeyKind

func (*CipherKeyData) NewSha256

func (k *CipherKeyData) NewSha256() hash.Hash

type CipherKeyKind

type CipherKeyKind string
const (
	CipherKeyKindSSS CipherKeyKind = "sss"
	CipherKeyKindRSA CipherKeyKind = "rsa"
)

func (CipherKeyKind) String

func (s CipherKeyKind) String() string

type CipherMode

type CipherMode struct {
	Name       CipherModeName
	SteamMaker func(block cipher.Block, iv []byte) cipher.Stream
}

type CipherModeName

type CipherModeName string
const (
	CipherModeAes256CTR CipherModeName = "aes256-ctr"
	CipherModeAes256OFB CipherModeName = "aes256-ofb"
	CipherModeAes256CFB CipherModeName = "aes256-cfb"
)

func (CipherModeName) String

func (s CipherModeName) String() string

type Decrypter

type Decrypter interface {
	Decrypt(r io.Reader, w io.Writer, layout *FileLayout) error
	DecryptFile(in, out *os.File, layout *FileLayout) error
}

func NewDecrypter

func NewDecrypter(mode CipherModeName, f *Fortifier) Decrypter

type Encrypter

type Encrypter interface {
	EncryptFile(in, out *os.File) error
}

func NewEncrypter

func NewEncrypter(mode CipherModeName, f *Fortifier) Encrypter

type FileLayout

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

func (*FileLayout) DataLength

func (f *FileLayout) DataLength() uint64

func (*FileLayout) Metadata

func (f *FileLayout) Metadata() *Metadata

func (*FileLayout) ReadHeadIn

func (f *FileLayout) ReadHeadIn(in io.Reader) (err error)

func (*FileLayout) String

func (f *FileLayout) String() string

func (*FileLayout) Version

func (f *FileLayout) Version() rune

func (*FileLayout) WriteHeadOut

func (f *FileLayout) WriteHeadOut(out io.Writer) (err error)

func (*FileLayout) WriteHeadPlaceHolders

func (f *FileLayout) WriteHeadPlaceHolders(
	out io.WriteSeeker, key *CipherKeyData, check hash.Hash, dataLen int64) (err error)

type Fortifier

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

func NewFortifierWithRsa

func NewFortifierWithRsa(verbose bool, meta *Metadata, bytes []byte) *Fortifier

func NewFortifierWithSss

func NewFortifierWithSss(verbose, truncate bool, parts []sss.Part) *Fortifier

func (*Fortifier) SetupKey

func (f *Fortifier) SetupKey() (err error)

type Metadata

type Metadata struct {
	Timestamp time.Time      `json:"timestamp"`
	Key       CipherKeyKind  `json:"key"`
	Mode      CipherModeName `json:"mode"`
	Sss       *MetadataSss   `json:"sss"`
	Rsa       *MetadataRsa   `json:"rsa"`
}

type MetadataRsa

type MetadataRsa struct {
	Timestamp  time.Time `json:"timestamp"`
	Digest     string    `json:"digest"`
	Ciphertext string    `json:"ciphertext"`
}

type MetadataSss

type MetadataSss struct {
	Timestamp time.Time `json:"timestamp"`
	Digest    string    `json:"digest"`
	Parts     uint8     `json:"parts"`
	Threshold uint8     `json:"threshold"`
}

Jump to

Keyboard shortcuts

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