module cli.encryption_cli

Short summary

module pyquickhelper.cli.encryption_cli

encrypt and decrypt command lines

source on GitHub

Functions

function

truncated documentation

decrypt

Decrypts using class EncryptedBackup. The function relies on module pycrypto, cryptography, …

do_main

Encrypts or decrypts a folder, see EncryptedBackup. The function relies on module pycrypto, cryptography, …

encrypt

Encrypts using class EncryptedBackup. The function relies on module pycrypto, cryptography, …

get_parser

Defines the way to parse the magic command %encrypt and %decrypt.

Documentation

encrypt and decrypt command lines

source on GitHub

pyquickhelper.cli.encryption_cli.decrypt(fLOG=<built-in function print>, args=None)[source]

Decrypts using class EncryptedBackup. The function relies on module pycrypto, cryptography, algoritm AES, Fernet.

Parameters:
  • fLOG – logging function

  • args – to overwrite sys.args

Decrypt a string

Decrypts an encrypted string from the command line.

decrypt –help

usage: decrypt [-h] [-r REGEX] source dest password

decrypt a folder. For a second run, the program looks into file status to
avoid crypting same file gain, it does only modified files it does not work
well in Python 2.7 with pycryptodome.

positional arguments:
  source                folder to decrypt
  dest                  location of the decrypted files
  password              password, usually an ascii string with 16x characters

optional arguments:
  -h, --help            show this help message and exit
  -r REGEX, --regex REGEX
                        the script can retrieve only a subpart of the data
                        defined by a regular expression

source on GitHub

pyquickhelper.cli.encryption_cli.do_main(source, dest, password, encrypt, crypt_file, crypt_map, regex=None, fLOG=None)[source]

Encrypts or decrypts a folder, see EncryptedBackup. The function relies on module pycrypto, cryptography, algoritm AES, Fernet.

Parameters:
  • source – source of files to encrypt or decrypt

  • dest – destination

  • password – password

  • encrypt – boolean, True to encrypt

  • crypt_file – encrypted file

  • crypt_mapEncryptedBackup

  • regex – regular expression to filter in files to retrieve

  • fLOG – logging function

source on GitHub

pyquickhelper.cli.encryption_cli.encrypt(fLOG=<built-in function print>, args=None)[source]

Encrypts using class EncryptedBackup. The function relies on module pycrypto, cryptography, algoritm AES, Fernet.

Parameters:
  • fLOG – logging function

  • args – to overwrite sys.args

Encrypt a string

Encrypts a string from the command line.

encrypt –help

usage: encrypt [-h] [-s STATUS] [-m MAP] source dest password

encrypt a folder. For a second run, the program looks into file status to
avoid crypting same file gain, it does only modified files it does not work
well in Python 2.7 with pycryptodome.

positional arguments:
  source                folder to encrypt
  dest                  location of the encrypted files
  password              password, usually an ascii string with 16x characters

optional arguments:
  -h, --help            show this help message and exit
  -s STATUS, --status STATUS
                        to keep track of what was done
  -m MAP, --map MAP     mapping between raw files and crypted files

source on GitHub

pyquickhelper.cli.encryption_cli.get_parser(encrypt)[source]

Defines the way to parse the magic command %encrypt and %decrypt.

Parameters:

encrypt – encrypt or decrypt

Returns:

parser

source on GitHub