SafePickling is a python library that allows you to sign and verify python pickles
Project description
SafePickling
SafePickling is a python library that allows you to sign and verify python pickles.
graph LR
subgraph Server
A[Object]:::object -->B{Pickle and sign}:::cryptography
C[Key]:::storage --> B
B --> pik2[signature] --> D(Server):::network
B --> pik1[pickle] --> D
end
subgraph Client
D ==> E(Client):::network
E -->unpik2[signature]
E -->unpik1[pickle] --> F{Sign}:::cryptography
known[(Known keys)]:::storage --> F --> F
F --> eq{Is equal?}
unpik2 --> eq:::cryptography
eq -->|Yes|unpik{{Unpickle}}:::cryptography --> Z[Object]:::object
eq -->|No|Invalid(Invalid):::error
end
classDef network fill:#FFD666;
classDef cryptography fill:#82FF66;
classDef error fill:#FF6B66;
classDef storage fill:#DE66FF;
classDef object fill:#666EFF;
Installation
pip install safepickling
Usage Example
object = ExampleObject()
server = SafePickling() # Create a server instance
server.generate_key() # Generate a random key for the server
pickled_object = server.pickle(object) # Pickle the object and sign it
client = SafePickling() # Create a client instance
client.add_trusted_keys([server.key]) # Add the server's key to the client's trusted keys
unpickled_object = client.unpickle(pickled_object) # Unpickle the data while verifying it's signature with the server's key
Cryptography
Random provided by secrets.token_bytes
Hash comparison with hmac.compare_digest
Hashing done using hashlib.blake2b
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
SafePickling-1.0.1.tar.gz
(3.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file SafePickling-1.0.1.tar.gz.
File metadata
- Download URL: SafePickling-1.0.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.9 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82bb07dc213ba92b9eb9954097de1b99a62e7699c358fe35120c814701d8aa4f
|
|
| MD5 |
8806f7036c18e2d7b0c412b0aa19da10
|
|
| BLAKE2b-256 |
e70a064e2310b4b8f0eba0c2853af312581f956f15c454474cb73c2a9cbeee4f
|
File details
Details for the file SafePickling-1.0.1-py3-none-any.whl.
File metadata
- Download URL: SafePickling-1.0.1-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.9 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
286149d8fed558ef511a459479db44ce7bfdb2083c259e6f6fe1cf809d7cd264
|
|
| MD5 |
91defb76eb919340b4e36dfa87939856
|
|
| BLAKE2b-256 |
c5bd50524a54bf326197c3deba1ce08a07550a53e950edee543a1bf197315fb2
|