Package Gnumed :: Package pycommon :: Module gmCrypto
[frames] | no frames]

Module gmCrypto

source code

GNUmed crypto tools.

First and only rule:

        DO NOT REIMPLEMENT ENCRYPTION

        Use existing tools.


Author: K. Hilbert <Karsten.Hilbert@gmx.net>

License: GPL v2 or later (details at http://www.gnu.org)

Functions
 
create_encrypted_zip_archive_from_dir(source_dir, comment=None, overwrite=True, passphrase=None, verbose=False)
Use 7z to create an encrypted ZIP archive of a directory.
source code
 
create_zip_archive_from_dir(source_dir, archive_name=None, comment=None, overwrite=True, verbose=False) source code
 
gpg_decrypt_file(filename=None, passphrase=None, verbose=False, target_ext=None) source code
 
gpg_encrypt_file_symmetric(filename=None, comment=None, verbose=False, passphrase=None, remove_unencrypted=False) source code
 
aes_encrypt_file(filename=None, passphrase=None, comment=None, verbose=False, remove_unencrypted=False) source code
 
encrypt_pdf(filename=None, passphrase=None, verbose=False) source code
 
encrypt_file_symmetric(filename=None, passphrase=None, comment=None, verbose=False, remove_unencrypted=False) source code
 
encrypt_file(filename=None, receiver_key_ids=None, passphrase=None, comment=None, verbose=False, remove_unencrypted=False) source code
 
encrypt_directory_content(directory=None, receiver_key_ids=None, passphrase=None, comment=None, verbose=False, remove_unencrypted=True) source code
Variables
  __doc__ = """GNUmed crypto too...
  __package__ = 'Gnumed.pycommon'

Imports: sys, os, logging, tempfile, gmLog2, gmShellAPI, gmTools


Function Details

create_encrypted_zip_archive_from_dir(source_dir, comment=None, overwrite=True, passphrase=None, verbose=False)

source code 
Use 7z to create an encrypted ZIP archive of a directory.

<source_dir>            will be included into the archive
<comment>                       included as a file containing the comment
<overwrite>                     remove existing archive before creation, avoiding
                                        *updating* of those, and thereby including unintended data
<passphrase>            minimum length of 5

The resulting zip archive will always be named
"datawrapper.zip" for confidentiality reasons. If callers
want another name they will have to shutil.move() the zip
file themselves. This archive will be compressed and
AES256 encrypted with the given passphrase. Therefore,
the result will not decrypt with earlier versions of
unzip software. On Windows, 7z oder WinZip are needed.

The zip format does not support header encryption thereby
allowing attackers to gain knowledge of patient details
by observing the names of files and directories inside
the encrypted archive.

To reduce that attack surface, GNUmed will create
_another_ zip archive inside "datawrapper.zip", which
eventually wraps up the patient data as "data.zip". That
archive is not compressed and not encrypted, and can thus
be unpacked with any old unzipper.

Note that GNUmed does NOT remember the passphrase for
you. You will have to take care of that yourself, and
possibly also safely hand over the passphrase to any
receivers of the zip archive.


Variables Details

__doc__

Value:
"""GNUmed crypto tools.

First and only rule:

	DO NOT REIMPLEMENT ENCRYPTION

	Use existing tools.
"""