A python xxxFile like (ie GzipFile, BZ2File, ...) for manipulating Nacl encrypted files.
Project description
NaclFile
A python xxxFile like (ie TarFile, GzipFile, BZ2File, pyzstd.ZstdFile, ...) for encrypting files with PyNacl SecretBox.
This project is part of the CofferFile : https://github.com/bibi21000/CofferFile.
If you're looking for a more powerfull storage for your sensible datas, look at PyCoffer : https://github.com/bibi21000/PyCoffer.
Install
pip install naclfile
Create your encryption key
from nacl import utils
key = utils.random(SecretBox.KEY_SIZE)
and store it in a safe place (disk, database, ...).
This key is essential to encrypt and decrypt data. Losing this key means losing the data.
"open" your encrypted files like normal files
Text files :
from naclfile import open as nacl_open
with nacl_open('test.nacl', mode='wt', secret_key=key, encoding="utf-8") as ff:
ff.write(data)
with nacl_open('test.nacl', "rt", secret_key=key, encoding="utf-8") as ff:
data = ff.read()
with nacl_open('test.nacl', mode='wt', secret_key=key, encoding="utf-8") as ff:
ff.writelines(data)
with nacl_open('test.nacl', "rt", secret_key=key, encoding="utf-8") as ff:
data = ff.readlines()
Binary files :
with nacl_open('test.nacl', mode='wb', secret_key=key) as ff:
ff.write(data)
with nacl_open('test.nacl', "rb", secret_key=key) as ff:
data = ff.read()
Crypt and compress ... for better performances.
Look at https://github.com/bibi21000/CofferFile/blob/main/BENCHMARK.md.
from naclfile.zstd import open as nacl_open
with nacl_open('test.nacz', mode='wb', secret_key=key) as ff:
ff.write(data)
with nacl_open('test.nacz', "rb", secret_key=key) as ff:
data = ff.read()
Crypt and compress your tar files
from naclfile.tar import open as tar_open
with tar_open('test.tarcz', mode='w', secret_key=key) as ff:
ff.add(file1,'file1.data')
ff.add(file2,'file2.data')
with tar_open('test.tarcz', "r", secret_key=key) as ff:
ff.extractall()
Look at documentation : https://bibi21000.github.io/NaclFile/
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
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 naclfile-0.0.6.tar.gz.
File metadata
- Download URL: naclfile-0.0.6.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf16cb6fbe11b8b06c464e4a61df19e3c650641cc15fabb9dff1455c2e127cef
|
|
| MD5 |
9e86ed590ba139917708a499cfb36c9a
|
|
| BLAKE2b-256 |
6c43a5f0db0b77defe99364b0a72dc8591ca572d3b879551104733080947760c
|
Provenance
The following attestation bundles were made for naclfile-0.0.6.tar.gz:
Publisher:
python-publish.yml on bibi21000/NaclFile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
naclfile-0.0.6.tar.gz -
Subject digest:
bf16cb6fbe11b8b06c464e4a61df19e3c650641cc15fabb9dff1455c2e127cef - Sigstore transparency entry: 179063521
- Sigstore integration time:
-
Permalink:
bibi21000/NaclFile@f0d13d2d297d8949bc006de2878984bddb9738aa -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/bibi21000
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f0d13d2d297d8949bc006de2878984bddb9738aa -
Trigger Event:
release
-
Statement type:
File details
Details for the file naclfile-0.0.6-py3-none-any.whl.
File metadata
- Download URL: naclfile-0.0.6-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afa9857498b93c32bcbb8ac4c02e0b4d09a780cbe4f2aef88d459a3b8d01ee5d
|
|
| MD5 |
70ddb76979880a11730f1e3e4de609e1
|
|
| BLAKE2b-256 |
1333845f9621de06bcceed97ebf94e530134006b66fd4f0fc7c9a51f6f7def30
|
Provenance
The following attestation bundles were made for naclfile-0.0.6-py3-none-any.whl:
Publisher:
python-publish.yml on bibi21000/NaclFile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
naclfile-0.0.6-py3-none-any.whl -
Subject digest:
afa9857498b93c32bcbb8ac4c02e0b4d09a780cbe4f2aef88d459a3b8d01ee5d - Sigstore transparency entry: 179063525
- Sigstore integration time:
-
Permalink:
bibi21000/NaclFile@f0d13d2d297d8949bc006de2878984bddb9738aa -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/bibi21000
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f0d13d2d297d8949bc006de2878984bddb9738aa -
Trigger Event:
release
-
Statement type: