Skip to main content

Python module to handle tarfile backups.

Project description

Secure Tar

Secure Tarfile library

It's a streaming wrapper around python tarfile and allow secure handling files and support encryption.

with SecureTarFile("test.tar", "w") as tar_file:
        atomic_contents_add(
            tar_file,
            temp_orig,
            excludes=[],
            arcname=".",
        )

with SecureTarFile("test.tar", "w", b"AES128_KEY_SIZE") as tar_file:
        atomic_contents_add(
            tar_file,
            temp_orig,
            excludes=[],
            arcname=".",
        )

A common pattern is to create an outer uncompressed tarfile that contains a variety of inner tar files. This can be accomplished without writing out multiple files with the following pattern.

outer_secure_tar_file = SecureTarFile("pkg.tar", "w", gzip=False)
with outer_secure_tar_file as outer_tar_file:
    with outer_secure_tar_file.create_inner_tar(
        "./backup1.tar.gz", gzip=True
    ) as inner_tar_file:
        atomic_contents_add(
            inner_tar_file,
            path_1,
            excludes=[],
            arcname=".",
        )

    with outer_secure_tar_file.create_inner_tar(
        "./backup2.tar.gz", gzip=True
    ) as inner_tar_file:
        atomic_contents_add(
            inner_tar_file,
            path_2,
            excludes=[],
            arcname=".",
        )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

securetar-2024.2.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

securetar-2024.2.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file securetar-2024.2.0.tar.gz.

File metadata

  • Download URL: securetar-2024.2.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for securetar-2024.2.0.tar.gz
Algorithm Hash digest
SHA256 ea01eb573fd47957cc11651c7bef1d545cf53322ccf8bdd5dd38a4ddd2d35d53
MD5 cab6163b73567d3f2d6f3f2066c9f839
BLAKE2b-256 67df9e13731929d9baece9c9f9ffe7012a089f78b67053844bf4e2a30ebee262

See more details on using hashes here.

File details

Details for the file securetar-2024.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for securetar-2024.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec47b359f4b9a074ae0d186bcde82bea5fd9dce7040b38f468446ce2c98b381f
MD5 9ea27a183fbec4371e496843d57da696
BLAKE2b-256 354fe760584397e2a2d88ce61539fb2a708f05d695744bf66909588d529a234c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page