Documentation
¶
Index ¶
- Constants
- func PKCS7Padding(clearTextLen, blockSize int) []byte
- func ReadPassword(minLen int, twice bool) (string, error)
- type AES
- func (a *AES) Decrypt(ciphertext []byte) []byte
- func (a *AES) DecryptFile(r io.Reader, w io.Writer) error
- func (a *AES) Encrypt(plaintext []byte) []byte
- func (a *AES) EncryptFile(r io.Reader, w io.Writer) error
- func (a *AES) EncryptedFileLength(fi os.FileInfo) int64
- func (a *AES) InitDecryption(iv []byte)
- func (a *AES) InitEncryption() ([]byte, error)
- func (a *AES) RemovePadding(clear []byte) []byte
- type Cipher
- type Status
- type TarArchive
- type Vigenere
- type WalkFunc
- type Xor
- type ZipArchive
- func (a *ZipArchive) Cancel()
- func (a *ZipArchive) Create(output string, files []string, fn WalkFunc, random bool) error
- func (a *ZipArchive) ExtractAll(archive, outputDir string) error
- func (a *ZipArchive) ExtractAt(pos int, archive, outputDir string) error
- func (a *ZipArchive) SetPassword(pwd string)
- func (a *ZipArchive) Status() Status
Constants ¶
const (
Version = "1.2.2"
)
Variables ¶
This section is empty.
Functions ¶
func ReadPassword ¶
ReadPassword reads a password of minLen lenght on the CLI and returns it. If twice is true, asks for confirmation. An error is returned if the password is empty or passwords don't match, of length of password is lesser than minLen.
Types ¶
type AES ¶
type AES struct {
// contains filtered or unexported fields
}
Advanced Encryption Standard
func NewAES ¶
Strong AES encryption, with a cipher operating in CBC mode, using a derived 256 bits key using PBKDF2.
func (*AES) Decrypt ¶
Decrypt decripts a block of ciphertext. You have to ensure this ciphertext is a multiple of AES's block size.
func (*AES) DecryptFile ¶
DecryptFile decrypts infile and saves the resulting AES decoding to outfile.
func (*AES) EncryptFile ¶
EncryptFile encrypts infile and saves the resulting AES encoding to outfile.
func (*AES) EncryptedFileLength ¶
EncryptedFileLength returns the expected encrypted file length. This information can be used to provide file size info to archive/tar for example.
func (*AES) InitDecryption ¶
Uses IV and set cipher's operation mode to CBC.
func (*AES) InitEncryption ¶
Computes a random IV and set cipher's operation mode to CBC.
func (*AES) RemovePadding ¶
RemovePadding removes extra padding for plain text.
type TarArchive ¶
type TarArchive struct {
// contains filtered or unexported fields
}
func NewTarArchive ¶
func NewTarArchive(password string) *TarArchive
func (*TarArchive) Extract ¶
func (a *TarArchive) Extract(input, outputDir string) error
type ZipArchive ¶
func NewZipArchive ¶
func NewZipArchive(password string) *ZipArchive
func (*ZipArchive) Cancel ¶
func (a *ZipArchive) Cancel()
Cancel stops the current processing, if any.
func (*ZipArchive) Create ¶
Create creates a new ZIP output archive given a list of input files. fn() is called just after a file has been encrypted and added to the archive. Set random to true to rename file with their md5 checksum.
func (*ZipArchive) ExtractAll ¶
func (a *ZipArchive) ExtractAll(archive, outputDir string) error
ExtractAll extracts all encrypted files from zip archive. The resulting files are decrypted using the provided password.
func (*ZipArchive) ExtractAt ¶
func (a *ZipArchive) ExtractAt(pos int, archive, outputDir string) error
ExtractAt extracts a single file at position pos from zip archive. The resulting file is decrypted using the provided password.
func (*ZipArchive) SetPassword ¶
func (a *ZipArchive) SetPassword(pwd string)
func (*ZipArchive) Status ¶
func (a *ZipArchive) Status() Status