s4pg

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineShareFiles added in v1.0.2

func CombineShareFiles(inputPaths []string) error

func CombineShares

func CombineShares(rawShares []Share) ([]byte, error)

func DecryptCiphertext

func DecryptCiphertext(ct Ciphertext, password []byte) ([]byte, error)

func EncodeCiphertext

func EncodeCiphertext(ciphertext Ciphertext) ([]byte, error)

func EncodePlaintext

func EncodePlaintext(plaintext Plaintext) ([]byte, error)

func EncodeShare

func EncodeShare(share Share) ([]byte, error)

func EncodeShares

func EncodeShares(shares []Share) ([][]byte, error)

func ReadPassword

func ReadPassword(message string) (*memguard.Enclave, error)

func SplitPlaintextFile added in v1.0.2

func SplitPlaintextFile(inputPath string, count int, threshold int) error

func WritePlaintext

func WritePlaintext(pt Plaintext, fdir string) error

func WriteShares

func WriteShares(shares []Share, fpath string) error

Types

type CipherType added in v1.0.3

type CipherType uint8
const (
	CIPHER_CHACHA20_POLY1305 CipherType = iota
)

type Ciphertext

type Ciphertext struct {
	CipherType CipherType // Cipher type used to encrypt the content
	KDFType    KDFType    // Key derivation function type used to produce the key
	Content    []byte     // Copy of the content, encrypted using a password-derived key
	Salt       []byte     // Salt needed to derive a key from a user-inputted password
	Nonce      []byte     // Nonce needed for the AEAD cipher
}

func DecodeCiphertext

func DecodeCiphertext(raw []byte) (Ciphertext, error)

func EncryptCiphertext

func EncryptCiphertext(raw []byte, password []byte) (Ciphertext, error)

type KDFType added in v1.0.3

type KDFType uint8
const (
	KDF_PBKDF2_SHA256_I500000 KDFType = iota
)

type Plaintext

type Plaintext struct {
	Content  []byte // Copy of the raw content without any encryption applied
	Filename string // Original filename associated with the content
}

func DecodePlaintext

func DecodePlaintext(raw []byte) (Plaintext, error)

func ReadPlaintext

func ReadPlaintext(fpath string) (Plaintext, error)

type Share

type Share struct {
	CipherType CipherType // Cipher type used to encrypt the content
	Content    []byte     // Copy of the content, encrypted using a randomly generated secret
	KeyShare   []byte     // Actual share needed to regenerate the secret key
	Nonce      []byte     // Nonce needed for the AEAD cipher
}

func DecodeShare

func DecodeShare(raw []byte) (Share, error)

func DecodeShares

func DecodeShares(rawShares [][]byte) ([]Share, error)

func ReadShares

func ReadShares(fpaths []string) ([]Share, error)

func SplitShares

func SplitShares(raw []byte, count int, threshold int) ([]Share, error)

Jump to

Keyboard shortcuts

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