Skip to main content

SecPickle

We all know that the Python Pickle module is not secure because arbitrary code can be executed. The function of secpickle is to guarantee that you will only unzip files that were generated by you, avoiding reading unknown files.

How to use

The functions available in secpickle are:

  • load()
  • loads()
  • dump()
  • dumps()

Only one thing changes in using these functions: an argument called key has been added to each of them. The key is requested so that a unique hash can be used to prove that file was created by you. The more complex your key, the greater the security.

The same key used for dump must be used to load the file. Otherwise, the IntegrityUnconfirmedError exception will be thrown, indicating, as the name implies, that it is not possible to confirm whether that file was created by you.

from secpickle import secpickle

data = [{'name': 'SecPickle'}]
key = 'this-is-my-secret-key'

with open('data', 'wb') as file:
    secpickle.dump(data, file, key)

with open('data', 'rb') as file:
    result = secpickle.load(file, key)

print(result)

License

BSD 3-Clause License
Copyright (c) 2023, Firlast

This project uses the BSD 3-Clause License, please read the license for more informations.

Metadata

Release files for secpickle 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for secpickle 0.1.0
File Size Uploaded
secpickle-0.1.0.tar.gz 2.6 kB Details

Release files / secpickle-0.1.0.tar.gz

Download URL secpickle-0.1.0.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b4cbff5d0409e9449e5e8198b912883516a9e41d3b2c0600744e3e603c820480
BLAKE2b-256 checksum
How to use checksums
b2d379c57e686050a71de7617bda65f20714ce9cbf8d450eaad8a76a0ecef8af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page